obscache: drop compat layer for obsmarkers reading
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 19 Apr 2018 14:00:12 +0200
changeset 3687 50f1968724f0
parent 3686 36714eeb51d1
child 3688 bda024010aed
obscache: drop compat layer for obsmarkers reading We cna now use a version with the argument we needs.
hgext3rd/evolve/obscache.py
--- a/hgext3rd/evolve/obscache.py	Thu Apr 19 13:40:57 2018 +0200
+++ b/hgext3rd/evolve/obscache.py	Thu Apr 19 14:00:12 2018 +0200
@@ -13,7 +13,6 @@
 import weakref
 
 from mercurial import (
-    error,
     localrepo,
     obsolete,
     phases,
@@ -21,8 +20,6 @@
     util,
 )
 
-from mercurial.i18n import _
-
 from . import (
     compat,
     exthelper,
@@ -84,30 +81,6 @@
 
     return obsstore
 
-if obsolete._fm0readmarkers.__code__.co_argcount > 2:
-    # hg-4.3+ has the "offset" parameter, and _fm?readmarkers also have an
-    # extra "stop" parameter
-    # Note that _readmarkers is wrapped by @util.nogc, so its co_argcount is
-    # misleadingly 0. So we check _fm0readmarkers instead, which increased its
-    # argument count in the same changeset (5d3ba439).
-    _readmarkers = obsolete._readmarkers
-else:
-    # XXX copied as is from Mercurial 4.2 and added the "offset" parameters
-    @util.nogc
-    def _readmarkers(data, offset=None):
-        """Read and enumerate markers from raw data"""
-        off = 0
-        diskversion = struct.unpack('>B', data[off:off + 1])[0]
-        if offset is None:
-            off += 1
-        else:
-            assert 1 <= offset
-            off = offset
-        if diskversion not in obsolete.formats:
-            raise error.Abort(_('parsing obsolete marker: unknown version %r')
-                              % diskversion)
-        return diskversion, obsolete.formats[diskversion][0](data, off)
-
 def markersfrom(obsstore, byteoffset, firstmarker):
     if not firstmarker:
         return list(obsstore)
@@ -116,7 +89,7 @@
         return obsstore._all[firstmarker:]
     else:
         obsdata = obsstore.svfs.tryread('obsstore')
-        return _readmarkers(obsdata, byteoffset)[1]
+        return obsolete._readmarkers(obsdata, byteoffset)[1]
 
 
 class dualsourcecache(object):