mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
branchmap: fix defective fallback fix a3d9c67908ca
The fix applied as a3d9c67908ca doesn't work and is essentially a no-op. This fix also adds a comment about the nature of the problem, and a test.
This commit is contained in:
parent
d5e8634932
commit
a2d25fc09b
@ -154,10 +154,13 @@ class httprepository(repo.repository):
|
||||
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
|
||||
|
@ -173,10 +173,13 @@ class sshrepository(repo.repository):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user