# HG changeset patch # User Patrick Mezard # Date 2012-04-08 09:11:30 # Node ID f3df7d34791e7d6b03a274ff2064458c965fa629 # Parent 709924be3d047ae8982c1f71eb910779a05b4416 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -327,7 +327,7 @@ def _children(repo, narrow, s): 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 reverse(repo, subset, x): 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()`` diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -372,6 +372,8 @@ issue2437 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(é)))'