[Updated] D12143: rank: compute property incrementally
pacien (Pacien)
phabricator at mercurial-scm.org
Mon Feb 14 17:07:35 UTC 2022
pacien edited the summary of this revision.
pacien updated this revision to Diff 32171.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12143?vs=32090&id=32171
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12143/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12143
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
@@ -2492,7 +2492,16 @@
rank = RANK_UNKNOWN
if self._format_version == CHANGELOGV2:
- rank = len(list(self.ancestors([p1r, p2r], inclusive=True))) + 1
+ if (p1r, p2r) == (nullrev, nullrev):
+ rank = 1
+ elif p1r != nullrev and p2r == nullrev:
+ rank = 1 + self.fast_rank(p1r)
+ elif p1r == nullrev and p2r != nullrev:
+ rank = 1 + self.fast_rank(p2r)
+ else: # merge node
+ pmin, pmax = sorted((p1r, p2r))
+ rank = 1 + self.fast_rank(pmax)
+ rank += sum(1 for _ in self.findmissingrevs([pmax], [pmin]))
e = revlogutils.entry(
flags=flags,
To: pacien, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220214/037c6881/attachment-0002.html>
More information about the Mercurial-patches
mailing list