comparison mercurial/revlog.py @ 38663:93d9690ff2b0

revlog: move comment about commonancestorsheads where it's used Differential Revision: https://phab.mercurial-scm.org/D3928
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 11 Jul 2018 16:27:40 -0700
parents cd1c484e31e8
children 160da69ba1bf
comparison
equal deleted inserted replaced
38662:ad2aa4e85047 38663:93d9690ff2b0
1646 return c 1646 return c
1647 1647
1648 def descendant(self, start, end): 1648 def descendant(self, start, end):
1649 """True if revision 'end' is an descendant of revision 'start' 1649 """True if revision 'end' is an descendant of revision 'start'
1650 1650
1651 A revision is considered as a descendant of itself.""" 1651 A revision is considered as a descendant of itself.
1652
1653 The implementation of this is trivial but the use of
1654 commonancestorsheads is not."""
1652 if start == nullrev: 1655 if start == nullrev:
1653 return True 1656 return True
1654 elif start == end: 1657 elif start == end:
1655 return True 1658 return True
1656 return start in self._commonancestorsheads(start, end) 1659 return start in self._commonancestorsheads(start, end)
1668 except (AttributeError, OverflowError): # C implementation failed 1671 except (AttributeError, OverflowError): # C implementation failed
1669 ancs = ancestor.commonancestorsheads(self.parentrevs, *revs) 1672 ancs = ancestor.commonancestorsheads(self.parentrevs, *revs)
1670 return ancs 1673 return ancs
1671 1674
1672 def isancestor(self, a, b): 1675 def isancestor(self, a, b):
1673 """return True if node a is an ancestor of node b 1676 """return True if node a is an ancestor of node b"""
1674
1675 The implementation of this is trivial but the use of
1676 commonancestorsheads is not."""
1677 a, b = self.rev(a), self.rev(b) 1677 a, b = self.rev(a), self.rev(b)
1678 return self.descendant(a, b) 1678 return self.descendant(a, b)
1679 1679
1680 def ancestor(self, a, b): 1680 def ancestor(self, a, b):
1681 """calculate the "best" common ancestor of nodes a and b""" 1681 """calculate the "best" common ancestor of nodes a and b"""