Show More
@@ -334,7 +334,7 b' def reposetup(ui, repo):' | |||
|
334 | 334 | rb = remote.listkeys('bookmarks') |
|
335 | 335 | for k in rb.keys(): |
|
336 | 336 | if k in self._bookmarks: |
|
337 | nr, nl = rb[k], self._bookmarks[k] | |
|
337 | nr, nl = rb[k], hex(self._bookmarks[k]) | |
|
338 | 338 | if nr in self: |
|
339 | 339 | cr = self[nr] |
|
340 | 340 | cl = self[nl] |
@@ -76,17 +76,20 b' class wirerepository(repo.repository):' | |||
|
76 | 76 | if not self.capable('pushkey'): |
|
77 | 77 | return False |
|
78 | 78 | d = self._call("pushkey", |
|
79 |
namespace=namespace, |
|
|
79 | namespace=encoding.fromlocal(namespace), | |
|
80 | key=encoding.fromlocal(key), | |
|
81 | old=encoding.fromlocal(old), | |
|
82 | new=encoding.fromlocal(new)) | |
|
80 | 83 | return bool(int(d)) |
|
81 | 84 | |
|
82 | 85 | def listkeys(self, namespace): |
|
83 | 86 | if not self.capable('pushkey'): |
|
84 | 87 | return {} |
|
85 | d = self._call("listkeys", namespace=namespace) | |
|
88 | d = self._call("listkeys", namespace=encoding.fromlocal(namespace)) | |
|
86 | 89 | r = {} |
|
87 | 90 | for l in d.splitlines(): |
|
88 | 91 | k, v = l.split('\t') |
|
89 |
r[k |
|
|
92 | r[encoding.tolocal(k)] = encoding.tolocal(v) | |
|
90 | 93 | return r |
|
91 | 94 | |
|
92 | 95 | def stream_out(self): |
@@ -206,9 +209,9 b' def hello(repo, proto):' | |||
|
206 | 209 | return "capabilities: %s\n" % (capabilities(repo, proto)) |
|
207 | 210 | |
|
208 | 211 | def listkeys(repo, proto, namespace): |
|
209 | d = pushkeymod.list(repo, namespace).items() | |
|
210 |
t = '\n'.join(['%s\t%s' % (k |
|
|
211 |
|
|
|
212 | d = pushkeymod.list(repo, encoding.tolocal(namespace)).items() | |
|
213 | t = '\n'.join(['%s\t%s' % (encoding.fromlocal(k), encoding.fromlocal(v)) | |
|
214 | for k, v in d]) | |
|
212 | 215 | return t |
|
213 | 216 | |
|
214 | 217 | def lookup(repo, proto, key): |
@@ -221,7 +224,21 b' def lookup(repo, proto, key):' | |||
|
221 | 224 | return "%s %s\n" % (success, r) |
|
222 | 225 | |
|
223 | 226 | def pushkey(repo, proto, namespace, key, old, new): |
|
224 | r = pushkeymod.push(repo, namespace, key, old, new) | |
|
227 | # compatibility with pre-1.8 clients which were accidentally | |
|
228 | # sending raw binary nodes rather than utf-8-encoded hex | |
|
229 | if len(new) == 20 and new.encode('string-escape') != new: | |
|
230 | # looks like it could be a binary node | |
|
231 | try: | |
|
232 | u = new.decode('utf-8') | |
|
233 | new = encoding.tolocal(new) # but cleanly decodes as UTF-8 | |
|
234 | except UnicodeDecodeError: | |
|
235 | pass # binary, leave unmodified | |
|
236 | else: | |
|
237 | new = encoding.tolocal(new) # normal path | |
|
238 | ||
|
239 | r = pushkeymod.push(repo, | |
|
240 | encoding.tolocal(namespace), encoding.tolocal(key), | |
|
241 | encoding.tolocal(old), new) | |
|
225 | 242 | return '%s\n' % int(r) |
|
226 | 243 | |
|
227 | 244 | def _allowstream(ui): |
@@ -214,7 +214,7 b' test pushkeys and bookmarks' | |||
|
214 | 214 | $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks |
|
215 | 215 | foo 1160648e36cec0054048a7edc4110c6f84fde594 |
|
216 | 216 | $ hg book -f foo |
|
217 | $ hg push | |
|
217 | $ hg push --traceback | |
|
218 | 218 | pushing to ssh://user@dummy/remote |
|
219 | 219 | searching for changes |
|
220 | 220 | no changes found |
General Comments 0
You need to be logged in to leave comments.
Login now