Mercurial > public > mercurial-scm > hg-stable
diff mercurial/help.py @ 40489:1ddd202c47d9
help: allow hiding of help topics
Differential Revision: https://phab.mercurial-scm.org/D5077
author | rdamazio@google.com |
---|---|
date | Sat, 13 Oct 2018 05:43:39 -0700 |
parents | ab09e797fbed |
children | 444861dc1e55 |
line wrap: on
line diff
--- a/mercurial/help.py Sat Oct 13 05:02:55 2018 -0700 +++ b/mercurial/help.py Sat Oct 13 05:43:39 2018 -0700 @@ -198,6 +198,9 @@ return True return False +def filtertopic(ui, topic): + return ui.configbool('help', 'hidden-topic.%s' % topic, False) + def topicmatch(ui, commands, kw): """Return help topics matching kw. @@ -218,7 +221,9 @@ if (sum(map(lowercontains, names)) or lowercontains(header) or (callable(doc) and lowercontains(doc(ui)))): - results['topics'].append((names[0], header)) + name = names[0] + if not filtertopic(ui, name): + results['topics'].append((names[0], header)) for cmd, entry in commands.table.iteritems(): if len(entry) == 3: summary = entry[2] @@ -599,7 +604,10 @@ else: category = TOPIC_CATEGORY_NONE - topiccats.setdefault(category, []).append((names[0], header)) + topicname = names[0] + if not filtertopic(ui, topicname): + topiccats.setdefault(category, []).append( + (topicname, header)) # Check that all categories have an order. missing_order = set(topiccats.keys()) - set(TOPIC_CATEGORY_ORDER)