##// END OF EJS Templates
base85: proxy through util module...
Yuya Nishihara -
r32200:4462a981 default
parent child Browse files
Show More
@@ -16,7 +16,6 b' from .node import ('
16 nullid,
16 nullid,
17 )
17 )
18 from . import (
18 from . import (
19 base85,
20 bookmarks as bookmod,
19 bookmarks as bookmod,
21 bundle2,
20 bundle2,
22 changegroup,
21 changegroup,
@@ -1509,7 +1508,7 b' def _pullobsolete(pullop):'
1509 markers = []
1508 markers = []
1510 for key in sorted(remoteobs, reverse=True):
1509 for key in sorted(remoteobs, reverse=True):
1511 if key.startswith('dump'):
1510 if key.startswith('dump'):
1512 data = base85.b85decode(remoteobs[key])
1511 data = util.b85decode(remoteobs[key])
1513 version, newmarks = obsolete._readmarkers(data)
1512 version, newmarks = obsolete._readmarkers(data)
1514 markers += newmarks
1513 markers += newmarks
1515 if markers:
1514 if markers:
@@ -13,7 +13,6 b' import zlib'
13
13
14 from .i18n import _
14 from .i18n import _
15 from . import (
15 from . import (
16 base85,
17 bdiff,
16 bdiff,
18 error,
17 error,
19 mpatch,
18 mpatch,
@@ -430,7 +429,7 b' def b85diff(to, tn):'
430 l = chr(ord('A') + l - 1)
429 l = chr(ord('A') + l - 1)
431 else:
430 else:
432 l = chr(l - 26 + ord('a') - 1)
431 l = chr(l - 26 + ord('a') - 1)
433 return '%c%s\n' % (l, base85.b85encode(line, True))
432 return '%c%s\n' % (l, util.b85encode(line, True))
434
433
435 def chunk(text, csize=52):
434 def chunk(text, csize=52):
436 l = len(text)
435 l = len(text)
@@ -74,7 +74,6 b' import struct'
74
74
75 from .i18n import _
75 from .i18n import _
76 from . import (
76 from . import (
77 base85,
78 error,
77 error,
79 node,
78 node,
80 parsers,
79 parsers,
@@ -744,7 +743,7 b' def _pushkeyescape(markers):'
744 currentlen += len(nextdata)
743 currentlen += len(nextdata)
745 for idx, part in enumerate(reversed(parts)):
744 for idx, part in enumerate(reversed(parts)):
746 data = ''.join([_pack('>B', _fm0version)] + part)
745 data = ''.join([_pack('>B', _fm0version)] + part)
747 keys['dump%i' % idx] = base85.b85encode(data)
746 keys['dump%i' % idx] = util.b85encode(data)
748 return keys
747 return keys
749
748
750 def listmarkers(repo):
749 def listmarkers(repo):
@@ -761,7 +760,7 b' def pushmarker(repo, key, old, new):'
761 if old:
760 if old:
762 repo.ui.warn(_('unexpected old value for %r') % key)
761 repo.ui.warn(_('unexpected old value for %r') % key)
763 return 0
762 return 0
764 data = base85.b85decode(new)
763 data = util.b85decode(new)
765 lock = repo.lock()
764 lock = repo.lock()
766 try:
765 try:
767 tr = repo.transaction('pushkey: obsolete markers')
766 tr = repo.transaction('pushkey: obsolete markers')
@@ -26,7 +26,6 b' from .node import ('
26 short,
26 short,
27 )
27 )
28 from . import (
28 from . import (
29 base85,
30 copies,
29 copies,
31 diffhelpers,
30 diffhelpers,
32 encoding,
31 encoding,
@@ -1430,7 +1429,7 b' class binhunk(object):'
1430 else:
1429 else:
1431 l = ord(l) - ord('a') + 27
1430 l = ord(l) - ord('a') + 27
1432 try:
1431 try:
1433 dec.append(base85.b85decode(line[1:])[:l])
1432 dec.append(util.b85decode(line[1:])[:l])
1434 except ValueError as e:
1433 except ValueError as e:
1435 raise PatchError(_('could not decode "%s" binary patch: %s')
1434 raise PatchError(_('could not decode "%s" binary patch: %s')
1436 % (self._fname, str(e)))
1435 % (self._fname, str(e)))
@@ -52,7 +52,6 b' from __future__ import absolute_import'
52
52
53 from .node import nullrev
53 from .node import nullrev
54 from . import (
54 from . import (
55 base85,
56 util,
55 util,
57 )
56 )
58
57
@@ -166,13 +165,13 b' def ctxpvec(ctx):'
166 else:
165 else:
167 pvc[n] = _mergevec(pvc[p1], pvc[p2], node)
166 pvc[n] = _mergevec(pvc[p1], pvc[p2], node)
168 bs = _join(*pvc[ctx.rev()])
167 bs = _join(*pvc[ctx.rev()])
169 return pvec(base85.b85encode(bs))
168 return pvec(util.b85encode(bs))
170
169
171 class pvec(object):
170 class pvec(object):
172 def __init__(self, hashorctx):
171 def __init__(self, hashorctx):
173 if isinstance(hashorctx, str):
172 if isinstance(hashorctx, str):
174 self._bs = hashorctx
173 self._bs = hashorctx
175 self._depth, self._vec = _split(base85.b85decode(hashorctx))
174 self._depth, self._vec = _split(util.b85decode(hashorctx))
176 else:
175 else:
177 self._vec = ctxpvec(hashorctx)
176 self._vec = ctxpvec(hashorctx)
178
177
@@ -42,6 +42,7 b' import warnings'
42 import zlib
42 import zlib
43
43
44 from . import (
44 from . import (
45 base85,
45 encoding,
46 encoding,
46 error,
47 error,
47 i18n,
48 i18n,
@@ -50,6 +51,9 b' from . import ('
50 pycompat,
51 pycompat,
51 )
52 )
52
53
54 b85decode = base85.b85decode
55 b85encode = base85.b85encode
56
53 cookielib = pycompat.cookielib
57 cookielib = pycompat.cookielib
54 empty = pycompat.empty
58 empty = pycompat.empty
55 httplib = pycompat.httplib
59 httplib = pycompat.httplib
General Comments 0
You need to be logged in to leave comments. Login now