##// END OF EJS Templates
support encoding fallback in branchmap to maintain compatibility with 1.3.x
Henrik Stuart -
r9861:0262bb59 default
parent child Browse files
Show More
@@ -11,6 +11,7 b' from i18n import _'
11 import repo, changegroup, statichttprepo, error, url, util
11 import repo, changegroup, statichttprepo, error, url, util
12 import os, urllib, urllib2, urlparse, zlib, httplib
12 import os, urllib, urllib2, urlparse, zlib, httplib
13 import errno, socket
13 import errno, socket
14 import encoding
14
15
15 def zgenerator(f):
16 def zgenerator(f):
16 zd = zlib.decompressobj()
17 zd = zlib.decompressobj()
@@ -153,6 +154,10 b' class httprepository(repo.repository):'
153 for branchpart in d.splitlines():
154 for branchpart in d.splitlines():
154 branchheads = branchpart.split(' ')
155 branchheads = branchpart.split(' ')
155 branchname = urllib.unquote(branchheads[0])
156 branchname = urllib.unquote(branchheads[0])
157 try:
158 branchname.decode('utf-8', 'strict')
159 except UnicodeDecodeError:
160 branchname = encoding.tolocal(branchname)
156 branchheads = [bin(x) for x in branchheads[1:]]
161 branchheads = [bin(x) for x in branchheads[1:]]
157 branchmap[branchname] = branchheads
162 branchmap[branchname] = branchheads
158 return branchmap
163 return branchmap
@@ -7,7 +7,7 b''
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):
@@ -173,6 +173,10 b' class sshrepository(repo.repository):'
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
General Comments 0
You need to be logged in to leave comments. Login now