changeset 16415:a232a1b5ae9b

merge with stable
author Matt Mackall <mpm@selenic.com>
date Thu, 12 Apr 2012 20:52:39 -0500
parents e8d37b78acfb (current diff) 03e408a122c4 (diff)
children b4b0c6931e11
files mercurial/revset.py tests/test-revset.t
diffstat 2 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Apr 12 14:05:59 2012 -0700
+++ b/mercurial/revset.py	Thu Apr 12 20:52:39 2012 -0500
@@ -364,13 +364,12 @@
                     break
     return s
 
-def _children(repo, narrow, s):
+def _children(repo, narrow, parentset):
     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:
+            if p in parentset:
                 cs.add(r)
     return cs
 
@@ -378,7 +377,7 @@
     """``children(set)``
     Child changesets of changesets in set.
     """
-    s = getset(repo, range(len(repo)), x)
+    s = set(getset(repo, range(len(repo)), x))
     cs = _children(repo, subset, s)
     return [r for r in subset if r in cs]
 
@@ -994,11 +993,12 @@
 
 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))
+    subset = [r for r in subset if r in s]
+    cs = _children(repo, subset, s)
+    return [r for r in subset if r not in cs]
 
 def secret(repo, subset, x):
     """``secret()``
--- a/tests/test-revset.t	Thu Apr 12 14:05:59 2012 -0700
+++ b/tests/test-revset.t	Thu Apr 12 20:52:39 2012 -0500
@@ -411,6 +411,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(é)))'