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

Henrik Stuart hg at hstuart.dk
Mon Oct 26 09:03:34 UTC 2009


# HG changeset patch
# User Henrik Stuart <henrik.stuart at edlund.dk>
# Date 1255607727 -7200
# Node ID f1ae12a5c436c30e8ff4927315298c9fdf499d3c
# Parent  07a62819b3096e5c05f0b799587f0f373470e9d7
transfer branchmap branch names over the wire in utf-8

diff -r 07a62819b309 -r f1ae12a5c436 mercurial/hgweb/protocol.py
--- a/mercurial/hgweb/protocol.py	Fri Oct 16 00:09:18 2009 +0200
+++ b/mercurial/hgweb/protocol.py	Thu Oct 15 13:55:27 2009 +0200
@@ -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 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))
         branchnodes = [hex(node) for node in nodes]
         heads.append('%s %s' % (branchname, ' '.join(branchnodes)))
     resp = '\n'.join(heads)
diff -r 07a62819b309 -r f1ae12a5c436 mercurial/httprepo.py
--- a/mercurial/httprepo.py	Fri Oct 16 00:09:18 2009 +0200
+++ b/mercurial/httprepo.py	Thu Oct 15 13:55:27 2009 +0200
@@ -8,6 +8,7 @@
 
 from node import bin, hex, nullid
 from i18n import _
+from encoding import tolocal
 import repo, changegroup, statichttprepo, error, url, util
 import os, urllib, urllib2, urlparse, zlib, httplib
 import errno, socket
@@ -151,7 +152,7 @@
             branchmap = {}
             for branchpart in d.splitlines():
                 branchheads = branchpart.split(' ')
-                branchname = urllib.unquote(branchheads[0])
+                branchname = tolocal(urllib.unquote(branchheads[0]))
                 branchheads = [bin(x) for x in branchheads[1:]]
                 branchmap[branchname] = branchheads
             return branchmap
diff -r 07a62819b309 -r f1ae12a5c436 mercurial/sshrepo.py
--- a/mercurial/sshrepo.py	Fri Oct 16 00:09:18 2009 +0200
+++ b/mercurial/sshrepo.py	Thu Oct 15 13:55:27 2009 +0200
@@ -7,6 +7,7 @@
 
 from node import bin, hex
 from i18n import _
+from encoding import tolocal
 import repo, util, error
 import re, urllib
 
@@ -172,7 +173,7 @@
             branchmap = {}
             for branchpart in d.splitlines():
                 branchheads = branchpart.split(' ')
-                branchname = urllib.unquote(branchheads[0])
+                branchname = tolocal(urllib.unquote(branchheads[0]))
                 branchheads = [bin(x) for x in branchheads[1:]]
                 branchmap[branchname] = branchheads
             return branchmap
diff -r 07a62819b309 -r f1ae12a5c436 mercurial/sshserver.py
--- a/mercurial/sshserver.py	Fri Oct 16 00:09:18 2009 +0200
+++ b/mercurial/sshserver.py	Thu Oct 15 13:55:27 2009 +0200
@@ -8,6 +8,7 @@
 
 from i18n import _
 from node import bin, hex
+from encoding import fromlocal
 import streamclone, util, hook
 import os, sys, tempfile, urllib
 
@@ -68,7 +69,7 @@
         branchmap = self.repo.branchmap()
         heads = []
         for branch, nodes in branchmap.iteritems():
-            branchname = urllib.quote(branch)
+            branchname = fromlocal(urllib.quote(branch))
             branchnodes = [hex(node) for node in nodes]
             heads.append('%s %s' % (branchname, ' '.join(branchnodes)))
         self.respond('\n'.join(heads))



More information about the Mercurial-devel mailing list