Comments
Patch
@@ -350,18 +350,19 @@ def _encodeonemarker(marker):
# you have to take in account:
# - the version header
# - the base85 encoding
_maxpayload = 5300
-def listmarkers(repo):
- """List markers over pushkey"""
- if not repo.obsstore:
- return {}
+def _pushkeyescape(markers):
+ """encode markers into a dict suitable for pushkey exchange
+
+ - binary data are base86 encoded
+ - splited in chunk less than 5300 bytes"""
keys = {}
parts = []
currentlen = _maxpayload * 2 # ensure we create a new part
- for marker in repo.obsstore:
+ for marker in markers:
nextdata = _encodeonemarker(marker)
if (len(nextdata) + currentlen > _maxpayload):
currentpart = []
currentlen = 0
parts.append(currentpart)
@@ -370,10 +371,16 @@ def listmarkers(repo):
for idx, part in enumerate(reversed(parts)):
data = ''.join([_pack('>B', _fmversion)] + part)
keys['dump%i' % idx] = base85.b85encode(data)
return keys
+def listmarkers(repo):
+ """List markers over pushkey"""
+ if not repo.obsstore:
+ return {}
+ return _pushkeyescape(repo.obsstore)
+
def pushmarker(repo, key, old, new):
"""Push markers over pushkey"""
if not key.startswith('dump'):
repo.ui.warn(_('unknown key: %r') % key)
return 0