##// 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 return path, lui
671 return path, lui
672
672
673 def _checkshellalias(lui, ui, args, precheck=True):
673 def _checkshellalias(lui, ui, args):
674 """Return the function to run the shell alias, if it is required
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 """
679 options = {}
675 options = {}
680
676
681 try:
677 try:
@@ -686,16 +682,11 b' def _checkshellalias(lui, ui, args, prec'
686 if not args:
682 if not args:
687 return
683 return
688
684
689 if precheck:
685 cmdtable = commands.table
690 strict = True
691 cmdtable = commands.table.copy()
692 addaliases(lui, cmdtable)
693 else:
694 strict = False
695 cmdtable = commands.table
696
686
697 cmd = args[0]
687 cmd = args[0]
698 try:
688 try:
689 strict = ui.configbool("ui", "strict")
699 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
690 aliases, entry = cmdutil.findcmd(cmd, cmdtable, strict)
700 except (error.AmbiguousCommand, error.UnknownCommand):
691 except (error.AmbiguousCommand, error.UnknownCommand):
701 return
692 return
@@ -745,12 +736,6 b' def _dispatch(req):'
745 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
736 rpath = _earlygetopt(["-R", "--repository", "--repo"], args)
746 path, lui = _getlocal(ui, rpath)
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 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
739 # Configure extensions in phases: uisetup, extsetup, cmdtable, and
755 # reposetup. Programs like TortoiseHg will call _dispatch several
740 # reposetup. Programs like TortoiseHg will call _dispatch several
756 # times so we keep track of configured extensions in _loaded.
741 # times so we keep track of configured extensions in _loaded.
@@ -772,13 +757,11 b' def _dispatch(req):'
772
757
773 addaliases(lui, commands.table)
758 addaliases(lui, commands.table)
774
759
775 if not lui.configbool("ui", "strict"):
760 # All aliases and commands are completely defined, now.
776 # All aliases and commands are completely defined, now.
761 # Check abbreviation/ambiguity of shell alias.
777 # Check abbreviation/ambiguity of shell alias again, because shell
762 shellaliasfn = _checkshellalias(lui, ui, args)
778 # alias may cause failure of "_parse" (see issue4355)
763 if shellaliasfn:
779 shellaliasfn = _checkshellalias(lui, ui, args, precheck=False)
764 return shellaliasfn()
780 if shellaliasfn:
781 return shellaliasfn()
782
765
783 # check for fallback encoding
766 # check for fallback encoding
784 fallback = lui.config('ui', 'fallbackencoding')
767 fallback = lui.config('ui', 'fallbackencoding')
@@ -177,3 +177,15 b' even though stdout is no longer a tty.'
177 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
177 paged! 'date: Thu Jan 01 00:00:00 1970 +0000\n'
178 paged! 'summary: modify a 8\n'
178 paged! 'summary: modify a 8\n'
179 paged! '\n'
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