2335 return set([nullid]) |
2335 return set([nullid]) |
2336 return dag.externalizeall(result) |
2336 return dag.externalizeall(result) |
2337 |
2337 |
2338 |
2338 |
2339 _pushkeyescape = getattr(obsolete, '_pushkeyescape', None) |
2339 _pushkeyescape = getattr(obsolete, '_pushkeyescape', None) |
2340 if _pushkeyescape is None: |
|
2341 _maxpayload = 5300 |
|
2342 def _pushkeyescape(markers): |
|
2343 """encode markers into a dict suitable for pushkey exchange |
|
2344 |
|
2345 - binary data are base86 encoded |
|
2346 - splited in chunk less than 5300 bytes""" |
|
2347 parts = [] |
|
2348 currentlen = _maxpayload * 2 # ensure we create a new part |
|
2349 for marker in markers: |
|
2350 nextdata = obsolete._encodeonemarker(marker) |
|
2351 if (len(nextdata) + currentlen > _maxpayload): |
|
2352 currentpart = [] |
|
2353 currentlen = 0 |
|
2354 parts.append(currentpart) |
|
2355 currentpart.append(nextdata) |
|
2356 currentlen += len(nextdata) |
|
2357 keys = {} |
|
2358 for idx, part in enumerate(reversed(parts)): |
|
2359 data = ''.join([_pack('>B', 0)] + part) |
|
2360 keys['dump%i' % idx] = base85.b85encode(data) |
|
2361 return keys |
|
2362 |
|
2363 def _encodemarkersstream(fp, markers): |
2340 def _encodemarkersstream(fp, markers): |
2364 fp.write(_pack('>B', 0)) |
2341 fp.write(_pack('>B', 0)) |
2365 for mark in markers: |
2342 for mark in markers: |
2366 fp.write(obsolete._encodeonemarker(mark)) |
2343 fp.write(obsolete._encodeonemarker(mark)) |
2367 |
2344 |