diff mercurial/pure/parsers.py @ 47246:6b1eae313b2f

revlogv2: store version information in the docket only Having it duplicated in the index was both useless and a risk of discrepancy. Differential Revision: https://phab.mercurial-scm.org/D10625
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:34:21 +0200
parents 47ffc754989a
children 3b04cf976c67
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Mon May 03 12:34:11 2021 +0200
+++ b/mercurial/pure/parsers.py	Mon May 03 12:34:21 2021 +0200
@@ -15,6 +15,7 @@
     sha1nodeconstants,
 )
 from .. import (
+    error,
     pycompat,
     util,
 )
@@ -311,10 +312,14 @@
         """return the raw binary string representing a revision"""
         entry = self[rev]
         p = revlog_constants.INDEX_ENTRY_V2.pack(*entry)
-        if rev == 0:
-            p = p[revlog_constants.INDEX_HEADER.size :]
         return p
 
+    def pack_header(self, header):
+        """pack header information as binary"""
+        msg = 'version header should go in the docket, not the index: %d'
+        msg %= header
+        raise error.ProgrammingError(msg)
+
 
 class IndexObject2(Index2Mixin, IndexObject):
     pass