mercurial/sshrepo.py
changeset 9861 0262bb59016f
parent 9467 4c041f1ee1b4
child 9878 7e7d56fe4833
equal deleted inserted replaced
9860:9c43089b372a 9861:0262bb59016f
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2, incorporated herein by reference.
     6 # GNU General Public License version 2, incorporated herein by reference.
     7 
     7 
     8 from node import bin, hex
     8 from node import bin, hex
     9 from i18n import _
     9 from i18n import _
    10 import repo, util, error
    10 import repo, util, error, encoding
    11 import re, urllib
    11 import re, urllib
    12 
    12 
    13 class remotelock(object):
    13 class remotelock(object):
    14     def __init__(self, repo):
    14     def __init__(self, repo):
    15         self.repo = repo
    15         self.repo = repo
   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                 try:
       
   177                     branchname.decode('utf-8', 'strict')
       
   178                 except UnicodeDecodeError:
       
   179                     branchname = encoding.tolocal(branchname)
   176                 branchheads = [bin(x) for x in branchheads[1:]]
   180                 branchheads = [bin(x) for x in branchheads[1:]]
   177                 branchmap[branchname] = branchheads
   181                 branchmap[branchname] = branchheads
   178             return branchmap
   182             return branchmap
   179         except:
   183         except:
   180             raise error.ResponseError(_("unexpected response:"), d)
   184             raise error.ResponseError(_("unexpected response:"), d)