Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
9874:c51494c53841 | 9878:7e7d56fe4833 |
---|---|
152 try: | 152 try: |
153 branchmap = {} | 153 branchmap = {} |
154 for branchpart in d.splitlines(): | 154 for branchpart in d.splitlines(): |
155 branchheads = branchpart.split(' ') | 155 branchheads = branchpart.split(' ') |
156 branchname = urllib.unquote(branchheads[0]) | 156 branchname = urllib.unquote(branchheads[0]) |
157 # Earlier servers (1.3.x) send branch names in (their) local | |
158 # charset. The best we can do is assume it's identical to our | |
159 # own local charset, in case it's not utf-8. | |
157 try: | 160 try: |
158 branchname.decode('utf-8', 'strict') | 161 branchname.decode('utf-8') |
159 except UnicodeDecodeError: | 162 except UnicodeDecodeError: |
160 branchname = encoding.tolocal(branchname) | 163 branchname = encoding.fromlocal(branchname) |
161 branchheads = [bin(x) for x in branchheads[1:]] | 164 branchheads = [bin(x) for x in branchheads[1:]] |
162 branchmap[branchname] = branchheads | 165 branchmap[branchname] = branchheads |
163 return branchmap | 166 return branchmap |
164 except: | 167 except: |
165 raise error.ResponseError(_("unexpected response:"), d) | 168 raise error.ResponseError(_("unexpected response:"), d) |