Mercurial > hg
comparison mercurial/obsolete.py @ 22329:ed37aa74d208
obsolete: rename _encodeonemarker to _fm0encodeonemarkers
This function encodes markers in version 0 of the format.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 25 Aug 2014 16:43:23 +0200 |
parents | fba8c1a4ce21 |
children | e74f8a65252d |
comparison
equal
deleted
inserted
replaced
22328:fba8c1a4ce21 | 22329:ed37aa74d208 |
---|---|
425 # Kept separate from flushmarkers(), it will be reused for | 425 # Kept separate from flushmarkers(), it will be reused for |
426 # markers exchange. | 426 # markers exchange. |
427 if addheader: | 427 if addheader: |
428 yield _pack('>B', _fm0version) | 428 yield _pack('>B', _fm0version) |
429 for marker in markers: | 429 for marker in markers: |
430 yield _encodeonemarker(marker) | 430 yield _fm0encodeonemarker(marker) |
431 | 431 |
432 | 432 |
433 def _encodeonemarker(marker): | 433 def _fm0encodeonemarker(marker): |
434 pre, sucs, flags, metadata, date, parents = marker | 434 pre, sucs, flags, metadata, date, parents = marker |
435 metadata = decodemeta(metadata) | 435 metadata = decodemeta(metadata) |
436 metadata['date'] = '%d %i' % date | 436 metadata['date'] = '%d %i' % date |
437 if parents is not None: | 437 if parents is not None: |
438 if not parents: | 438 if not parents: |
460 - split in chunks smaller than 5300 bytes""" | 460 - split in chunks smaller than 5300 bytes""" |
461 keys = {} | 461 keys = {} |
462 parts = [] | 462 parts = [] |
463 currentlen = _maxpayload * 2 # ensure we create a new part | 463 currentlen = _maxpayload * 2 # ensure we create a new part |
464 for marker in markers: | 464 for marker in markers: |
465 nextdata = _encodeonemarker(marker) | 465 nextdata = _fm0encodeonemarker(marker) |
466 if (len(nextdata) + currentlen > _maxpayload): | 466 if (len(nextdata) + currentlen > _maxpayload): |
467 currentpart = [] | 467 currentpart = [] |
468 currentlen = 0 | 468 currentlen = 0 |
469 parts.append(currentpart) | 469 parts.append(currentpart) |
470 currentpart.append(nextdata) | 470 currentpart.append(nextdata) |