diff mercurial/revlogutils/constants.py @ 46856:34e1fa4b548a

revlog: move the details of revlog "v0" 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. Differential Revision: https://phab.mercurial-scm.org/D10303
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Apr 2021 12:20:52 +0200
parents aba724bf550e
children cc65cea90edb
line wrap: on
line diff
--- a/mercurial/revlogutils/constants.py	Mon Apr 05 12:20:40 2021 +0200
+++ b/mercurial/revlogutils/constants.py	Mon Apr 05 12:20:52 2021 +0200
@@ -9,6 +9,8 @@
 
 from __future__ import absolute_import
 
+import struct
+
 from ..interfaces import repository
 
 ### main revlog header
@@ -32,6 +34,16 @@
 
 ### individual entry
 
+## index v0:
+#  4 bytes: offset
+#  4 bytes: compressed length
+#  4 bytes: base rev
+#  4 bytes: link rev
+# 20 bytes: parent 1 nodeid
+# 20 bytes: parent 2 nodeid
+# 20 bytes: nodeid
+INDEX_ENTRY_V0 = struct.Struct(b">4l20s20s20s")
+
 # revlog index flags
 
 # For historical reasons, revlog's internal flags were exposed via the