diff mercurial/revlogutils/constants.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 d5137c00ab17
children c5d6c874766a
line wrap: on
line diff
--- a/mercurial/revlogutils/constants.py	Wed Dec 15 14:50:07 2021 +0100
+++ b/mercurial/revlogutils/constants.py	Tue Dec 14 23:56:38 2021 +0100
@@ -103,6 +103,17 @@
 #            (see "COMP_MODE_*" constants for details)
 ENTRY_SIDEDATA_COMPRESSION_MODE = 11
 
+#    [12] Revision rank:
+#            The number of revision under this one.
+#
+#            Formally this is defined as : rank(X) = len(ancestors(X) + X)
+#
+#            If rank == -1; then we do not have this information available.
+#            Only `null` has a rank of 0.
+ENTRY_RANK = 12
+
+RANK_UNKNOWN = -1
+
 ### main revlog header
 
 # We cannot rely on  Struct.format is inconsistent for python <=3.6 versus above