# HG changeset patch # User pacien # Date 2022-02-21 15:18:39 # Node ID 6ea9ead59cf8d2f60b2e9bb5843f234e75fd10ea # Parent 8b8054b8e5a7df019784cdcd6213dc65fc5a2a2b revlog: use rust rank computation if available Differential Revision: https://phab.mercurial-scm.org/D12212 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2471,9 +2471,12 @@ class revlog(object): 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])) + if rustdagop is not None and self.index.rust_ext_compat: + rank = rustdagop.rank(self.index, p1r, p2r) + else: + 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,