Mercurial > hg
comparison mercurial/obsolete.py @ 32692:9576974a3b6d
obsstore: move header encoding to a separate function
This patch moves encodeheader from encodemarkers. So markers and header
could be encoded separately.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sun, 04 Jun 2017 00:38:11 -0700 |
parents | 5d8dd6c90af9 |
children | c8177792fef6 |
comparison
equal
deleted
inserted
replaced
32691:5d8dd6c90af9 | 32692:9576974a3b6d |
---|---|
450 if diskversion not in formats: | 450 if diskversion not in formats: |
451 msg = _('parsing obsolete marker: unknown version %r') % diskversion | 451 msg = _('parsing obsolete marker: unknown version %r') % diskversion |
452 raise error.UnknownVersion(msg, version=diskversion) | 452 raise error.UnknownVersion(msg, version=diskversion) |
453 return diskversion, formats[diskversion][0](data, off) | 453 return diskversion, formats[diskversion][0](data, off) |
454 | 454 |
455 def encodeheader(version=_fm0version): | |
456 return _pack('>B', version) | |
457 | |
455 def encodemarkers(markers, addheader=False, version=_fm0version): | 458 def encodemarkers(markers, addheader=False, version=_fm0version): |
456 # Kept separate from flushmarkers(), it will be reused for | 459 # Kept separate from flushmarkers(), it will be reused for |
457 # markers exchange. | 460 # markers exchange. |
458 encodeone = formats[version][1] | 461 encodeone = formats[version][1] |
459 if addheader: | 462 if addheader: |
460 yield _pack('>B', version) | 463 yield encodeheader(version) |
461 for marker in markers: | 464 for marker in markers: |
462 yield encodeone(marker) | 465 yield encodeone(marker) |
463 | 466 |
464 | 467 |
465 class marker(object): | 468 class marker(object): |