diff mercurial/revlog.py @ 46858:85e3a630cad9

revlog: move the details of revlog "v2" index inside revlog.utils.constants the revlog module is quite large and this kind of format information would handy for other module. So let us start to gather this information about the format in a more appropriate place. We update various reference to this information to use the new "source of truth" in the process. Differential Revision: https://phab.mercurial-scm.org/D10305
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Apr 2021 12:21:12 +0200
parents cc65cea90edb
children c6e23fb4bfb4
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon Apr 05 12:21:01 2021 +0200
+++ b/mercurial/revlog.py	Mon Apr 05 12:21:12 2021 +0200
@@ -43,6 +43,7 @@
     FLAG_INLINE_DATA,
     INDEX_ENTRY_V0,
     INDEX_ENTRY_V1,
+    INDEX_ENTRY_V2,
     REVLOGV0,
     REVLOGV1,
     REVLOGV1_FLAGS,
@@ -87,7 +88,6 @@
     storageutil,
     stringutil,
 )
-from .pure import parsers as pureparsers
 
 # blanked usage of all the name to prevent pyflakes constraints
 # We need these name available in the module for extensions.
@@ -352,20 +352,16 @@
         return p
 
 
-indexformatv2 = struct.Struct(pureparsers.Index2Mixin.index_format)
-indexformatv2_pack = indexformatv2.pack
-
-
 class revlogv2io(object):
     def __init__(self):
-        self.size = indexformatv2.size
+        self.size = INDEX_ENTRY_V2.size
 
     def parseindex(self, data, inline):
         index, cache = parsers.parse_index2(data, inline, revlogv2=True)
         return index, cache
 
     def packentry(self, entry, node, version, rev):
-        p = indexformatv2_pack(*entry)
+        p = INDEX_ENTRY_V2.pack(*entry)
         if rev == 0:
             p = versionformat_pack(version) + p[4:]
         return p