dispatch: parse local hgrc for paths
authorMatt Mackall <mpm@selenic.com>
Thu, 21 Jun 2007 13:09:00 -0500
changeset 4670 850950e59b52
parent 4669 96e096fe9e86
child 4671 150afe6becf6
dispatch: parse local hgrc for paths
mercurial/cmdutil.py
--- 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')