# HG changeset patch # User Sune Foldager # Date 1258554008 -3600 # Node ID 7e7d56fe4833124f271e4f3b1877cbfc00444f34 # Parent c51494c538411b4e9c365445a6b0dcaf168e20b0 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. diff -r c51494c53841 -r 7e7d56fe4833 mercurial/httprepo.py --- 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 diff -r c51494c53841 -r 7e7d56fe4833 mercurial/sshrepo.py --- a/mercurial/sshrepo.py Tue Nov 17 22:16:41 2009 +0100 +++ b/mercurial/sshrepo.py Wed Nov 18 15:20:08 2009 +0100 @@ -173,10 +173,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