revset: add hidden() revset
authorPatrick Mezard <patrick@mezard.eu>
Sat, 04 Aug 2012 20:20:48 +0200
changeset 17390 74b44f25b4b1
parent 17388 54feb8d3bab7
child 17393 99a2a4ae35e2
revset: add hidden() revset
mercurial/revset.py
tests/test-obsolete.t
--- a/mercurial/revset.py	Fri Aug 24 14:53:07 2012 -0500
+++ b/mercurial/revset.py	Sat Aug 04 20:20:48 2012 +0200
@@ -838,6 +838,14 @@
     ps = set(parents(repo, subset, x))
     return [r for r in s if r not in ps]
 
+def hidden(repo, subset, x):
+    """``hidden()``
+    Hidden changesets.
+    """
+    # i18n: "hidden" is a keyword
+    getargs(x, 0, 0, _("hidden takes no arguments"))
+    return [r for r in subset if r in repo.hiddenrevs]
+
 def keyword(repo, subset, x):
     """``keyword(string)``
     Search commit message, user name, and names of changed files for
@@ -1484,6 +1492,7 @@
     "grep": grep,
     "head": head,
     "heads": heads,
+    "hidden": hidden,
     "id": node_,
     "keyword": keyword,
     "last": last,
--- a/tests/test-obsolete.t	Fri Aug 24 14:53:07 2012 -0500
+++ b/tests/test-obsolete.t	Sat Aug 04 20:20:48 2012 +0200
@@ -68,7 +68,10 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ mkcommit new_c
   created new head
+  $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
   $ hg debugobsolete `getid original_c`  `getid new_c` -d '56 12'
+  $ hg log -r 'hidden()' --template '{rev}:{node|short} {desc}\n' --hidden
+  2:245bde4270cd add original_c
   $ hg debugobsolete
   245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f 0 {'date': '56 12', 'user': 'test'}