Show More
@@ -334,7 +334,7 b' def reposetup(ui, repo):' | |||||
334 | rb = remote.listkeys('bookmarks') |
|
334 | rb = remote.listkeys('bookmarks') | |
335 | for k in rb.keys(): |
|
335 | for k in rb.keys(): | |
336 | if k in self._bookmarks: |
|
336 | if k in self._bookmarks: | |
337 | nr, nl = rb[k], self._bookmarks[k] |
|
337 | nr, nl = rb[k], hex(self._bookmarks[k]) | |
338 | if nr in self: |
|
338 | if nr in self: | |
339 | cr = self[nr] |
|
339 | cr = self[nr] | |
340 | cl = self[nl] |
|
340 | cl = self[nl] |
@@ -76,17 +76,20 b' class wirerepository(repo.repository):' | |||||
76 | if not self.capable('pushkey'): |
|
76 | if not self.capable('pushkey'): | |
77 | return False |
|
77 | return False | |
78 | d = self._call("pushkey", |
|
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 | return bool(int(d)) |
|
83 | return bool(int(d)) | |
81 |
|
84 | |||
82 | def listkeys(self, namespace): |
|
85 | def listkeys(self, namespace): | |
83 | if not self.capable('pushkey'): |
|
86 | if not self.capable('pushkey'): | |
84 | return {} |
|
87 | return {} | |
85 | d = self._call("listkeys", namespace=namespace) |
|
88 | d = self._call("listkeys", namespace=encoding.fromlocal(namespace)) | |
86 | r = {} |
|
89 | r = {} | |
87 | for l in d.splitlines(): |
|
90 | for l in d.splitlines(): | |
88 | k, v = l.split('\t') |
|
91 | k, v = l.split('\t') | |
89 |
r[k |
|
92 | r[encoding.tolocal(k)] = encoding.tolocal(v) | |
90 | return r |
|
93 | return r | |
91 |
|
94 | |||
92 | def stream_out(self): |
|
95 | def stream_out(self): | |
@@ -206,9 +209,9 b' def hello(repo, proto):' | |||||
206 | return "capabilities: %s\n" % (capabilities(repo, proto)) |
|
209 | return "capabilities: %s\n" % (capabilities(repo, proto)) | |
207 |
|
210 | |||
208 | def listkeys(repo, proto, namespace): |
|
211 | def listkeys(repo, proto, namespace): | |
209 | d = pushkeymod.list(repo, namespace).items() |
|
212 | d = pushkeymod.list(repo, encoding.tolocal(namespace)).items() | |
210 |
t = '\n'.join(['%s\t%s' % (k |
|
213 | t = '\n'.join(['%s\t%s' % (encoding.fromlocal(k), encoding.fromlocal(v)) | |
211 |
|
|
214 | for k, v in d]) | |
212 | return t |
|
215 | return t | |
213 |
|
216 | |||
214 | def lookup(repo, proto, key): |
|
217 | def lookup(repo, proto, key): | |
@@ -221,7 +224,21 b' def lookup(repo, proto, key):' | |||||
221 | return "%s %s\n" % (success, r) |
|
224 | return "%s %s\n" % (success, r) | |
222 |
|
225 | |||
223 | def pushkey(repo, proto, namespace, key, old, new): |
|
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 | return '%s\n' % int(r) |
|
242 | return '%s\n' % int(r) | |
226 |
|
243 | |||
227 | def _allowstream(ui): |
|
244 | def _allowstream(ui): |
@@ -214,7 +214,7 b' test pushkeys and bookmarks' | |||||
214 | $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks |
|
214 | $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks | |
215 | foo 1160648e36cec0054048a7edc4110c6f84fde594 |
|
215 | foo 1160648e36cec0054048a7edc4110c6f84fde594 | |
216 | $ hg book -f foo |
|
216 | $ hg book -f foo | |
217 | $ hg push |
|
217 | $ hg push --traceback | |
218 | pushing to ssh://user@dummy/remote |
|
218 | pushing to ssh://user@dummy/remote | |
219 | searching for changes |
|
219 | searching for changes | |
220 | no changes found |
|
220 | no changes found |
General Comments 0
You need to be logged in to leave comments.
Login now