revlog: add rev-specific variant of findmissing
authorSiddharth Agarwal <sid0@fb.com>
Mon, 26 Nov 2012 10:48:24 -0800
changeset 17972 7ef00d09ef35
parent 17971 e1b9a78a7aed
child 17973 fa6be7b81f77
revlog: add rev-specific variant of findmissing This will be used by rebase in an upcoming commit.
mercurial/revlog.py
--- a/mercurial/revlog.py	Mon Nov 26 11:02:48 2012 -0800
+++ b/mercurial/revlog.py	Mon Nov 26 10:48:24 2012 -0800
@@ -429,6 +429,29 @@
         missing.sort()
         return has, [self.node(r) for r in missing]
 
+    def findmissingrevs(self, common=None, heads=None):
+        """Return the revision numbers of the ancestors of heads that
+        are not ancestors of common.
+
+        More specifically, return a list of revision numbers corresponding to
+        nodes N such that every N satisfies the following constraints:
+
+          1. N is an ancestor of some node in 'heads'
+          2. N is not an ancestor of any node in 'common'
+
+        The list is sorted by revision number, meaning it is
+        topologically sorted.
+
+        'heads' and 'common' are both lists of revision numbers.  If heads is
+        not supplied, uses all of the revlog's heads.  If common is not
+        supplied, uses nullid."""
+        if common is None:
+            common = [nullrev]
+        if heads is None:
+            heads = self.headrevs()
+
+        return ancestor.missingancestors(heads, common, self.parentrevs)
+
     def findmissing(self, common=None, heads=None):
         """Return the ancestors of heads that are not ancestors of common.