Show More
@@ -854,7 +854,7 b' def _dispatch(req):' | |||||
854 | if options['version']: |
|
854 | if options['version']: | |
855 | return commands.version_(ui) |
|
855 | return commands.version_(ui) | |
856 | if options['help']: |
|
856 | if options['help']: | |
857 |
return commands.help_(ui, cmd, command= |
|
857 | return commands.help_(ui, cmd, command=cmd is not None) | |
858 | elif not cmd: |
|
858 | elif not cmd: | |
859 | return commands.help_(ui, 'shortlist') |
|
859 | return commands.help_(ui, 'shortlist') | |
860 |
|
860 |
@@ -328,7 +328,7 b' def help_(ui, name, unknowncmd=False, fu' | |||||
328 | return rst |
|
328 | return rst | |
329 |
|
329 | |||
330 |
|
330 | |||
331 | def helplist(select=None): |
|
331 | def helplist(select=None, **opts): | |
332 | # list of commands |
|
332 | # list of commands | |
333 | if name == "shortlist": |
|
333 | if name == "shortlist": | |
334 | header = _('basic commands:\n\n') |
|
334 | header = _('basic commands:\n\n') | |
@@ -374,7 +374,9 b' def help_(ui, name, unknowncmd=False, fu' | |||||
374 | else: |
|
374 | else: | |
375 | rst.append(' :%s: %s\n' % (f, h[f])) |
|
375 | rst.append(' :%s: %s\n' % (f, h[f])) | |
376 |
|
376 | |||
377 | if not name: |
|
377 | ex = opts.get | |
|
378 | anyopts = (ex('keyword') or not (ex('command') or ex('extension'))) | |||
|
379 | if not name and anyopts: | |||
378 | exts = listexts(_('enabled extensions:'), extensions.enabled()) |
|
380 | exts = listexts(_('enabled extensions:'), extensions.enabled()) | |
379 | if exts: |
|
381 | if exts: | |
380 | rst.append('\n') |
|
382 | rst.append('\n') | |
@@ -491,8 +493,8 b' def help_(ui, name, unknowncmd=False, fu' | |||||
491 |
|
493 | |||
492 | rst = [] |
|
494 | rst = [] | |
493 | kw = opts.get('keyword') |
|
495 | kw = opts.get('keyword') | |
494 | if kw: |
|
496 | if kw or name is None and any(opts[o] for o in opts): | |
495 | matches = topicmatch(ui, name) |
|
497 | matches = topicmatch(ui, name or '') | |
496 | helpareas = [] |
|
498 | helpareas = [] | |
497 | if opts.get('extension'): |
|
499 | if opts.get('extension'): | |
498 | helpareas += [('extensions', _('Extensions'))] |
|
500 | helpareas += [('extensions', _('Extensions'))] | |
@@ -539,6 +541,6 b' def help_(ui, name, unknowncmd=False, fu' | |||||
539 | # program name |
|
541 | # program name | |
540 | if not ui.quiet: |
|
542 | if not ui.quiet: | |
541 | rst = [_("Mercurial Distributed SCM\n"), '\n'] |
|
543 | rst = [_("Mercurial Distributed SCM\n"), '\n'] | |
542 | rst.extend(helplist()) |
|
544 | rst.extend(helplist(None, **opts)) | |
543 |
|
545 | |||
544 | return ''.join(rst) |
|
546 | return ''.join(rst) |
@@ -1043,16 +1043,25 b' Test help hooks' | |||||
1043 |
|
1043 | |||
1044 | help -c should only show debug --debug |
|
1044 | help -c should only show debug --debug | |
1045 |
|
1045 | |||
1046 | $ hg help -c --debug|grep debug|wc -l|grep '^\s*0\s*$' |
|
1046 | $ hg help -c --debug|egrep debug|wc -l|egrep '^\s*0\s*$' | |
1047 | [1] |
|
1047 | [1] | |
1048 |
|
1048 | |||
1049 | help -c should only show deprecated for -v |
|
1049 | help -c should only show deprecated for -v | |
1050 |
|
1050 | |||
1051 | $ hg help -c -v|grep DEPRECATED|wc -l|grep '^\s*0\s*$' |
|
1051 | $ hg help -c -v|egrep DEPRECATED|wc -l|egrep '^\s*0\s*$' | |
1052 | [1] |
|
1052 | [1] | |
1053 |
|
1053 | |||
1054 | Test -e / -c / -k combinations |
|
1054 | Test -e / -c / -k combinations | |
1055 |
|
1055 | |||
|
1056 | $ hg help -c|egrep '^\S|debug' | |||
|
1057 | Commands: | |||
|
1058 | $ hg help -e|egrep '^\S' | |||
|
1059 | Extensions: | |||
|
1060 | $ hg help -k|egrep '^\S' | |||
|
1061 | Topics: | |||
|
1062 | Commands: | |||
|
1063 | Extensions: | |||
|
1064 | Extension Commands: | |||
1056 | $ hg help -c schemes |
|
1065 | $ hg help -c schemes | |
1057 | abort: no such help topic: schemes |
|
1066 | abort: no such help topic: schemes | |
1058 | (try "hg help --keyword schemes") |
|
1067 | (try "hg help --keyword schemes") |
General Comments 0
You need to be logged in to leave comments.
Login now