##// END OF EJS Templates
dispatch: always load extensions before running shell aliases (issue5230)...
Jun Wu -
r29132:12769703 default
parent child Browse files
Show More
@@ -670,12 +670,8 b' def _getlocal(ui, rpath, wd=None):'
670 670
671 671 return path, lui
672 672
673 def _checkshellalias(lui, ui, args, precheck=True):
674 """Return the function to run the shell alias, if it is required
675
676 'precheck' is whether this function is invoked before adding
677 aliases or not.
678 """
673 def _checkshellalias(lui, ui, args):
674 """Return the function to run the shell alias, if it is required"""
679 675 options = {}
680 676
681 677 try:
@@ -686,16 +682,11 b' def _checkshellalias(lui, ui, args, prec'
686 682 if not args:
687 683 return
688 684
689 if precheck:
690 strict = True
691 cmdtable = commands.table.copy()
692 addaliases(lui, cmdtable)
693 else:
694 strict = False
695 cmdtable = commands.table
685 cmdtable = commands.table
696 686
697 687 cmd = args[0]
698 688 try:
689 strict = ui.configbool("ui", "strict")
699 690 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
700 691 except (error.AmbiguousCommand, error.UnknownCommand):
701 692 return
@@ -745,12 +736,6 b' def _dispatch(req):'
745 736 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
746 737 path, lui = _getlocal(ui, rpath)
747 738
748 # Now that we're operating in the right directory/repository with
749 # the right config settings, check for shell aliases
750 shellaliasfn = _checkshellalias(lui, ui, args)
751 if shellaliasfn:
752 return shellaliasfn()
753
754 739 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
755 740 # reposetup. Programs like TortoiseHg will call _dispatch several
756 741 # times so we keep track of configured extensions in _loaded.
@@ -772,13 +757,11 b' def _dispatch(req):'
772 757
773 758 addaliases(lui, commands.table)
774 759
775 if not lui.configbool("ui", "strict"):
776 # All aliases and commands are completely defined, now.
777 # Check abbreviation/ambiguity of shell alias again, because shell
778 # alias may cause failure of "_parse" (see issue4355)
779 shellaliasfn = _checkshellalias(lui, ui, args, precheck=False)
780 if shellaliasfn:
781 return shellaliasfn()
760 # All aliases and commands are completely defined, now.
761 # Check abbreviation/ambiguity of shell alias.
762 shellaliasfn = _checkshellalias(lui, ui, args)
763 if shellaliasfn:
764 return shellaliasfn()
782 765
783 766 # check for fallback encoding
784 767 fallback = lui.config('ui', 'fallbackencoding')
@@ -177,3 +177,15 b' even though stdout is no longer a tty.'
177 177 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
178 178 paged! 'summary: modify a 8\n'
179 179 paged! '\n'
180
181 Pager works with shell aliases.
182
183 $ cat >> $HGRCPATH <<EOF
184 > [alias]
185 > echoa = !echo a
186 > EOF
187
188 $ hg echoa
189 a
190 $ hg --config pager.attend-echoa=yes echoa
191 paged! 'a\n'
General Comments 0
You need to be logged in to leave comments. Login now