# HG changeset patch # User Chad Dombrova # Date 2010-05-26 21:03:29 # Node ID f23f87462c18f38a3585a8b72a14eb76b4b42fae # Parent 0d09f22448053a66c57556f2f9c246639f7385d8 config: expand hgrc %include paths diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -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 @@ class config(object): 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 --git a/tests/test-hgrc b/tests/test-hgrc --- a/tests/test-hgrc +++ b/tests/test-hgrc @@ -23,8 +23,11 @@ python -c "print '[foo]\nbar = a\n b\n c > $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 --git a/tests/test-hgrc.out b/tests/test-hgrc.out --- a/tests/test-hgrc.out +++ b/tests/test-hgrc.out @@ -9,7 +9,7 @@ paths.default=.../foo%bar 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 read config from: .../.hgrc .../.hgrc:13: alias.log=log -g