diff mercurial/httprepo.py @ 9878:7e7d56fe4833 stable

branchmap: fix defective fallback fix 0262bb59016f The fix applied as 0262bb59016f doesn't work and is essentially a no-op. This fix also adds a comment about the nature of the problem, and a test.
author Sune Foldager <cryo@cyanite.org>
date Wed, 18 Nov 2009 15:20:08 +0100
parents 0262bb59016f
children 54b518fc6671 25e572394f5c
line wrap: on
line diff
--- a/mercurial/httprepo.py	Tue Nov 17 22:16:41 2009 +0100
+++ b/mercurial/httprepo.py	Wed Nov 18 15:20:08 2009 +0100
@@ -154,10 +154,13 @@
             for branchpart in d.splitlines():
                 branchheads = branchpart.split(' ')
                 branchname = urllib.unquote(branchheads[0])
+                # Earlier servers (1.3.x) send branch names in (their) local
+                # charset. The best we can do is assume it's identical to our
+                # own local charset, in case it's not utf-8.
                 try:
-                    branchname.decode('utf-8', 'strict')
+                    branchname.decode('utf-8')
                 except UnicodeDecodeError:
-                    branchname = encoding.tolocal(branchname)
+                    branchname = encoding.fromlocal(branchname)
                 branchheads = [bin(x) for x in branchheads[1:]]
                 branchmap[branchname] = branchheads
             return branchmap