--- a/mercurial/commands.py Sun Jan 10 06:21:40 2016 +0000
+++ b/mercurial/commands.py Sun Jan 10 08:03:58 2016 +0000
@@ -4367,8 +4367,9 @@
[('e', 'extension', None, _('show only help for extensions')),
('c', 'command', None, _('show only help for commands')),
('k', 'keyword', None, _('show topics matching keyword')),
+ ('s', 'system', [], _('show help for specific platform(s)')),
],
- _('[-eck] [TOPIC]'),
+ _('[-ecks] [TOPIC]'),
norepo=True)
def help_(ui, name=None, **opts):
"""show help for a given topic or a help overview
@@ -4383,18 +4384,19 @@
textwidth = min(ui.termwidth(), 80) - 2
- keep = []
+ keep = opts.get('system') or []
+ if len(keep) == 0:
+ if sys.platform.startswith('win'):
+ keep.append('windows')
+ elif sys.platform == 'OpenVMS':
+ keep.append('vms')
+ elif sys.platform == 'plan9':
+ keep.append('plan9')
+ else:
+ keep.append('unix')
+ keep.append(sys.platform.lower())
if ui.verbose:
keep.append('verbose')
- if sys.platform.startswith('win'):
- keep.append('windows')
- elif sys.platform == 'OpenVMS':
- keep.append('vms')
- elif sys.platform == 'plan9':
- keep.append('plan9')
- else:
- keep.append('unix')
- keep.append(sys.platform.lower())
section = None
subtopic = None
--- a/tests/test-completion.t Sun Jan 10 06:21:40 2016 +0000
+++ b/tests/test-completion.t Sun Jan 10 08:03:58 2016 +0000
@@ -278,7 +278,7 @@
graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude
heads: rev, topo, active, closed, style, template
- help: extension, command, keyword
+ help: extension, command, keyword, system
identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure
import: strip, base, edit, force, no-commit, bypass, partial, exact, prefix, import-branch, message, logfile, date, user, similarity
incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos
--- a/tests/test-help.t Sun Jan 10 06:21:40 2016 +0000
+++ b/tests/test-help.t Sun Jan 10 08:03:58 2016 +0000
@@ -1250,6 +1250,15 @@
$ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$'
[1]
+Test -s / --system
+
+ $ hg help config.files -s windows |grep 'etc/mercurial' | \
+ > wc -l | sed -e 's/ //g'
+ 0
+ $ hg help config.files --system unix | grep 'USER' | \
+ > wc -l | sed -e 's/ //g'
+ 0
+
Test -e / -c / -k combinations
$ hg help -c|egrep '^[A-Z].*:|^ debug'