Show More
@@ -470,14 +470,17 b' def _callcatch(ui, func):' | |||||
470 | config parsing and commands. besides, use handlecommandexception to handle |
|
470 | config parsing and commands. besides, use handlecommandexception to handle | |
471 | uncaught exceptions. |
|
471 | uncaught exceptions. | |
472 | """ |
|
472 | """ | |
|
473 | detailed_exit_code = -1 | |||
473 | try: |
|
474 | try: | |
474 | return scmutil.callcatch(ui, func) |
|
475 | return scmutil.callcatch(ui, func) | |
475 | except error.AmbiguousCommand as inst: |
|
476 | except error.AmbiguousCommand as inst: | |
|
477 | detailed_exit_code = 10 | |||
476 | ui.warn( |
|
478 | ui.warn( | |
477 | _(b"hg: command '%s' is ambiguous:\n %s\n") |
|
479 | _(b"hg: command '%s' is ambiguous:\n %s\n") | |
478 | % (inst.prefix, b" ".join(inst.matches)) |
|
480 | % (inst.prefix, b" ".join(inst.matches)) | |
479 | ) |
|
481 | ) | |
480 | except error.CommandError as inst: |
|
482 | except error.CommandError as inst: | |
|
483 | detailed_exit_code = 10 | |||
481 | if inst.command: |
|
484 | if inst.command: | |
482 | ui.pager(b'help') |
|
485 | ui.pager(b'help') | |
483 | msgbytes = pycompat.bytestr(inst.message) |
|
486 | msgbytes = pycompat.bytestr(inst.message) | |
@@ -487,6 +490,7 b' def _callcatch(ui, func):' | |||||
487 | ui.warn(_(b"hg: %s\n") % inst.message) |
|
490 | ui.warn(_(b"hg: %s\n") % inst.message) | |
488 | ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) |
|
491 | ui.warn(_(b"(use 'hg help -v' for a list of global options)\n")) | |
489 | except error.UnknownCommand as inst: |
|
492 | except error.UnknownCommand as inst: | |
|
493 | detailed_exit_code = 10 | |||
490 | nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.command |
|
494 | nocmdmsg = _(b"hg: unknown command '%s'\n") % inst.command | |
491 | try: |
|
495 | try: | |
492 | # check if the command is in a disabled extension |
|
496 | # check if the command is in a disabled extension | |
@@ -515,7 +519,10 b' def _callcatch(ui, func):' | |||||
515 | if not handlecommandexception(ui): |
|
519 | if not handlecommandexception(ui): | |
516 | raise |
|
520 | raise | |
517 |
|
521 | |||
518 | return -1 |
|
522 | if ui.configbool(b'ui', b'detailed-exit-code'): | |
|
523 | return detailed_exit_code | |||
|
524 | else: | |||
|
525 | return -1 | |||
519 |
|
526 | |||
520 |
|
527 | |||
521 | def aliasargs(fn, givenargs): |
|
528 | def aliasargs(fn, givenargs): |
@@ -468,13 +468,13 b' shadowing' | |||||
468 | $ hg i |
|
468 | $ hg i | |
469 | hg: command 'i' is ambiguous: |
|
469 | hg: command 'i' is ambiguous: | |
470 | idalias idaliaslong idaliasshell identify import incoming init |
|
470 | idalias idaliaslong idaliasshell identify import incoming init | |
471 |
[ |
|
471 | [10] | |
472 | $ hg id |
|
472 | $ hg id | |
473 | 042423737847 tip |
|
473 | 042423737847 tip | |
474 | $ hg ida |
|
474 | $ hg ida | |
475 | hg: command 'ida' is ambiguous: |
|
475 | hg: command 'ida' is ambiguous: | |
476 | idalias idaliaslong idaliasshell |
|
476 | idalias idaliaslong idaliasshell | |
477 |
[ |
|
477 | [10] | |
478 | $ hg idalias |
|
478 | $ hg idalias | |
479 | 042423737847 tip |
|
479 | 042423737847 tip | |
480 | $ hg idaliasl |
|
480 | $ hg idaliasl | |
@@ -484,7 +484,7 b' shadowing' | |||||
484 | $ hg parentsshell |
|
484 | $ hg parentsshell | |
485 | hg: command 'parentsshell' is ambiguous: |
|
485 | hg: command 'parentsshell' is ambiguous: | |
486 | parentsshell1 parentsshell2 |
|
486 | parentsshell1 parentsshell2 | |
487 |
[ |
|
487 | [10] | |
488 | $ hg parentsshell1 |
|
488 | $ hg parentsshell1 | |
489 | one |
|
489 | one | |
490 | $ hg parentsshell2 |
|
490 | $ hg parentsshell2 | |
@@ -533,11 +533,11 b' shell alias defined in current repo' | |||||
533 | $ hg --cwd .. subalias > /dev/null |
|
533 | $ hg --cwd .. subalias > /dev/null | |
534 | hg: unknown command 'subalias' |
|
534 | hg: unknown command 'subalias' | |
535 | (did you mean idalias?) |
|
535 | (did you mean idalias?) | |
536 |
[ |
|
536 | [10] | |
537 | $ hg -R .. subalias > /dev/null |
|
537 | $ hg -R .. subalias > /dev/null | |
538 | hg: unknown command 'subalias' |
|
538 | hg: unknown command 'subalias' | |
539 | (did you mean idalias?) |
|
539 | (did you mean idalias?) | |
540 |
[ |
|
540 | [10] | |
541 |
|
541 | |||
542 |
|
542 | |||
543 | shell alias defined in other repo |
|
543 | shell alias defined in other repo | |
@@ -545,7 +545,7 b' shell alias defined in other repo' | |||||
545 | $ hg mainalias > /dev/null |
|
545 | $ hg mainalias > /dev/null | |
546 | hg: unknown command 'mainalias' |
|
546 | hg: unknown command 'mainalias' | |
547 | (did you mean idalias?) |
|
547 | (did you mean idalias?) | |
548 |
[ |
|
548 | [10] | |
549 | $ hg -R .. mainalias |
|
549 | $ hg -R .. mainalias | |
550 | main |
|
550 | main | |
551 | $ hg --cwd .. mainalias |
|
551 | $ hg --cwd .. mainalias | |
@@ -555,7 +555,7 b' typos get useful suggestions' | |||||
555 | $ hg --cwd .. manalias |
|
555 | $ hg --cwd .. manalias | |
556 | hg: unknown command 'manalias' |
|
556 | hg: unknown command 'manalias' | |
557 | (did you mean one of idalias, mainalias, manifest?) |
|
557 | (did you mean one of idalias, mainalias, manifest?) | |
558 |
[ |
|
558 | [10] | |
559 |
|
559 | |||
560 | shell aliases with escaped $ chars |
|
560 | shell aliases with escaped $ chars | |
561 |
|
561 | |||
@@ -593,7 +593,7 b' command provided extension, should be ab' | |||||
593 | $ hg reba |
|
593 | $ hg reba | |
594 | hg: command 'reba' is ambiguous: |
|
594 | hg: command 'reba' is ambiguous: | |
595 | rebase rebate |
|
595 | rebase rebate | |
596 |
[ |
|
596 | [10] | |
597 | $ hg rebat |
|
597 | $ hg rebat | |
598 | this is rebate |
|
598 | this is rebate | |
599 | $ hg rebat --foo-bar |
|
599 | $ hg rebat --foo-bar | |
@@ -650,22 +650,22 b' invalid arguments' | |||||
650 | -T --template TEMPLATE display with template |
|
650 | -T --template TEMPLATE display with template | |
651 |
|
651 | |||
652 | (use 'hg rt -h' to show more help) |
|
652 | (use 'hg rt -h' to show more help) | |
653 |
[ |
|
653 | [10] | |
654 |
|
654 | |||
655 | invalid global arguments for normal commands, aliases, and shell aliases |
|
655 | invalid global arguments for normal commands, aliases, and shell aliases | |
656 |
|
656 | |||
657 | $ hg --invalid root |
|
657 | $ hg --invalid root | |
658 | hg: option --invalid not recognized |
|
658 | hg: option --invalid not recognized | |
659 | (use 'hg help -v' for a list of global options) |
|
659 | (use 'hg help -v' for a list of global options) | |
660 |
[ |
|
660 | [10] | |
661 | $ hg --invalid mylog |
|
661 | $ hg --invalid mylog | |
662 | hg: option --invalid not recognized |
|
662 | hg: option --invalid not recognized | |
663 | (use 'hg help -v' for a list of global options) |
|
663 | (use 'hg help -v' for a list of global options) | |
664 |
[ |
|
664 | [10] | |
665 | $ hg --invalid blank |
|
665 | $ hg --invalid blank | |
666 | hg: option --invalid not recognized |
|
666 | hg: option --invalid not recognized | |
667 | (use 'hg help -v' for a list of global options) |
|
667 | (use 'hg help -v' for a list of global options) | |
668 |
[ |
|
668 | [10] | |
669 |
|
669 | |||
670 | environment variable changes in alias commands |
|
670 | environment variable changes in alias commands | |
671 |
|
671 |
@@ -67,12 +67,12 b' On Python 3, stdio may be None:' | |||||
67 | $ hg unknown -q 1>&- |
|
67 | $ hg unknown -q 1>&- | |
68 | hg: unknown command 'unknown' |
|
68 | hg: unknown command 'unknown' | |
69 | (did you mean debugknown?) |
|
69 | (did you mean debugknown?) | |
70 |
[ |
|
70 | [10] | |
71 |
|
71 | |||
72 | $ hg version -q 2>&- |
|
72 | $ hg version -q 2>&- | |
73 | Mercurial Distributed SCM * (glob) |
|
73 | Mercurial Distributed SCM * (glob) | |
74 | $ hg unknown -q 2>&- |
|
74 | $ hg unknown -q 2>&- | |
75 |
[ |
|
75 | [10] | |
76 |
|
76 | |||
77 | $ hg commit -m test |
|
77 | $ hg commit -m test | |
78 |
|
78 |
@@ -242,7 +242,7 b' Show an error if we use --options with a' | |||||
242 | $ hg debugcomplete --options s |
|
242 | $ hg debugcomplete --options s | |
243 | hg: command 's' is ambiguous: |
|
243 | hg: command 's' is ambiguous: | |
244 | serve shelve showconfig status summary |
|
244 | serve shelve showconfig status summary | |
245 |
[ |
|
245 | [10] | |
246 |
|
246 | |||
247 | Show all commands + options |
|
247 | Show all commands + options | |
248 | $ hg debugcommands |
|
248 | $ hg debugcommands |
@@ -29,7 +29,7 b' Missing arg:' | |||||
29 | -T --template TEMPLATE display with template |
|
29 | -T --template TEMPLATE display with template | |
30 |
|
30 | |||
31 | (use 'hg cat -h' to show more help) |
|
31 | (use 'hg cat -h' to show more help) | |
32 |
[ |
|
32 | [10] | |
33 |
|
33 | |||
34 | Missing parameter for early option: |
|
34 | Missing parameter for early option: | |
35 |
|
35 | |||
@@ -110,7 +110,7 b' applied before the command name is resol' | |||||
110 | hg log: option -b not recognized |
|
110 | hg log: option -b not recognized | |
111 | error in definition for alias 'log': --config may only be given on the command |
|
111 | error in definition for alias 'log': --config may only be given on the command | |
112 | line |
|
112 | line | |
113 |
[ |
|
113 | [10] | |
114 |
|
114 | |||
115 | $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false' |
|
115 | $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false' | |
116 | abort: option --config may not be abbreviated |
|
116 | abort: option --config may not be abbreviated |
@@ -1018,7 +1018,7 b' Test help topic with same name as extens' | |||||
1018 | multirevs command |
|
1018 | multirevs command | |
1019 |
|
1019 | |||
1020 | (use 'hg multirevs -h' to show more help) |
|
1020 | (use 'hg multirevs -h' to show more help) | |
1021 |
[ |
|
1021 | [10] | |
1022 |
|
1022 | |||
1023 |
|
1023 | |||
1024 |
|
1024 | |||
@@ -1848,7 +1848,7 b' Prohibit registration of commands that d' | |||||
1848 | *** (use @command decorator to register 'deprecatedcmd') |
|
1848 | *** (use @command decorator to register 'deprecatedcmd') | |
1849 | hg: unknown command 'deprecatedcmd' |
|
1849 | hg: unknown command 'deprecatedcmd' | |
1850 | (use 'hg help' for a list of commands) |
|
1850 | (use 'hg help' for a list of commands) | |
1851 |
[ |
|
1851 | [10] | |
1852 |
|
1852 | |||
1853 | the extension shouldn't be loaded at all so the mq works: |
|
1853 | the extension shouldn't be loaded at all so the mq works: | |
1854 |
|
1854 | |||
@@ -1905,4 +1905,4 b' Prohibit the use of unicode strings as t' | |||||
1905 | *** (use b'' to make it byte string) |
|
1905 | *** (use b'' to make it byte string) | |
1906 | hg: unknown command 'dummy' |
|
1906 | hg: unknown command 'dummy' | |
1907 | (did you mean summary?) |
|
1907 | (did you mean summary?) | |
1908 |
[ |
|
1908 | [10] |
@@ -123,7 +123,7 b' config option "fastannotate.modes"' | |||||
123 | $ hg fastannotate --config fastannotate.modes=fctx -h -q |
|
123 | $ hg fastannotate --config fastannotate.modes=fctx -h -q | |
124 | hg: unknown command 'fastannotate' |
|
124 | hg: unknown command 'fastannotate' | |
125 | (did you mean *) (glob) |
|
125 | (did you mean *) (glob) | |
126 |
[ |
|
126 | [10] | |
127 |
|
127 | |||
128 | rename |
|
128 | rename | |
129 |
|
129 |
@@ -593,7 +593,7 b' Test help option with version option' | |||||
593 | -n --dry-run do not perform actions, just print output |
|
593 | -n --dry-run do not perform actions, just print output | |
594 |
|
594 | |||
595 | (use 'hg add -h' to show more help) |
|
595 | (use 'hg add -h' to show more help) | |
596 |
[ |
|
596 | [10] | |
597 |
|
597 | |||
598 | Test ambiguous command help |
|
598 | Test ambiguous command help | |
599 |
|
599 | |||
@@ -763,13 +763,13 b' Test command without options' | |||||
763 | $ hg skjdfks |
|
763 | $ hg skjdfks | |
764 | hg: unknown command 'skjdfks' |
|
764 | hg: unknown command 'skjdfks' | |
765 | (use 'hg help' for a list of commands) |
|
765 | (use 'hg help' for a list of commands) | |
766 |
[ |
|
766 | [10] | |
767 |
|
767 | |||
768 | Typoed command gives suggestion |
|
768 | Typoed command gives suggestion | |
769 | $ hg puls |
|
769 | $ hg puls | |
770 | hg: unknown command 'puls' |
|
770 | hg: unknown command 'puls' | |
771 | (did you mean one of pull, push?) |
|
771 | (did you mean one of pull, push?) | |
772 |
[ |
|
772 | [10] | |
773 |
|
773 | |||
774 | Not enabled extension gets suggested |
|
774 | Not enabled extension gets suggested | |
775 |
|
775 | |||
@@ -780,7 +780,7 b' Not enabled extension gets suggested' | |||||
780 | rebase command to move sets of revisions to a different ancestor |
|
780 | rebase command to move sets of revisions to a different ancestor | |
781 |
|
781 | |||
782 | (use 'hg help extensions' for information on enabling extensions) |
|
782 | (use 'hg help extensions' for information on enabling extensions) | |
783 |
[ |
|
783 | [10] | |
784 |
|
784 | |||
785 | Disabled extension gets suggested |
|
785 | Disabled extension gets suggested | |
786 | $ hg --config extensions.rebase=! rebase |
|
786 | $ hg --config extensions.rebase=! rebase | |
@@ -790,7 +790,7 b' Disabled extension gets suggested' | |||||
790 | rebase command to move sets of revisions to a different ancestor |
|
790 | rebase command to move sets of revisions to a different ancestor | |
791 |
|
791 | |||
792 | (use 'hg help extensions' for information on enabling extensions) |
|
792 | (use 'hg help extensions' for information on enabling extensions) | |
793 |
[ |
|
793 | [10] | |
794 |
|
794 | |||
795 | Checking that help adapts based on the config: |
|
795 | Checking that help adapts based on the config: | |
796 |
|
796 | |||
@@ -804,16 +804,16 b' this is a section and erroring out weird' | |||||
804 | $ hg .log |
|
804 | $ hg .log | |
805 | hg: unknown command '.log' |
|
805 | hg: unknown command '.log' | |
806 | (did you mean log?) |
|
806 | (did you mean log?) | |
807 |
[ |
|
807 | [10] | |
808 |
|
808 | |||
809 | $ hg log. |
|
809 | $ hg log. | |
810 | hg: unknown command 'log.' |
|
810 | hg: unknown command 'log.' | |
811 | (did you mean log?) |
|
811 | (did you mean log?) | |
812 |
[ |
|
812 | [10] | |
813 | $ hg pu.lh |
|
813 | $ hg pu.lh | |
814 | hg: unknown command 'pu.lh' |
|
814 | hg: unknown command 'pu.lh' | |
815 | (did you mean one of pull, push?) |
|
815 | (did you mean one of pull, push?) | |
816 |
[ |
|
816 | [10] | |
817 |
|
817 | |||
818 | $ cat > helpext.py <<EOF |
|
818 | $ cat > helpext.py <<EOF | |
819 | > import os |
|
819 | > import os |
@@ -118,7 +118,7 b' Testing the --import-rules flag of `hg t' | |||||
118 | web.cacerts config) |
|
118 | web.cacerts config) | |
119 |
|
119 | |||
120 | (use 'hg tracked -h' to show more help) |
|
120 | (use 'hg tracked -h' to show more help) | |
121 |
[ |
|
121 | [10] | |
122 | $ hg tracked --import-rules doesnotexist |
|
122 | $ hg tracked --import-rules doesnotexist | |
123 | abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$ |
|
123 | abort: cannot read narrowspecs from '$TESTTMP/narrow/doesnotexist': $ENOENT$ | |
124 | [50] |
|
124 | [50] |
@@ -105,7 +105,7 b' qrecord (mq not present)' | |||||
105 | interactively record a new patch |
|
105 | interactively record a new patch | |
106 |
|
106 | |||
107 | (use 'hg qrecord -h' to show more help) |
|
107 | (use 'hg qrecord -h' to show more help) | |
108 |
[ |
|
108 | [10] | |
109 |
|
109 | |||
110 | qrecord patch (mq not present) |
|
110 | qrecord patch (mq not present) | |
111 |
|
111 |
@@ -92,7 +92,7 b' Test that extensions of source repositor' | |||||
92 | extdiff command to allow external programs to compare revisions |
|
92 | extdiff command to allow external programs to compare revisions | |
93 |
|
93 | |||
94 | (use 'hg help extensions' for information on enabling extensions) |
|
94 | (use 'hg help extensions' for information on enabling extensions) | |
95 |
[ |
|
95 | [10] | |
96 |
|
96 | |||
97 | $ echo "[extensions]" >> ../source/.hg/hgrc |
|
97 | $ echo "[extensions]" >> ../source/.hg/hgrc | |
98 | $ echo "extdiff=" >> ../source/.hg/hgrc |
|
98 | $ echo "extdiff=" >> ../source/.hg/hgrc |
@@ -394,7 +394,7 b' color coding of error message with curre' | |||||
394 | $ hg unknowncommand > /dev/null |
|
394 | $ hg unknowncommand > /dev/null | |
395 | hg: unknown command 'unknowncommand' |
|
395 | hg: unknown command 'unknowncommand' | |
396 | (use 'hg help' for a list of commands) |
|
396 | (use 'hg help' for a list of commands) | |
397 |
[ |
|
397 | [10] | |
398 |
|
398 | |||
399 | color coding of error message without curses |
|
399 | color coding of error message without curses | |
400 |
|
400 | |||
@@ -402,6 +402,6 b' color coding of error message without cu' | |||||
402 | $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null |
|
402 | $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null | |
403 | hg: unknown command 'unknowncommand' |
|
403 | hg: unknown command 'unknowncommand' | |
404 | (use 'hg help' for a list of commands) |
|
404 | (use 'hg help' for a list of commands) | |
405 |
[ |
|
405 | [10] | |
406 |
|
406 | |||
407 | $ cd .. |
|
407 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now