diff mercurial/pure/parsers.py @ 48499:52034c42c09d

rank: add a "rank" value to the revlog-entry tuple The rank of a revision is the size of sub-graph it defines as a head. In other words, the rank of X is the size of `ancestors(X)` (X included). This is a property that can help various algorithm and we intend to store it in changelog-v2. We start with adding this new information to the "entry tuple", with a default value. We will start to compute and persist the rank later. Differential Revision: https://phab.mercurial-scm.org/D11936
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 14 Dec 2021 23:56:38 +0100
parents 2c6084f67a86
children c5d6c874766a
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Wed Dec 15 14:50:07 2021 +0100
+++ b/mercurial/pure/parsers.py	Tue Dec 14 23:56:38 2021 +0100
@@ -584,6 +584,7 @@
         0,
         revlog_constants.COMP_MODE_INLINE,
         revlog_constants.COMP_MODE_INLINE,
+        revlog_constants.RANK_UNKNOWN,
     )
 
     @util.propertycache
@@ -671,6 +672,7 @@
             0,
             revlog_constants.COMP_MODE_INLINE,
             revlog_constants.COMP_MODE_INLINE,
+            revlog_constants.RANK_UNKNOWN,
         )
         return r
 
@@ -853,7 +855,7 @@
         entry = data[:10]
         data_comp = data[10] & 3
         sidedata_comp = (data[10] & (3 << 2)) >> 2
-        return entry + (data_comp, sidedata_comp)
+        return entry + (data_comp, sidedata_comp, revlog_constants.RANK_UNKNOWN)
 
     def _pack_entry(self, rev, entry):
         data = entry[:10]
@@ -896,6 +898,7 @@
             items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
             (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
             & 3,
+            revlog_constants.RANK_UNKNOWN,
         )
 
     def _pack_entry(self, rev, entry):