changeset 4670:850950e59b52

dispatch: parse local hgrc for paths
author Matt Mackall <mpm@selenic.com>
date Thu, 21 Jun 2007 13:09:00 -0500
parents 96e096fe9e86
children 150afe6becf6
files mercurial/cmdutil.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Jun 21 19:38:44 2007 +0200
+++ b/mercurial/cmdutil.py	Thu Jun 21 13:09:00 2007 -0500
@@ -262,11 +262,9 @@
         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 @@
         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')