# HG changeset patch # User Georges Racinet # Date 1547487369 -3600 # Node ID 4856c9b8cbaf79728b4a59670cbe6538b07ce737 # Parent 5257e6299d4c219e01f5e162ecdedcaa4af9fca4 ancestor: incrementalmissingancestors.basesheads() This new method will avoid the need to access the `bases` attribute directly in `setdiscovery`, and to prefilter `nullrev` before passing it to the `heads()` revset. Being a method, it can transparently be reimplemented in a Rust (or any native) version. Differential Revision: https://phab.mercurial-scm.org/D5582 diff -r 5257e6299d4c -r 4856c9b8cbaf mercurial/ancestor.py --- a/mercurial/ancestor.py Mon Jan 14 17:46:14 2019 +0100 +++ b/mercurial/ancestor.py Mon Jan 14 18:36:09 2019 +0100 @@ -11,6 +11,7 @@ from .node import nullrev from . import ( + dagop, policy, pycompat, ) @@ -162,6 +163,9 @@ '''grow the ancestor set by adding new bases''' self.bases.update(newbases) + def basesheads(self): + return dagop.headrevs(self.bases, self.pfunc) + def removeancestorsfrom(self, revs): '''remove all ancestors of bases from the set revs (in place)''' bases = self.bases