##// END OF EJS Templates
help: suggest keyword search when no topic is found...
Pierre-Yves David -
r21289:c3784e3c default
parent child Browse files
Show More
@@ -486,7 +486,6 b' def help_(ui, name, unknowncmd=False, fu'
486 hint = _('try "hg help" for a list of topics')
486 hint = _('try "hg help" for a list of topics')
487 raise util.Abort(msg, hint=hint)
487 raise util.Abort(msg, hint=hint)
488 elif name and name != 'shortlist':
488 elif name and name != 'shortlist':
489 i = None
490 if unknowncmd:
489 if unknowncmd:
491 queries = (helpextcmd,)
490 queries = (helpextcmd,)
492 elif opts.get('extension'):
491 elif opts.get('extension'):
@@ -498,12 +497,16 b' def help_(ui, name, unknowncmd=False, fu'
498 for f in queries:
497 for f in queries:
499 try:
498 try:
500 rst = f(name)
499 rst = f(name)
501 i = None
502 break
500 break
503 except error.UnknownCommand, inst:
501 except error.UnknownCommand:
504 i = inst
502 pass
505 if i:
503 else:
506 raise i
504 if unknowncmd:
505 raise error.UnknownCommand(name)
506 else:
507 msg = _('no such help topic: %s') % name
508 hint = _('try "hg help --keyword %s"') % name
509 raise util.Abort(msg, hint=hint)
507 else:
510 else:
508 # program name
511 # program name
509 if not ui.quiet:
512 if not ui.quiet:
@@ -621,8 +621,8 b' Broken disabled extension and command:'
621 > EOF
621 > EOF
622 $ hg --config extensions.path=./path.py help foo > /dev/null
622 $ hg --config extensions.path=./path.py help foo > /dev/null
623 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
623 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
624 hg: unknown command 'foo'
624 abort: no such help topic: foo
625 warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
625 (try "hg help --keyword foo")
626 [255]
626 [255]
627
627
628 $ cat > throw.py <<EOF
628 $ cat > throw.py <<EOF
@@ -596,30 +596,8 b' Test command without options'
596 show changed files in the working directory
596 show changed files in the working directory
597
597
598 $ hg help foo
598 $ hg help foo
599 hg: unknown command 'foo'
599 abort: no such help topic: foo
600 Mercurial Distributed SCM
600 (try "hg help --keyword foo")
601
602 basic commands:
603
604 add add the specified files on the next commit
605 annotate show changeset information by line for each file
606 clone make a copy of an existing repository
607 commit commit the specified files or all outstanding changes
608 diff diff repository (or selected files)
609 export dump the header and diffs for one or more changesets
610 forget forget the specified files on the next commit
611 init create a new repository in the given directory
612 log show revision history of entire repository or files
613 merge merge working directory with another revision
614 pull pull changes from the specified source
615 push push changes to the specified destination
616 remove remove the specified files on the next commit
617 serve start stand-alone webserver
618 status show changed files in the working directory
619 summary summarize working directory state
620 update update working directory (or switch revisions)
621
622 use "hg help" for the full list of commands or "hg -v" for details
623 [255]
601 [255]
624
602
625 $ hg skjdfks
603 $ hg skjdfks
@@ -988,6 +966,13 b' Test keyword search help'
988
966
989 qclone clone main and patch repository at same time
967 qclone clone main and patch repository at same time
990
968
969 Test unfound topic
970
971 $ hg help nonexistingtopicthatwillneverexisteverever
972 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
973 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
974 [255]
975
991 Test unfound keyword
976 Test unfound keyword
992
977
993 $ hg help --keyword nonexistingwordthatwillneverexisteverever
978 $ hg help --keyword nonexistingwordthatwillneverexisteverever
General Comments 0
You need to be logged in to leave comments. Login now