##// END OF EJS Templates
revlog: replace descendant(b, a) by isdescendantrev(a, b) (API)...
Martin von Zweigbergk -
r38686:160da69b default
parent child Browse files
Show More
@@ -591,7 +591,7 b' class changectx(basectx):'
591 591
592 592 def descendant(self, other):
593 593 """True if other is descendant of this changeset"""
594 return self._repo.changelog.descendant(self._rev, other._rev)
594 return self._repo.changelog.isdescendantrev(other._rev, self._rev)
595 595
596 596 def walk(self, match):
597 597 '''Generates matching file names.'''
@@ -1645,18 +1645,18 b' class revlog(object):'
1645 1645 c.append(self.node(r))
1646 1646 return c
1647 1647
1648 def descendant(self, start, end):
1649 """True if revision 'end' is an descendant of revision 'start'
1650
1651 A revision is considered as a descendant of itself.
1648 def isdescendantrev(self, a, b):
1649 """True if revision a is a descendant of revision b
1650
1651 A revision is considered a descendant of itself.
1652 1652
1653 1653 The implementation of this is trivial but the use of
1654 1654 commonancestorsheads is not."""
1655 if start == nullrev:
1655 if b == nullrev:
1656 1656 return True
1657 elif start == end:
1657 elif a == b:
1658 1658 return True
1659 return start in self._commonancestorsheads(start, end)
1659 return b in self._commonancestorsheads(a, b)
1660 1660
1661 1661 def commonancestorsheads(self, a, b):
1662 1662 """calculate all the heads of the common ancestors of nodes a and b"""
@@ -1673,9 +1673,11 b' class revlog(object):'
1673 1673 return ancs
1674 1674
1675 1675 def isancestor(self, a, b):
1676 """return True if node a is an ancestor of node b"""
1676 """return True if node a is an ancestor of node b
1677
1678 A revision is considered an ancestor of itself."""
1677 1679 a, b = self.rev(a), self.rev(b)
1678 return self.descendant(a, b)
1680 return self.isdescendantrev(b, a)
1679 1681
1680 1682 def ancestor(self, a, b):
1681 1683 """calculate the "best" common ancestor of nodes a and b"""
General Comments 0
You need to be logged in to leave comments. Login now