##// 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 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 645 options = {}
641 646
642 647 try:
@@ -647,18 +652,24 b' def _checkshellalias(lui, ui, args):'
647 652 if not args:
648 653 return
649 654
650 norepo = commands.norepo
651 optionalrepo = commands.optionalrepo
652 def restorecommands():
653 commands.norepo = norepo
654 commands.optionalrepo = optionalrepo
655
656 cmdtable = commands.table.copy()
657 addaliases(lui, cmdtable)
655 if precheck:
656 strict = True
657 norepo = commands.norepo
658 optionalrepo = commands.optionalrepo
659 def restorecommands():
660 commands.norepo = norepo
661 commands.optionalrepo = optionalrepo
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 670 cmd = args[0]
660 671 try:
661 aliases, entry = cmdutil.findcmd(cmd, cmdtable)
672 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
662 673 except (error.AmbiguousCommand, error.UnknownCommand):
663 674 restorecommands()
664 675 return
@@ -715,6 +726,14 b' def _dispatch(req):'
715 726
716 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 737 # check for fallback encoding
719 738 fallback = lui.config('ui', 'fallbackencoding')
720 739 if fallback:
@@ -394,7 +394,7 b' command provided extension, should be ab'
394 394 > [extensions]
395 395 > hgext.rebase =
396 396 > [alias]
397 > rebate = !echo this is rebate
397 > rebate = !echo this is \$HG_ARGS
398 398 > EOF
399 399 $ hg reba
400 400 hg: command 'reba' is ambiguous:
@@ -402,6 +402,8 b' command provided extension, should be ab'
402 402 [255]
403 403 $ hg rebat
404 404 this is rebate
405 $ hg rebat --foo-bar
406 this is rebate --foo-bar
405 407
406 408 invalid arguments
407 409
General Comments 0
You need to be logged in to leave comments. Login now