# HG changeset patch # User Martin von Zweigbergk # Date 1532452927 25200 # Node ID 5199c5b6fd2989ac50d53c11ac43f0402ce7c31c # Parent 28d8b5f49b4d4eb8782753726a5782658c081314 dispatch: don't show list of commands on bogus command If a command is ambiguous, you get this: $ hg ve hg: command 've' is ambiguous: verify version [255] If you typo a command, you get this: $ hg comit hg: unknown command 'comit' (did you mean one of commit, incoming, mycommit?) [255] But if you completely mistype a command so it no longer looks like any existing commands, you get a full list of commands. That might be useful the first time you use Mercurial, but after that it's probably more annoying than help, especially if you have the pager enabled and have a short terminal. Let's instead give a short hint telling the user to run `hg help` for more help. Differential Revision: https://phab.mercurial-scm.org/D4024 diff -r 28d8b5f49b4d -r 5199c5b6fd29 mercurial/dispatch.py --- a/mercurial/dispatch.py Tue Jul 24 22:51:11 2018 -0700 +++ b/mercurial/dispatch.py Tue Jul 24 10:22:07 2018 -0700 @@ -394,9 +394,8 @@ _reportsimilar(ui.warn, sim) suggested = True if not suggested: - ui.pager('help') ui.warn(nocmdmsg) - commands.help_(ui, 'shortlist') + ui.warn(_("(use 'hg help' for a list of commands)\n")) except IOError: raise except KeyboardInterrupt: diff -r 28d8b5f49b4d -r 5199c5b6fd29 tests/test-extension.t --- a/tests/test-extension.t Tue Jul 24 22:51:11 2018 -0700 +++ b/tests/test-extension.t Tue Jul 24 10:22:07 2018 -0700 @@ -1683,6 +1683,7 @@ *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo *** (use @command decorator to register 'deprecatedcmd') hg: unknown command 'deprecatedcmd' + (use 'hg help' for a list of commands) [255] the extension shouldn't be loaded at all so the mq works: diff -r 28d8b5f49b4d -r 5199c5b6fd29 tests/test-help.t --- a/tests/test-help.t Tue Jul 24 22:51:11 2018 -0700 +++ b/tests/test-help.t Tue Jul 24 10:22:07 2018 -0700 @@ -652,29 +652,7 @@ $ hg skjdfks hg: unknown command 'skjdfks' - Mercurial Distributed SCM - - basic commands: - - add add the specified files on the next commit - annotate show changeset information by line for each file - clone make a copy of an existing repository - commit commit the specified files or all outstanding changes - diff diff repository (or selected files) - export dump the header and diffs for one or more changesets - forget forget the specified files on the next commit - init create a new repository in the given directory - log show revision history of entire repository or files - merge merge another revision into working directory - pull pull changes from the specified source - push push changes to the specified destination - remove remove the specified files on the next commit - serve start stand-alone webserver - status show changed files in the working directory - summary summarize working directory state - update update working directory (or switch revisions) - - (use 'hg help' for the full list of commands or 'hg -v' for details) + (use 'hg help' for a list of commands) [255] Typoed command gives suggestion diff -r 28d8b5f49b4d -r 5199c5b6fd29 tests/test-status-color.t --- a/tests/test-status-color.t Tue Jul 24 22:51:11 2018 -0700 +++ b/tests/test-status-color.t Tue Jul 24 10:22:07 2018 -0700 @@ -393,6 +393,7 @@ $ hg unknowncommand > /dev/null hg: unknown command 'unknowncommand' + (use 'hg help' for a list of commands) [255] color coding of error message without curses @@ -400,6 +401,7 @@ $ echo 'raise ImportError' > curses.py $ PYTHONPATH=`pwd`:$PYTHONPATH hg unknowncommand > /dev/null hg: unknown command 'unknowncommand' + (use 'hg help' for a list of commands) [255] $ cd .. diff -r 28d8b5f49b4d -r 5199c5b6fd29 tests/test-strict.t --- a/tests/test-strict.t Tue Jul 24 22:51:11 2018 -0700 +++ b/tests/test-strict.t Tue Jul 24 10:22:07 2018 -0700 @@ -15,29 +15,7 @@ $ hg an a hg: unknown command 'an' - Mercurial Distributed SCM - - basic commands: - - add add the specified files on the next commit - annotate show changeset information by line for each file - clone make a copy of an existing repository - commit commit the specified files or all outstanding changes - diff diff repository (or selected files) - export dump the header and diffs for one or more changesets - forget forget the specified files on the next commit - init create a new repository in the given directory - log show revision history of entire repository or files - merge merge another revision into working directory - pull pull changes from the specified source - push push changes to the specified destination - remove remove the specified files on the next commit - serve start stand-alone webserver - status show changed files in the working directory - summary summarize working directory state - update update working directory (or switch revisions) - - (use 'hg help' for the full list of commands or 'hg -v' for details) + (use 'hg help' for a list of commands) [255] $ hg annotate a 0: a