Mercurial > hg-stable
changeset 41275:1421d0487a61
revlog: accept a revs argument in `headrevs`
Computing the heads of an arbitrary set of revision is useful, we make it
possible to do so through the `headrevs` method of the revlog.
Right now, this is just calling dagop's implementation. However, we expect to
plug a native implementation soon.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 14 Jan 2019 17:06:00 +0100 |
parents | 4c6fdc7e2e7d |
children | 5affe1583e1d |
files | mercurial/changelog.py mercurial/revlog.py |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Mon Jan 14 16:53:55 2019 +0100 +++ b/mercurial/changelog.py Mon Jan 14 17:06:00 2019 +0100 @@ -347,8 +347,8 @@ def reachableroots(self, minroot, heads, roots, includepath=False): return self.index.reachableroots2(minroot, heads, roots, includepath) - def headrevs(self): - if self.filteredrevs: + def headrevs(self, revs=None): + if revs is None and self.filteredrevs: try: return self.index.headrevsfiltered(self.filteredrevs) # AttributeError covers non-c-extension environments and @@ -356,7 +356,7 @@ except AttributeError: return self._headrevs() - return super(changelog, self).headrevs() + return super(changelog, self).headrevs(revs) def strip(self, *args, **kwargs): # XXX make something better than assert
--- a/mercurial/revlog.py Mon Jan 14 16:53:55 2019 +0100 +++ b/mercurial/revlog.py Mon Jan 14 17:06:00 2019 +0100 @@ -1102,11 +1102,13 @@ assert heads return (orderedout, roots, heads) - def headrevs(self): - try: - return self.index.headrevs() - except AttributeError: - return self._headrevs() + def headrevs(self, revs=None): + if revs is None: + try: + return self.index.headrevs() + except AttributeError: + return self._headrevs() + return dagop.headrevs(revs, self.parentrevs) def computephases(self, roots): return self.index.computephasesmapsets(roots)