obsstore: move header encoding to a separate function
This patch moves encodeheader from encodemarkers. So markers and header
could be encoded separately.
--- a/mercurial/obsolete.py Sun Jun 04 08:49:15 2017 -0700
+++ b/mercurial/obsolete.py Sun Jun 04 00:38:11 2017 -0700
@@ -452,12 +452,15 @@
raise error.UnknownVersion(msg, version=diskversion)
return diskversion, formats[diskversion][0](data, off)
+def encodeheader(version=_fm0version):
+ return _pack('>B', version)
+
def encodemarkers(markers, addheader=False, version=_fm0version):
# Kept separate from flushmarkers(), it will be reused for
# markers exchange.
encodeone = formats[version][1]
if addheader:
- yield _pack('>B', version)
+ yield encodeheader(version)
for marker in markers:
yield encodeone(marker)