changeset 12637:42ca7aef28d3

dispatch: properly handle relative path aliases used with -R (issue2376) This ensures the repo config is read relative to the repo root during dispatch.
author Brodie Rao <brodie@bitheap.org>
date Mon, 04 Oct 2010 15:07:12 -0500
parents c24215aa7e69
children eb09e3c9c471
files mercurial/dispatch.py tests/test-globalopts.t
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Mon Oct 04 14:26:38 2010 -0500
+++ b/mercurial/dispatch.py	Mon Oct 04 15:07:12 2010 -0500
@@ -420,12 +420,12 @@
         lui = ui
     else:
         lui = ui.copy()
-        lui.readconfig(os.path.join(path, ".hg", "hgrc"))
+        lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
 
     if rpath:
         path = lui.expandpath(rpath[-1])
         lui = ui.copy()
-        lui.readconfig(os.path.join(path, ".hg", "hgrc"))
+        lui.readconfig(os.path.join(path, ".hg", "hgrc"), path)
 
     return path, lui
 
--- a/tests/test-globalopts.t	Mon Oct 04 14:26:38 2010 -0500
+++ b/tests/test-globalopts.t	Mon Oct 04 15:07:12 2010 -0500
@@ -20,6 +20,10 @@
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd c
+  $ cat >> .hg/hgrc <<EOF
+  > [paths]
+  > relative = ../a
+  > EOF
   $ hg pull -f ../b
   pulling from ../b
   searching for changes
@@ -59,11 +63,17 @@
   $ hg -R file://localhost/`pwd`/a/ identify
   8580ff50825a tip
 
--R with a path alias:
+-R with path aliases:
 
   $ cd c
   $ hg -R default identify
   8580ff50825a tip
+  $ hg -R relative identify
+  8580ff50825a tip
+  $ echo '[paths]' >> $HGRCPATH
+  $ echo 'relativetohome = a' >> $HGRCPATH
+  $ HOME=`pwd`/../ hg -R relativetohome identify
+  8580ff50825a tip
   $ cd ..
 
 Implicit -R: