revlog: use context ancestor instead of changelog ancestor
authorMads Kiilerich <madski@unity3d.com>
Mon, 07 Apr 2014 23:17:51 +0200
changeset 20991 a05d694599f9
parent 20990 d9e211a658eb
child 20992 05086b56b564
revlog: use context ancestor instead of changelog ancestor We want to move in this direction.
mercurial/revset.py
--- a/mercurial/revset.py	Tue Feb 25 20:31:53 2014 +0100
+++ b/mercurial/revset.py	Mon Apr 07 23:17:51 2014 +0200
@@ -320,7 +320,7 @@
 
 def ancestor(repo, subset, x):
     """``ancestor(*changeset)``
-    Greatest common ancestor of the changesets.
+    A greatest common ancestor of the changesets.
 
     Accepts 0 or more changesets.
     Will return empty list when passed no args.
@@ -332,18 +332,15 @@
     anc = None
 
     # (getset(repo, rl, i) for i in l) generates a list of lists
-    rev = repo.changelog.rev
-    ancestor = repo.changelog.ancestor
-    node = repo.changelog.node
     for revs in (getset(repo, rl, i) for i in l):
         for r in revs:
             if anc is None:
-                anc = r
+                anc = repo[r]
             else:
-                anc = rev(ancestor(node(anc), node(r)))
-
-    if anc is not None and anc in subset:
-        return baseset([anc])
+                anc = anc.ancestor(repo[r])
+
+    if anc is not None and anc.rev() in subset:
+        return baseset([anc.rev()])
     return baseset([])
 
 def _ancestors(repo, subset, x, followfirst=False):