mercurial/sshrepo.py
branchstable
changeset 9878 7e7d56fe4833
parent 9861 0262bb59016f
child 10263 25e572394f5c
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)