Patchwork D3713: revsets: define a none() revset

login
register
mail settings
Submitter phabricator
Date June 12, 2018, 12:26 p.m.
Message ID <7219a910de8d2aabe70f6e04db467223@localhost.localdomain>
Download mbox | patch
Permalink /patch/32071/
State Not Applicable
Headers show

Comments

phabricator - June 12, 2018, 12:26 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf1d55ae2c5c8: revsets: define a none() revset (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3713?vs=9012&id=9017

REVISION DETAIL
  https://phab.mercurial-scm.org/D3713

AFFECTED FILES
  mercurial/revset.py
  tests/test-revset2.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-revset2.t b/tests/test-revset2.t
--- a/tests/test-revset2.t
+++ b/tests/test-revset2.t
@@ -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..*")'
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -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."""