[PATCH] config: expand hgrc %include paths
Chad Dombrova
chadrik at gmail.com
Wed May 26 16:05:07 CDT 2010
# HG changeset patch
# User Chad Dombrova <chadrik at gmail.com>
# Date 1274907809 25200
# Branch stable
# Node ID 23b20efd76df212a8d1ac4b07e1493dfc576f9bf
# Parent e655b378ce735fd88ba68539e0c6ad4c403a190e
config: expand hgrc %include paths
diff -r e655b378ce73 -r 23b20efd76df mercurial/config.py
--- a/mercurial/config.py Tue May 25 18:19:40 2010 +0200
+++ b/mercurial/config.py Wed May 26 14:03:29 2010 -0700
@@ -6,7 +6,7 @@
# GNU General Public License version 2 or any later version.
from i18n import _
-import error
+import error, util
import re, os
class sortdict(dict):
@@ -96,7 +96,7 @@
cont = False
m = includere.match(l)
if m:
- inc = m.group(1)
+ inc = util.expandpath(m.group(1))
base = os.path.dirname(src)
inc = os.path.normpath(os.path.join(base, inc))
if include:
diff -r e655b378ce73 -r 23b20efd76df tests/test-hgrc
--- a/tests/test-hgrc Tue May 25 18:19:40 2010 +0200
+++ b/tests/test-hgrc Wed May 26 14:03:29 2010 -0700
@@ -23,8 +23,11 @@
> $HGRCPATH
hg showconfig foo
-echo '%include /no-such-file' > $HGRCPATH
+FAKEPATH=/path/to/nowhere
+export FAKEPATH
+echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
+unset FAKEPATH
# HGPLAIN
cd ..
diff -r e655b378ce73 -r 23b20efd76df tests/test-hgrc.out
--- a/tests/test-hgrc.out Tue May 25 18:19:40 2010 +0200
+++ b/tests/test-hgrc.out Wed May 26 14:03:29 2010 -0700
@@ -9,7 +9,7 @@
hg: config error at $HGRCPATH:2: ' x = y'
foo.bar=a\nb\nc\nde\nfg
foo.baz=bif cb
-hg: config error at $HGRCPATH:1: cannot include /no-such-file (No such file or directory)
+hg: config error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
% customized hgrc
.../.hgrc:13: alias.log=log -g
.../.hgrc:11: defaults.identify=-n
More information about the Mercurial-devel
mailing list