Mercurial > hg
changeset 49671:92c65bd0c4d6
sqlitestore: add an `ancestors` method
We will need it during bundling.
The implementation mirror the one in revlog.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 09 Nov 2022 13:54:15 -0500 |
parents | 2fd8750f3722 |
children | e92de86cf4f8 |
files | hgext/sqlitestore.py |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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