diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -571,6 +571,14 @@ def _descendants(repo, subset, x, follow if not args: return [] s = set(_revdescendants(repo, args, followfirst)) | set(args) + + if len(subset) == len(repo): + # the passed in revisions may not exist, -1 for example + for arg in args: + if arg not in subset: + s.remove(arg) + return list(s) + return [r for r in subset if r in s] def descendants(repo, subset, x): @@ -1328,7 +1336,10 @@ def roots(repo, subset, x): Changesets in set with no parent changeset in set. """ s = set(getset(repo, repo.changelog, x)) - subset = [r for r in subset if r in s] + if len(subset) == len(repo): + subset = s + else: + 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]