[PATCH] transfer branchmap branch names over the wire in utf-8
Henrik Stuart
hg at hstuart.dk
Mon Oct 26 18:41:31 UTC 2009
Matt Mackall wrote:
> 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.
Right.
>> 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.
True, however, the alternative was to break with the way that the branch
cache is returned, since that always has the branch names in local
encoding, possibly requiring a lot more changes. On closer
consideration, I agree that it is a better solution, and that should
probably be the way it is done. I'll look at that tomorrow.
--
Kind regards,
Henrik Stuart
More information about the Mercurial-devel
mailing list