diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4367,8 +4367,9 @@ def heads(ui, repo, *branchrevs, **opts) [('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 @@ def help_(ui, name=None, **opts): 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 diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -278,7 +278,7 @@ Show all commands + options 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 diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1250,6 +1250,15 @@ help -c should only show deprecated for $ 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'