Patchwork [5,of,5] help: hide deprecated filesets, revsets and template items if not verbose

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 29, 2015, 3:59 p.m.
Message ID <f3f41d5d2561e23e7a5f.1443542376@mimosa>
Download mbox | patch
Permalink /patch/10687/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 29, 2015, 3:59 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1443237464 -32400
#      Sat Sep 26 12:17:44 2015 +0900
# Node ID f3f41d5d2561e23e7a5f07f641a841e952435c9a
# Parent  bdd845598bdef799ec0d03a63c6eaf1a631d59db
help: hide deprecated filesets, revsets and template items if not verbose

This allows us to hide {branches} template keyword in a better way. Currently
it is achieved by copying keywords table and deleting 'branches' from it.
Matt Mackall - Sept. 29, 2015, 9:51 p.m.
On Wed, 2015-09-30 at 00:59 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1443237464 -32400
> #      Sat Sep 26 12:17:44 2015 +0900
> # Node ID f3f41d5d2561e23e7a5f07f641a841e952435c9a
> # Parent  bdd845598bdef799ec0d03a63c6eaf1a631d59db
> help: hide deprecated filesets, revsets and template items if not verbose

These are queued for default, thanks.

Patch

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -191,7 +191,8 @@  def makeitemsdoc(ui, topic, doc, marker,
     entries = []
     for name in sorted(items):
         text = (items[name].__doc__ or '').rstrip()
-        if not text:
+        if (not text
+            or not ui.verbose and any(w in text for w in _exclkeywords)):
             continue
         text = gettext(text)
         if dedent:
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -980,6 +980,12 @@  Test templating help
       firstline     Any text. Returns the first line of text.
       nonempty      Any text. Returns '(none)' if the string is empty.
 
+Test deprecated items
+
+  $ hg help -v templating | grep currentbookmark
+      currentbookmark
+  $ hg help templating | (grep currentbookmark || true)
+
 Test help hooks
 
   $ cat > helphook1.py <<EOF