diff mercurial/pure/parsers.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 1dc86c2a43ce
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Mon Apr 05 12:21:01 2021 +0200
+++ b/mercurial/pure/parsers.py	Mon Apr 05 12:21:12 2021 +0200
@@ -243,21 +243,8 @@
 
 
 class Index2Mixin(object):
-    #  6 bytes: offset
-    #  2 bytes: flags
-    #  4 bytes: compressed length
-    #  4 bytes: uncompressed length
-    #  4 bytes: base rev
-    #  4 bytes: link rev
-    #  4 bytes: parent 1 rev
-    #  4 bytes: parent 2 rev
-    # 32 bytes: nodeid
-    #  8 bytes: sidedata offset
-    #  4 bytes: sidedata compressed length
-    #  20 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
-    index_format = b">Qiiiiii20s12xQi20x"
-    index_size = struct.calcsize(index_format)
-    assert index_size == 96, index_size
+    index_format = revlog_constants.INDEX_ENTRY_V2.format
+    index_size = revlog_constants.INDEX_ENTRY_V2.size
     null_item = (0, 0, 0, -1, -1, -1, -1, nullid, 0, 0)
 
     def replace_sidedata_info(self, i, sidedata_offset, sidedata_length):