Switch revlog.ancestor to use revisions rather than nodeids
authorMatt Mackall <mpm@selenic.com>
Thu, 21 Sep 2006 18:15:44 -0500
changeset 3139 1fd1cdcc4200
parent 3138 cc856c4d91ca
child 3142 aabc5ef7d159
Switch revlog.ancestor to use revisions rather than nodeids
mercurial/revlog.py
--- 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