mercurial/sshrepo.py
changeset 9861 0262bb59016f
parent 9467 4c041f1ee1b4
child 9878 7e7d56fe4833
--- a/mercurial/sshrepo.py	Mon Nov 16 14:09:31 2009 +0100
+++ b/mercurial/sshrepo.py	Mon Nov 16 13:35:36 2009 +0100
@@ -7,7 +7,7 @@
 
 from node import bin, hex
 from i18n import _
-import repo, util, error
+import repo, util, error, encoding
 import re, urllib
 
 class remotelock(object):
@@ -173,6 +173,10 @@
             for branchpart in d.splitlines():
                 branchheads = branchpart.split(' ')
                 branchname = urllib.unquote(branchheads[0])
+                try:
+                    branchname.decode('utf-8', 'strict')
+                except UnicodeDecodeError:
+                    branchname = encoding.tolocal(branchname)
                 branchheads = [bin(x) for x in branchheads[1:]]
                 branchmap[branchname] = branchheads
             return branchmap