[PATCH] transfer branchmap branch names over the wire in utf-8

Matt Mackall mpm at selenic.com
Mon Oct 26 17:38:17 UTC 2009


On Mon, 2009-10-26 at 11:26 +0100, Henrik Stuart wrote:
> # HG changeset patch
> # User Henrik Stuart <henrik.stuart at edlund.dk>
> # Date 1256552644 -3600
> # Node ID 02987e66bc417e0522a05d8aa8076ad09648d377
> # Parent  07a62819b3096e5c05f0b799587f0f373470e9d7
> transfer branchmap branch names over the wire in utf-8

> diff -r 07a62819b309 -r 02987e66bc41 mercurial/hgweb/protocol.py
> --- a/mercurial/hgweb/protocol.py	Fri Oct 16 00:09:18 2009 +0200
> +++ b/mercurial/hgweb/protocol.py	Mon Oct 26 11:24:04 2009 +0100
> @@ -9,6 +9,7 @@
>  from mercurial import util, streamclone
>  from mercurial.node import bin, hex
>  from mercurial import changegroup as changegroupmod
> +from mercurial.encoding import fromlocal

From-style imports defeat demand-importing.

>  from common import ErrorResponse, HTTP_OK, HTTP_NOT_FOUND, HTTP_SERVER_ERROR
>  
>  # __all__ is populated with the allowed commands. Be sure to add to it if
> @@ -42,7 +43,7 @@
>      branches = repo.branchmap()
>      heads = []
>      for branch, nodes in branches.iteritems():
> -        branchname = urllib.quote(branch)
> +        branchname = urllib.quote(fromlocal(branch))

This looks problematic. Going from UTF-8 -> local -> UTF-8 is lossy.

-- 
http://selenic.com : development and support for Mercurial and Linux





More information about the Mercurial-devel mailing list