# HG changeset patch # User Matt Mackall # Date 1182449340 18000 # Node ID 850950e59b52fb30a1d359639b24108ac0185e59 # Parent 96e096fe9e86dc0ac56b4b0d3fdf52f98e36a95a dispatch: parse local hgrc for paths diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -262,11 +262,9 @@ def dispatch(ui, args): os.chdir(cwd) # read the local repository .hgrc into a local ui object - # this will trigger its extensions to load - path = earlygetopt(["-R", "--repository", "--repo"], args) + path = findrepo() or "" if not path: - path = findrepo() or "" - lui = ui + lui = ui if path: try: lui = commands.ui.ui(parentui=ui) @@ -274,6 +272,13 @@ def dispatch(ui, args): except IOError: pass + # now we can expand paths, even ones in .hg/hgrc + rpath = earlygetopt(["-R", "--repository", "--repo"], args) + if rpath: + path = lui.expandpath(rpath) + lui = commands.ui.ui(parentui=ui) + lui.readconfig(os.path.join(path, ".hg", "hgrc")) + extensions.loadall(lui) # check for fallback encoding fallback = lui.config('ui', 'fallbackencoding')