##// END OF EJS Templates
merge with stable
Augie Fackler -
r22378:c828b61e merge default
parent child Browse files
Show More
@@ -636,7 +636,12 b' def _getlocal(ui, rpath):'
636
636
637 return path, lui
637 return path, lui
638
638
639 def _checkshellalias(lui, ui, args):
639 def _checkshellalias(lui, ui, args, precheck=True):
640 """Return the function to run the shell alias, if it is required
641
642 'precheck' is whether this function is invoked before adding
643 aliases or not.
644 """
640 options = {}
645 options = {}
641
646
642 try:
647 try:
@@ -647,18 +652,24 b' def _checkshellalias(lui, ui, args):'
647 if not args:
652 if not args:
648 return
653 return
649
654
650 norepo = commands.norepo
655 if precheck:
651 optionalrepo = commands.optionalrepo
656 strict = True
652 def restorecommands():
657 norepo = commands.norepo
653 commands.norepo = norepo
658 optionalrepo = commands.optionalrepo
654 commands.optionalrepo = optionalrepo
659 def restorecommands():
655
660 commands.norepo = norepo
656 cmdtable = commands.table.copy()
661 commands.optionalrepo = optionalrepo
657 addaliases(lui, cmdtable)
662 cmdtable = commands.table.copy()
663 addaliases(lui, cmdtable)
664 else:
665 strict = False
666 def restorecommands():
667 pass
668 cmdtable = commands.table
658
669
659 cmd = args[0]
670 cmd = args[0]
660 try:
671 try:
661 aliases, entry = cmdutil.findcmd(cmd, cmdtable)
672 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
662 except (error.AmbiguousCommand, error.UnknownCommand):
673 except (error.AmbiguousCommand, error.UnknownCommand):
663 restorecommands()
674 restorecommands()
664 return
675 return
@@ -715,6 +726,14 b' def _dispatch(req):'
715
726
716 addaliases(lui, commands.table)
727 addaliases(lui, commands.table)
717
728
729 if not lui.configbool("ui", "strict"):
730 # All aliases and commands are completely defined, now.
731 # Check abbreviation/ambiguity of shell alias again, because shell
732 # alias may cause failure of "_parse" (see issue4355)
733 shellaliasfn = _checkshellalias(lui, ui, args, precheck=False)
734 if shellaliasfn:
735 return shellaliasfn()
736
718 # check for fallback encoding
737 # check for fallback encoding
719 fallback = lui.config('ui', 'fallbackencoding')
738 fallback = lui.config('ui', 'fallbackencoding')
720 if fallback:
739 if fallback:
@@ -394,7 +394,7 b' command provided extension, should be ab'
394 > [extensions]
394 > [extensions]
395 > hgext.rebase =
395 > hgext.rebase =
396 > [alias]
396 > [alias]
397 > rebate = !echo this is rebate
397 > rebate = !echo this is \$HG_ARGS
398 > EOF
398 > EOF
399 $ hg reba
399 $ hg reba
400 hg: command 'reba' is ambiguous:
400 hg: command 'reba' is ambiguous:
@@ -402,6 +402,8 b' command provided extension, should be ab'
402 [255]
402 [255]
403 $ hg rebat
403 $ hg rebat
404 this is rebate
404 this is rebate
405 $ hg rebat --foo-bar
406 this is rebate --foo-bar
405
407
406 invalid arguments
408 invalid arguments
407
409
General Comments 0
You need to be logged in to leave comments. Login now