changeset 3687:50f1968724f0

obscache: drop compat layer for obsmarkers reading We cna now use a version with the argument we needs.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 19 Apr 2018 14:00:12 +0200
parents 36714eeb51d1
children bda024010aed
files hgext3rd/evolve/obscache.py
diffstat 1 files changed, 1 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- 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):