ancestor: incrementalmissingancestors.basesheads()
authorGeorges Racinet <georges.racinet@octobus.net>
Mon, 14 Jan 2019 18:36:09 +0100
changeset 41244 4856c9b8cbaf
parent 41243 5257e6299d4c
child 41245 2a8782cc2e16
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
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