##// END OF EJS Templates
revlog: delete isdescendantrev() in favor of isancestorrev()...
Martin von Zweigbergk -
r38690:21846c94 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.isdescendantrev(other._rev, self._rev)
594 return self._repo.changelog.isancestorrev(self._rev, other._rev)
595 595
596 596 def walk(self, match):
597 597 '''Generates matching file names.'''
@@ -1645,21 +1645,6 b' class revlog(object):'
1645 1645 c.append(self.node(r))
1646 1646 return c
1647 1647
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
1653 The implementation of this is trivial but the use of
1654 commonancestorsheads is not."""
1655 if b == nullrev:
1656 return True
1657 elif a == b:
1658 return True
1659 elif a < b:
1660 return False
1661 return b in self._commonancestorsheads(a, b)
1662
1663 1648 def commonancestorsheads(self, a, b):
1664 1649 """calculate all the heads of the common ancestors of nodes a and b"""
1665 1650 a, b = self.rev(a), self.rev(b)
@@ -1684,8 +1669,17 b' class revlog(object):'
1684 1669 def isancestorrev(self, a, b):
1685 1670 """return True if revision a is an ancestor of revision b
1686 1671
1687 A revision is considered an ancestor of itself."""
1688 return self.isdescendantrev(b, a)
1672 A revision is considered an ancestor of itself.
1673
1674 The implementation of this is trivial but the use of
1675 commonancestorsheads is not."""
1676 if a == nullrev:
1677 return True
1678 elif a == b:
1679 return True
1680 elif a > b:
1681 return False
1682 return a in self._commonancestorsheads(a, b)
1689 1683
1690 1684 def ancestor(self, a, b):
1691 1685 """calculate the "best" common ancestor of nodes a and b"""
General Comments 0
You need to be logged in to leave comments. Login now