Mercurial > hg-stable
changeset 14886:9a3831d64ae2
dispatch: move shell alias handling after early arg handling
--cwd, --repo, and --config obviously should be handled first
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 15 Jul 2011 16:06:53 -0500 |
parents | 50b67d5c4073 |
children | d6ba373c9a8f |
files | mercurial/dispatch.py tests/test-alias.t |
diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Fri Jul 15 14:27:16 2011 -0500 +++ b/mercurial/dispatch.py Fri Jul 15 16:06:53 2011 -0500 @@ -526,10 +526,6 @@ args = req.args ui = req.ui - shellaliasfn = _checkshellalias(ui, args) - if shellaliasfn: - return shellaliasfn() - # read --config before doing anything else # (e.g. to change trust settings for reading .hg/hgrc) cfgs = _parseconfig(ui, _earlygetopt(['--config'], args)) @@ -542,6 +538,12 @@ rpath = _earlygetopt(["-R", "--repository", "--repo"], args) path, lui = _getlocal(ui, rpath) + # Now that we're operating in the right directory/repository with + # the right config settings, check for shell aliases + shellaliasfn = _checkshellalias(ui, args) + if shellaliasfn: + return shellaliasfn() + # Configure extensions in phases: uisetup, extsetup, cmdtable, and # reposetup. Programs like TortoiseHg will call _dispatch several # times so we keep track of configured extensions in _loaded.
--- a/tests/test-alias.t Fri Jul 15 14:27:16 2011 -0500 +++ b/tests/test-alias.t Fri Jul 15 16:06:53 2011 -0500 @@ -251,7 +251,7 @@ $ hg --cwd .. count 'branch(default)' 2 $ hg echo --cwd .. - --cwd .. + repo specific shell aliases @@ -274,8 +274,6 @@ hg: unknown command 'subalias' [255] $ hg -R .. subalias > /dev/null - hg: unknown command 'subalias' - [255] shell alias defined in other repo @@ -284,6 +282,7 @@ hg: unknown command 'mainalias' [255] $ hg -R .. mainalias + warning: --repository ignored main $ hg --cwd .. mainalias main