changeset 3139:1fd1cdcc4200

Switch revlog.ancestor to use revisions rather than nodeids
author Matt Mackall <mpm@selenic.com>
date Thu, 21 Sep 2006 18:15:44 -0500
parents cc856c4d91ca
children aabc5ef7d159
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Sep 21 16:16:39 2006 -0500
+++ b/mercurial/revlog.py	Thu Sep 21 18:15:44 2006 -0500
@@ -1016,10 +1016,14 @@
     def ancestor(self, a, b):
         """calculate the least common ancestor of nodes a and b"""
 
-        def parents(node):
-            return [p for p in self.parents(node) if p != nullid]
+        def parents(rev):
+            return [p for p in self.parentrevs(rev) if p != -1]
 
-        return ancestor.ancestor(a, b, parents) or nullid
+        c = ancestor.ancestor(self.rev(a), self.rev(b), parents)
+        if c is None:
+            return nullid
+
+        return self.node(c)
 
     def group(self, nodelist, lookup, infocollect=None):
         """calculate a delta group