Mercurial > hg-stable
changeset 38516:99f864b34451
revlog: refactor out the rev-oriented part of commonancestorheads
We plan to use this in a function taking revs as argument. Round trips to nodes
seem silly.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 21 Jun 2018 23:56:51 +0100 |
parents | 879cbdde63df |
children | 6db38c9d7e00 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Thu Jun 21 23:53:43 2018 +0100 +++ b/mercurial/revlog.py Thu Jun 21 23:56:51 2018 +0100 @@ -1390,11 +1390,16 @@ def commonancestorsheads(self, a, b): """calculate all the heads of the common ancestors of nodes a and b""" a, b = self.rev(a), self.rev(b) + ancs = self._commonancestorsheads(a, b) + return pycompat.maplist(self.node, ancs) + + def _commonancestorsheads(self, *revs): + """calculate all the heads of the common ancestors of revs""" try: - ancs = self.index.commonancestorsheads(a, b) + ancs = self.index.commonancestorsheads(*revs) except (AttributeError, OverflowError): # C implementation failed - ancs = ancestor.commonancestorsheads(self.parentrevs, a, b) - return pycompat.maplist(self.node, ancs) + ancs = ancestor.commonancestorsheads(self.parentrevs, *revs) + return ancs def isancestor(self, a, b): """return True if node a is an ancestor of node b