changeset 32712: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 c401ad7fdf86
files mercurial/obsolete.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)