diff mercurial/revset.py @ 11650:ebaf117c2642 stable

revset: fix ancestor subset handling (issue2298)
author Matt Mackall <mpm@selenic.com>
date Thu, 22 Jul 2010 08:17:38 -0500
parents 6b836d5c8c9e
children ba65d61f3158 b75dea24e296
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Jul 12 16:07:58 2010 +0200
+++ b/mercurial/revset.py	Thu Jul 22 08:17:38 2010 -0500
@@ -223,11 +223,14 @@
 
 def ancestor(repo, subset, x):
     l = getargs(x, 2, 2, _("ancestor wants two arguments"))
-    a = getset(repo, subset, l[0])
-    b = getset(repo, subset, l[1])
-    if len(a) > 1 or len(b) > 1:
+    r = range(len(repo))
+    a = getset(repo, r, l[0])
+    b = getset(repo, r, l[1])
+    if len(a) != 1 or len(b) != 1:
         raise error.ParseError(_("ancestor arguments must be single revisions"))
-    return [repo[a[0]].ancestor(repo[b[0]]).rev()]
+    an = [repo[a[0]].ancestor(repo[b[0]]).rev()]
+
+    return [r for r in an if r in subset]
 
 def ancestors(repo, subset, x):
     args = getset(repo, range(len(repo)), x)