D12208: revlog: return 0 for the fast_rank of nullrev
pacien (Pacien)
phabricator at mercurial-scm.org
Mon Feb 21 17:13:38 UTC 2022
pacien created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
By convention, the rank of the null revision is 0. This particular revision is
never "physically" stored in the changelog, so it is a special case.
For consistency, the value `None` is still being returned for revlogs which do
not store the fast_rank property for any revision.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12208
AFFECTED FILES
mercurial/revlog.py
CHANGE DETAILS
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -869,8 +869,10 @@
the revlog which do not persist the rank.
"""
rank = self.index[rev][ENTRY_RANK]
- if rank == RANK_UNKNOWN:
+ if self._format_version != CHANGELOGV2 or rank == RANK_UNKNOWN:
return None
+ if rev == nullrev:
+ return 0 # convention
return rank
def chainbase(self, rev):
To: pacien, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list