--- a/mercurial/revlog.py Tue Apr 16 10:08:18 2013 -0700
+++ b/mercurial/revlog.py Tue Apr 16 10:08:19 2013 -0700
@@ -705,17 +705,12 @@
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(start, end):
- return self.node(start)
-
- c = ancestor.ancestor(a, b, self.parentrevs)
- if c is None:
- return nullid
-
- return self.node(c)
+ ancs = ancestor.ancestors(self.parentrevs, a, b)
+ if ancs:
+ # choose a consistent winner when there's a tie
+ return min(map(self.node, ancs))
+ return nullid
def _match(self, id):
if isinstance(id, int):