revlog: switch findmissing to use ancestor.missingancestors
authorSiddharth Agarwal <sid0@fb.com>
Mon, 26 Nov 2012 11:02:48 -0800
changeset 17971 e1b9a78a7aed
parent 17970 0b03454abae7
child 17972 7ef00d09ef35
revlog: switch findmissing to use ancestor.missingancestors This also speeds up other commands that use findmissing, like incoming and merge --preview. With a large linear repository (>400000 commits) and with one incoming changeset, incoming is sped up from around 4-4.5 seconds to under 3.
mercurial/revlog.py
--- a/mercurial/revlog.py	Mon Nov 26 11:46:51 2012 -0800
+++ b/mercurial/revlog.py	Mon Nov 26 11:02:48 2012 -0800
@@ -444,8 +444,16 @@
         'heads' and 'common' are both lists of node IDs.  If heads is
         not supplied, uses all of the revlog's heads.  If common is not
         supplied, uses nullid."""
-        _common, missing = self.findcommonmissing(common, heads)
-        return missing
+        if common is None:
+            common = [nullid]
+        if heads is None:
+            heads = self.heads()
+
+        common = [self.rev(n) for n in common]
+        heads = [self.rev(n) for n in heads]
+
+        return [self.node(r) for r in
+                ancestor.missingancestors(heads, common, self.parentrevs)]
 
     def nodesbetween(self, roots=None, heads=None):
         """Return a topological path from 'roots' to 'heads'.