# HG changeset patch # User Matt Mackall # Date 1334281959 18000 # Node ID a232a1b5ae9b0b3e9469d1567e36a6c42f6563e3 # Parent e8d37b78acfb22ae2c1fb126c200398cc9c71208# Parent 03e408a122c40ce974d648f5c05177676adfbc72 merge with stable diff -r e8d37b78acfb -r a232a1b5ae9b mercurial/revset.py --- 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()`` diff -r e8d37b78acfb -r a232a1b5ae9b tests/test-revset.t --- 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(é)))'