diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -399,6 +399,9 @@ def only(repo, subset, x): args = getargs(x, 1, 2, _('only takes one or two arguments')) include = getset(repo, spanset(repo), args[0]).set() if len(args) == 1: + if len(include) == 0: + return baseset([]) + descendants = set(_revdescendants(repo, include, False)) exclude = [rev for rev in cl.headrevs() if not rev in descendants and not rev in include] diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -427,6 +427,16 @@ min: empty on unordered set 7 8 9 + +Test empty set input + $ log 'only(p2())' + $ log 'only(p1(), p2())' + 0 + 1 + 2 + 4 + 8 + 9 $ log 'outgoing()' 8 9