compat: use in-core encodemarkers
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 27 Aug 2014 18:16:10 +0200
changeset 1091 236a8e81551e
parent 1090 4a6479395a9d
child 1092 85c699c4fba4
compat: use in-core encodemarkers Now exist in core witha slightly different format.
hgext/evolve.py
hgext/simple4server.py
--- a/hgext/evolve.py	Wed Aug 27 18:15:39 2014 +0200
+++ b/hgext/evolve.py	Wed Aug 27 18:16:10 2014 +0200
@@ -2337,10 +2337,6 @@
 
 
 _pushkeyescape = getattr(obsolete, '_pushkeyescape', None)
-def _encodemarkersstream(fp, markers):
-    fp.write(_pack('>B', 0))
-    for mark in markers:
-        fp.write(obsolete._encodeonemarker(mark))
 
 class pushobsmarkerStringIO(StringIO):
     """hacky string io for progress"""
@@ -2381,7 +2377,8 @@
             obsexcmsg(repo.ui, "no marker to push\n")
         elif remote.capable('_evoext_pushobsmarkers_0'):
             obsdata = pushobsmarkerStringIO()
-            _encodemarkersstream(obsdata, markers)
+            for chunk in obsolete.encodemarkers(markers, True):
+                obsdata.write(chunk)
             obsdata.seek(0)
             obsdata.ui = repo.ui
             obsexcmsg(repo.ui, "pushing %i obsolescence markers (%i bytes)\n"
@@ -2578,7 +2575,8 @@
     nodes = [c.node() for c in repo.set(revset, *args)]
     markers = repo.obsstore.relevantmarkers(nodes)
     obsdata = StringIO()
-    _encodemarkersstream(obsdata, markers)
+    for chunk in obsolete.encodemarkers(markers, True):
+        obsdata.write(chunk)
     obsdata.seek(0)
     return obsdata
 
--- a/hgext/simple4server.py	Wed Aug 27 18:15:39 2014 +0200
+++ b/hgext/simple4server.py	Wed Aug 27 18:16:10 2014 +0200
@@ -75,15 +75,6 @@
     repo.hook('evolve_pushobsmarkers')
     return wireproto.pushres(0)
 
-# from mercurial.obsolete: 19e9478c1a22
-def _encodemarkersstream(fp, markers):
-    """write a binary version of a set of markers
-
-    Includes the initial version number"""
-    fp.write(_pack('>B', 0))
-    for mark in markers:
-        fp.write(obsolete._encodeonemarker(mark))
-
 # from evolve extension: 1a23c7c52a43
 def _getobsmarkersstream(repo, heads=None, common=None):
     """Get a binary stream for all markers relevant to `::<heads> - ::<common>`
@@ -104,7 +95,8 @@
     nodes = [c.node() for c in repo.set(revset, *args)]
     markers = repo.obsstore.relevantmarkers(nodes)
     obsdata = StringIO()
-    _encodemarkersstream(obsdata, markers)
+    for chunk in obsolete.encodemarkers(markers, True):
+        obsdata.write(chunk)
     obsdata.seek(0)
     return obsdata