diff tests/test-alias.t @ 22377:f98abe3146b2 stable

dispatch: check shell alias again after loading extensions (issue4355) Before this patch, the shell alias causes failure when it takes its specific (= unknown for "hg") options in the command line, because "_parse()" can't accept them. This is the regression introduced by 03d345da0579. It fixed the issue that ambiguity between shell aliases and commands defined by extensions was ignored. But it also caused that ambiguous shell alias is handled in "_parse()" even if it takes specific options in the command line. To avoid such failure, this patch checks shell alias again after loading extensions. All aliases and commands (including ones defined by extensions) are completely defined before the 2nd (= newly added in this patch) "_checkshellalias()" invocation, and "cmdutil.findcmd(strict=False)" can detect ambiguity between them correctly. For efficiency, this patch does: - omit the 2nd "_checkshellalias()" invocation if "[ui] strict= True" it causes "cmdutil.findcmd(strict=True)", of which result should be equal to one of the 1st invocation before adding aliases - avoid removing the 1st "_checkshellalias()" invocation it causes "cmdutil.findcmd(strict=True)" invocation preventing shell alias execution from loading extensions uselessly
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Wed, 10 Sep 2014 00:41:44 +0900
parents 6c9b7712ac69
children c828b61e0635
line wrap: on
line diff
--- a/tests/test-alias.t	Wed Sep 10 00:41:44 2014 +0900
+++ b/tests/test-alias.t	Wed Sep 10 00:41:44 2014 +0900
@@ -353,7 +353,7 @@
   > [extensions]
   > hgext.rebase =
   > [alias]
-  > rebate = !echo this is rebate
+  > rebate = !echo this is \$HG_ARGS
   > EOF
   $ hg reba
   hg: command 'reba' is ambiguous:
@@ -361,6 +361,8 @@
   [255]
   $ hg rebat
   this is rebate
+  $ hg rebat --foo-bar
+  this is rebate --foo-bar
 
 invalid arguments