[Updated] D12143: rank: compute property incrementally
pacien (Pacien)
phabricator at mercurial-scm.org
Tue Feb 15 14:49:54 UTC 2022
Closed by commit rHG580660518459: rank: compute property incrementally (authored by pacien).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12143?vs=32171&id=32204
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
@@ -2464,7 +2464,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/20220215/8c6386f7/attachment-0002.html>
More information about the Mercurial-patches
mailing list