# HG changeset patch # User Martin von Zweigbergk # Date 1528742241 25200 # Node ID f1d55ae2c5c8b457454c133366178304bce9c2f4 # Parent 99188a7c87177ea712e546b0d9783b7ac065b030 revsets: define a none() revset This can be useful for default values in corp-wide configuration (e.g. for commits to hide, which defaults to none()), and perhaps in scripts. I named it none() rather than empty() to match all(). Differential Revision: https://phab.mercurial-scm.org/D3713 diff -r 99188a7c8717 -r f1d55ae2c5c8 mercurial/revset.py --- a/mercurial/revset.py Mon Jun 11 19:24:01 2018 +0200 +++ b/mercurial/revset.py Mon Jun 11 11:37:21 2018 -0700 @@ -1346,6 +1346,14 @@ result = baseset([rn]) return result & subset +@predicate('none()', safe=True) +def none(repo, subset, x): + """No changesets. + """ + # i18n: "none" is a keyword + getargs(x, 0, 0, _("none takes no arguments")) + return baseset() + @predicate('obsolete()', safe=True) def obsolete(repo, subset, x): """Mutable changeset with a newer version.""" diff -r 99188a7c8717 -r f1d55ae2c5c8 tests/test-revset2.t --- a/tests/test-revset2.t Mon Jun 11 19:24:01 2018 +0200 +++ b/tests/test-revset2.t Mon Jun 11 11:37:21 2018 -0700 @@ -584,6 +584,9 @@ hg: parse error: empty string is not a valid revision [255] +test empty revset + $ hg log 'none()' + we can use patterns when searching for tags $ log 'tag("1..*")'