Patchwork [5,of,6] alias: show one-line hint for command provided by disabled extension

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 14, 2014, 2:31 a.m.
Message ID <316511c7a08fbb84f8c6.1407983487@mimosa>
Download mbox | patch
Permalink /patch/5391/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 14, 2014, 2:31 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1407935908 -32400
#      Wed Aug 13 22:18:28 2014 +0900
# Node ID 316511c7a08fbb84f8c6155832dc695e2ae8bb9e
# Parent  ed528eaade5d3de13652d54fc1d650ec0f26fa62
alias: show one-line hint for command provided by disabled extension

It will be a hint of Abort exception.  "hg help <alias>" provides the detailed
version as before.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -429,7 +429,9 @@  class cmdalias(object):
             if self.unknowncmd:
                 try:
                     # check if the command is in a disabled extension
-                    commands.help_(ui, self.cmdname, unknowncmd=True)
+                    cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2]
+                    ui.warn(_("'%s' is provided by '%s' extension\n")
+                            % (cmd, ext))
                 except error.UnknownCommand:
                     pass
             return -1
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -89,11 +89,7 @@  disabled
 
   $ hg disabled
   alias 'disabled' resolves to unknown command 'email'
-  'email' is provided by the following extension:
-  
-      patchbomb     command to send changesets as (a series of) patch emails
-  
-  (use "hg help extensions" for information on enabling extensions)
+  'email' is provided by 'patchbomb' extension
   [255]
   $ hg help disabled
   alias 'disabled' resolves to unknown command 'email'