##// END OF EJS Templates
config: expand hgrc %include paths
Chad Dombrova -
r11224:f23f8746 default
parent child Browse files
Show More
@@ -6,7 +6,7 b''
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from i18n import _
8 from i18n import _
9 import error
9 import error, util
10 import re, os
10 import re, os
11
11
12 class sortdict(dict):
12 class sortdict(dict):
@@ -96,7 +96,7 b' class config(object):'
96 cont = False
96 cont = False
97 m = includere.match(l)
97 m = includere.match(l)
98 if m:
98 if m:
99 inc = m.group(1)
99 inc = util.expandpath(m.group(1))
100 base = os.path.dirname(src)
100 base = os.path.dirname(src)
101 inc = os.path.normpath(os.path.join(base, inc))
101 inc = os.path.normpath(os.path.join(base, inc))
102 if include:
102 if include:
@@ -23,8 +23,11 b' python -c "print \'[foo]\\nbar = a\\n b\\n c'
23 > $HGRCPATH
23 > $HGRCPATH
24 hg showconfig foo
24 hg showconfig foo
25
25
26 echo '%include /no-such-file' > $HGRCPATH
26 FAKEPATH=/path/to/nowhere
27 export FAKEPATH
28 echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
27 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
29 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
30 unset FAKEPATH
28
31
29 # HGPLAIN
32 # HGPLAIN
30 cd ..
33 cd ..
@@ -9,7 +9,7 b' paths.default=.../foo%bar'
9 hg: config error at $HGRCPATH:2: ' x = y'
9 hg: config error at $HGRCPATH:2: ' x = y'
10 foo.bar=a\nb\nc\nde\nfg
10 foo.bar=a\nb\nc\nde\nfg
11 foo.baz=bif cb
11 foo.baz=bif cb
12 hg: config error at $HGRCPATH:1: cannot include /no-such-file (No such file or directory)
12 hg: config error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
13 % customized hgrc
13 % customized hgrc
14 read config from: .../.hgrc
14 read config from: .../.hgrc
15 .../.hgrc:13: alias.log=log -g
15 .../.hgrc:13: alias.log=log -g
General Comments 0
You need to be logged in to leave comments. Login now