mercurial/revlog.py
changeset 40152 adbf8ca239e4
parent 40056 324b4b10351e
child 40180 ba70e3acf58a
--- a/mercurial/revlog.py	Thu Oct 11 21:51:17 2018 -0400
+++ b/mercurial/revlog.py	Fri Oct 12 06:22:43 2018 +0200
@@ -648,6 +648,9 @@
 
         return entry[5], entry[6]
 
+    # fast parentrevs(rev) where rev isn't filtered
+    _uncheckedparentrevs = parentrevs
+
     def node(self, rev):
         try:
             return self.index[rev][7]
@@ -747,8 +750,14 @@
 
         See the documentation for ancestor.lazyancestors for more details."""
 
-        return ancestor.lazyancestors(self.parentrevs, revs, stoprev=stoprev,
-                                      inclusive=inclusive)
+        # first, make sure start revisions aren't filtered
+        revs = list(revs)
+        checkrev = self.node
+        for r in revs:
+            checkrev(r)
+        # and we're sure ancestors aren't filtered as well
+        return ancestor.lazyancestors(self._uncheckedparentrevs, revs,
+                                      stoprev=stoprev, inclusive=inclusive)
 
     def descendants(self, revs):
         return dagop.descendantrevs(revs, self.revs, self.parentrevs)