sqlitestore: add an `ancestors` method stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 09 Nov 2022 13:54:15 -0500
branchstable
changeset 49789 df750b81272f
parent 49788 31b4675ca998
child 49790 f463eb675e85
sqlitestore: add an `ancestors` method We will need it during bundling. The implementation mirror the one in revlog.
hgext/sqlitestore.py
--- a/hgext/sqlitestore.py	Thu Nov 24 04:04:19 2022 +0100
+++ b/hgext/sqlitestore.py	Wed Nov 09 13:54:15 2022 -0500
@@ -429,6 +429,25 @@
         entry = self._revisions[self._revtonode[rev]]
         return entry.p1rev, entry.p2rev
 
+    def ancestors(self, revs, stoprev=0, inclusive=False):
+        """Generate the ancestors of 'revs' in reverse revision order.
+        Does not generate revs lower than stoprev.
+
+        See the documentation for ancestor.lazyancestors for more details."""
+
+        # first, make sure start revisions aren't filtered
+        revs = list(revs)
+        checkrev = self.node
+        for r in revs:
+            checkrev(r)
+
+        return ancestor.lazyancestors(
+            self.parentrevs,
+            revs,
+            stoprev=stoprev,
+            inclusive=inclusive,
+        )
+
     def rev(self, node):
         if node == sha1nodeconstants.nullid:
             return nullrev