changeset 1091:236a8e81551e

compat: use in-core encodemarkers Now exist in core witha slightly different format.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 Aug 2014 18:16:10 +0200
parents 4a6479395a9d
children 85c699c4fba4
files hgext/evolve.py hgext/simple4server.py
diffstat 2 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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