revset: do not ignore input revisions in roots() stable
authorPatrick Mezard <patrick@mezard.eu>
Sun, 08 Apr 2012 11:11:30 +0200
branchstable
changeset 16394 f3df7d34791e
parent 16372 709924be3d04
child 16395 c3fd35f88fbb
revset: do not ignore input revisions in roots() 0329d3b12d8e is also partially reverted to use the 'narrow' parameter again and make less changesets parents lookups.
mercurial/revset.py
tests/test-revset.t
--- a/mercurial/revset.py	Fri Apr 06 15:17:50 2012 -0500
+++ b/mercurial/revset.py	Sun Apr 08 11:11:30 2012 +0200
@@ -327,7 +327,7 @@
     cs = set()
     pr = repo.changelog.parentrevs
     s = set(s)
-    for r in xrange(len(repo)):
+    for r in narrow:
         for p in pr(r):
             if p in s:
                 cs.add(r)
@@ -811,11 +811,11 @@
 
 def roots(repo, subset, x):
     """``roots(set)``
-    Changesets with no parent changeset in set.
+    Changesets in set with no parent changeset in set.
     """
-    s = getset(repo, xrange(len(repo)), x)
-    cs = _children(repo, s, s)
-    return [r for r in s if r not in cs]
+    s = set(getset(repo, xrange(len(repo)), x))
+    cs = _children(repo, subset, s)
+    return [r for r in subset if r in s and r not in cs]
 
 def secret(repo, subset, x):
     """``secret()``
--- a/tests/test-revset.t	Fri Apr 06 15:17:50 2012 -0500
+++ b/tests/test-revset.t	Sun Apr 08 11:11:30 2012 +0200
@@ -372,6 +372,8 @@
   2
   $ log 'roots(all()) or roots(all())'
   0
+  $ hg debugrevspec 'roots(all()) or roots(all())'
+  0
   $ log 'heads(branch(é)) or heads(branch(é))'
   9
   $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(é)))'