equal
deleted
inserted
replaced
16 |
16 |
17 |
17 |
18 def _nslist(repo): |
18 def _nslist(repo): |
19 n = {} |
19 n = {} |
20 for k in _namespaces: |
20 for k in _namespaces: |
21 n[k] = "" |
21 n[k] = b"" |
22 if not obsolete.isenabled(repo, obsolete.exchangeopt): |
22 if not obsolete.isenabled(repo, obsolete.exchangeopt): |
23 n.pop('obsolete') |
23 n.pop(b'obsolete') |
24 return n |
24 return n |
25 |
25 |
26 |
26 |
27 _namespaces = { |
27 _namespaces = { |
28 "namespaces": (lambda *x: False, _nslist), |
28 b"namespaces": (lambda *x: False, _nslist), |
29 "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks), |
29 b"bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks), |
30 "phases": (phases.pushphase, phases.listphases), |
30 b"phases": (phases.pushphase, phases.listphases), |
31 "obsolete": (obsolete.pushmarker, obsolete.listmarkers), |
31 b"obsolete": (obsolete.pushmarker, obsolete.listmarkers), |
32 } |
32 } |
33 |
33 |
34 |
34 |
35 def register(namespace, pushkey, listkeys): |
35 def register(namespace, pushkey, listkeys): |
36 _namespaces[namespace] = (pushkey, listkeys) |
36 _namespaces[namespace] = (pushkey, listkeys) |
57 decode = encoding.tolocal |
57 decode = encoding.tolocal |
58 |
58 |
59 |
59 |
60 def encodekeys(keys): |
60 def encodekeys(keys): |
61 """encode the content of a pushkey namespace for exchange over the wire""" |
61 """encode the content of a pushkey namespace for exchange over the wire""" |
62 return '\n'.join(['%s\t%s' % (encode(k), encode(v)) for k, v in keys]) |
62 return b'\n'.join([b'%s\t%s' % (encode(k), encode(v)) for k, v in keys]) |
63 |
63 |
64 |
64 |
65 def decodekeys(data): |
65 def decodekeys(data): |
66 """decode the content of a pushkey namespace from exchange over the wire""" |
66 """decode the content of a pushkey namespace from exchange over the wire""" |
67 result = {} |
67 result = {} |
68 for l in data.splitlines(): |
68 for l in data.splitlines(): |
69 k, v = l.split('\t') |
69 k, v = l.split(b'\t') |
70 result[decode(k)] = decode(v) |
70 result[decode(k)] = decode(v) |
71 return result |
71 return result |