Mercurial > hg
changeset 10329:ae0ae8691e47
revlog: fix up previously stupid API change
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sat, 06 Feb 2010 12:47:17 +0100 |
parents | 0798a3d5f812 |
children | d8c0e6c43791 |
files | mercurial/revlog.py |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Sat Feb 06 11:29:48 2010 +0100 +++ b/mercurial/revlog.py Sat Feb 06 12:47:17 2010 +0100 @@ -1137,21 +1137,21 @@ self._cache = (node, curr, text) return node - def descendant(self, a, b): - if a > b: - return False - for i in self.descendants(a): - if i == b: + def descendant(self, start, end): + for i in self.descendants(start): + if i == end: return True - elif i > b: + elif i > end: break return False def ancestor(self, a, b): """calculate the least common ancestor of nodes a and b""" + # fast path, check if it is a descendant + a, b = self.rev(a), self.rev(b) start, end = sorted((a, b)) - if self.descendant(a, b): + if self.descendant(start, end): return self.node(start) def parents(rev):