Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 38512: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 |
comparison
equal
deleted
inserted
replaced
38511:879cbdde63df | 38512:99f864b34451 |
---|---|
1388 return False | 1388 return False |
1389 | 1389 |
1390 def commonancestorsheads(self, a, b): | 1390 def commonancestorsheads(self, a, b): |
1391 """calculate all the heads of the common ancestors of nodes a and b""" | 1391 """calculate all the heads of the common ancestors of nodes a and b""" |
1392 a, b = self.rev(a), self.rev(b) | 1392 a, b = self.rev(a), self.rev(b) |
1393 ancs = self._commonancestorsheads(a, b) | |
1394 return pycompat.maplist(self.node, ancs) | |
1395 | |
1396 def _commonancestorsheads(self, *revs): | |
1397 """calculate all the heads of the common ancestors of revs""" | |
1393 try: | 1398 try: |
1394 ancs = self.index.commonancestorsheads(a, b) | 1399 ancs = self.index.commonancestorsheads(*revs) |
1395 except (AttributeError, OverflowError): # C implementation failed | 1400 except (AttributeError, OverflowError): # C implementation failed |
1396 ancs = ancestor.commonancestorsheads(self.parentrevs, a, b) | 1401 ancs = ancestor.commonancestorsheads(self.parentrevs, *revs) |
1397 return pycompat.maplist(self.node, ancs) | 1402 return ancs |
1398 | 1403 |
1399 def isancestor(self, a, b): | 1404 def isancestor(self, a, b): |
1400 """return True if node a is an ancestor of node b | 1405 """return True if node a is an ancestor of node b |
1401 | 1406 |
1402 The implementation of this is trivial but the use of | 1407 The implementation of this is trivial but the use of |