diff mercurial/ancestor.py @ 41244:4856c9b8cbaf

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
author Georges Racinet <georges.racinet@octobus.net>
date Mon, 14 Jan 2019 18:36:09 +0100
parents 72b94f946e90
children 2372284d9457
line wrap: on
line diff
--- 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