Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/sshrepo.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 | 25e572394f5c |
comparison
equal
deleted
inserted
replaced
9874:c51494c53841 | 9878:7e7d56fe4833 |
---|---|
171 try: | 171 try: |
172 branchmap = {} | 172 branchmap = {} |
173 for branchpart in d.splitlines(): | 173 for branchpart in d.splitlines(): |
174 branchheads = branchpart.split(' ') | 174 branchheads = branchpart.split(' ') |
175 branchname = urllib.unquote(branchheads[0]) | 175 branchname = urllib.unquote(branchheads[0]) |
176 # Earlier servers (1.3.x) send branch names in (their) local | |
177 # charset. The best we can do is assume it's identical to our | |
178 # own local charset, in case it's not utf-8. | |
176 try: | 179 try: |
177 branchname.decode('utf-8', 'strict') | 180 branchname.decode('utf-8') |
178 except UnicodeDecodeError: | 181 except UnicodeDecodeError: |
179 branchname = encoding.tolocal(branchname) | 182 branchname = encoding.fromlocal(branchname) |
180 branchheads = [bin(x) for x in branchheads[1:]] | 183 branchheads = [bin(x) for x in branchheads[1:]] |
181 branchmap[branchname] = branchheads | 184 branchmap[branchname] = branchheads |
182 return branchmap | 185 return branchmap |
183 except: | 186 except: |
184 raise error.ResponseError(_("unexpected response:"), d) | 187 raise error.ResponseError(_("unexpected response:"), d) |