##// END OF EJS Templates
tests: update for handling of missing hgrc includes
Matt Mackall -
r14489:3a27faf9 default
parent child Browse files
Show More
@@ -1,171 +1,175 b''
1 Use hgrc within $TESTTMP
1 Use hgrc within $TESTTMP
2
2
3 $ HGRCPATH=`pwd`/hgrc
3 $ HGRCPATH=`pwd`/hgrc
4 $ export HGRCPATH
4 $ export HGRCPATH
5
5
6 Basic syntax error
6 Basic syntax error
7
7
8 $ echo "invalid" > $HGRCPATH
8 $ echo "invalid" > $HGRCPATH
9 $ hg version
9 $ hg version
10 hg: parse error at $TESTTMP/hgrc:1: invalid
10 hg: parse error at $TESTTMP/hgrc:1: invalid
11 [255]
11 [255]
12 $ echo "" > $HGRCPATH
12 $ echo "" > $HGRCPATH
13
13
14 Issue1199: Can't use '%' in hgrc (eg url encoded username)
14 Issue1199: Can't use '%' in hgrc (eg url encoded username)
15
15
16 $ hg init "foo%bar"
16 $ hg init "foo%bar"
17 $ hg clone "foo%bar" foobar
17 $ hg clone "foo%bar" foobar
18 updating to branch default
18 updating to branch default
19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 $ cd foobar
20 $ cd foobar
21 $ cat .hg/hgrc
21 $ cat .hg/hgrc
22 [paths]
22 [paths]
23 default = $TESTTMP/foo%bar
23 default = $TESTTMP/foo%bar
24 $ hg paths
24 $ hg paths
25 default = $TESTTMP/foo%bar
25 default = $TESTTMP/foo%bar
26 $ hg showconfig
26 $ hg showconfig
27 bundle.mainreporoot=$TESTTMP/foobar
27 bundle.mainreporoot=$TESTTMP/foobar
28 paths.default=$TESTTMP/foo%bar
28 paths.default=$TESTTMP/foo%bar
29 $ cd ..
29 $ cd ..
30
30
31 issue1829: wrong indentation
31 issue1829: wrong indentation
32
32
33 $ echo '[foo]' > $HGRCPATH
33 $ echo '[foo]' > $HGRCPATH
34 $ echo ' x = y' >> $HGRCPATH
34 $ echo ' x = y' >> $HGRCPATH
35 $ hg version
35 $ hg version
36 hg: parse error at $TESTTMP/hgrc:2: x = y
36 hg: parse error at $TESTTMP/hgrc:2: x = y
37 [255]
37 [255]
38
38
39 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
39 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
40 > > $HGRCPATH
40 > > $HGRCPATH
41 $ hg showconfig foo
41 $ hg showconfig foo
42 foo.bar=a\nb\nc\nde\nfg
42 foo.bar=a\nb\nc\nde\nfg
43 foo.baz=bif cb
43 foo.baz=bif cb
44
44
45 $ FAKEPATH=/path/to/nowhere
45 $ FAKEPATH=/path/to/nowhere
46 $ export FAKEPATH
46 $ export FAKEPATH
47 $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
47 $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
48 $ hg version
48 $ hg version
49 hg: parse error at $TESTTMP/hgrc:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
49 Mercurial Distributed SCM (version 1.8.2+121-52aebe8983a4+20110423)
50 [255]
50 (see http://mercurial.selenic.com for more information)
51
52 Copyright (C) 2005-2011 Matt Mackall and others
53 This is free software; see the source for copying conditions. There is NO
54 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
51 $ unset FAKEPATH
55 $ unset FAKEPATH
52
56
53 username expansion
57 username expansion
54
58
55 $ olduser=$HGUSER
59 $ olduser=$HGUSER
56 $ unset HGUSER
60 $ unset HGUSER
57
61
58 $ FAKEUSER='John Doe'
62 $ FAKEUSER='John Doe'
59 $ export FAKEUSER
63 $ export FAKEUSER
60 $ echo '[ui]' > $HGRCPATH
64 $ echo '[ui]' > $HGRCPATH
61 $ echo 'username = $FAKEUSER' >> $HGRCPATH
65 $ echo 'username = $FAKEUSER' >> $HGRCPATH
62
66
63 $ hg init usertest
67 $ hg init usertest
64 $ cd usertest
68 $ cd usertest
65 $ touch bar
69 $ touch bar
66 $ hg commit --addremove --quiet -m "added bar"
70 $ hg commit --addremove --quiet -m "added bar"
67 $ hg log --template "{author}\n"
71 $ hg log --template "{author}\n"
68 John Doe
72 John Doe
69 $ cd ..
73 $ cd ..
70
74
71 $ hg showconfig
75 $ hg showconfig
72 ui.username=$FAKEUSER
76 ui.username=$FAKEUSER
73
77
74 $ unset FAKEUSER
78 $ unset FAKEUSER
75 $ HGUSER=$olduser
79 $ HGUSER=$olduser
76 $ export HGUSER
80 $ export HGUSER
77
81
78 showconfig with multiple arguments
82 showconfig with multiple arguments
79
83
80 $ echo "[alias]" > $HGRCPATH
84 $ echo "[alias]" > $HGRCPATH
81 $ echo "log = log -g" >> $HGRCPATH
85 $ echo "log = log -g" >> $HGRCPATH
82 $ echo "[defaults]" >> $HGRCPATH
86 $ echo "[defaults]" >> $HGRCPATH
83 $ echo "identify = -n" >> $HGRCPATH
87 $ echo "identify = -n" >> $HGRCPATH
84 $ hg showconfig alias defaults
88 $ hg showconfig alias defaults
85 alias.log=log -g
89 alias.log=log -g
86 defaults.identify=-n
90 defaults.identify=-n
87 $ hg showconfig alias defaults.identify
91 $ hg showconfig alias defaults.identify
88 abort: only one config item permitted
92 abort: only one config item permitted
89 [255]
93 [255]
90 $ hg showconfig alias.log defaults.identify
94 $ hg showconfig alias.log defaults.identify
91 abort: only one config item permitted
95 abort: only one config item permitted
92 [255]
96 [255]
93
97
94 HGPLAIN
98 HGPLAIN
95
99
96 $ cd ..
100 $ cd ..
97 $ p=`pwd`
101 $ p=`pwd`
98 $ echo "[ui]" > $HGRCPATH
102 $ echo "[ui]" > $HGRCPATH
99 $ echo "debug=true" >> $HGRCPATH
103 $ echo "debug=true" >> $HGRCPATH
100 $ echo "fallbackencoding=ASCII" >> $HGRCPATH
104 $ echo "fallbackencoding=ASCII" >> $HGRCPATH
101 $ echo "quiet=true" >> $HGRCPATH
105 $ echo "quiet=true" >> $HGRCPATH
102 $ echo "slash=true" >> $HGRCPATH
106 $ echo "slash=true" >> $HGRCPATH
103 $ echo "traceback=true" >> $HGRCPATH
107 $ echo "traceback=true" >> $HGRCPATH
104 $ echo "verbose=true" >> $HGRCPATH
108 $ echo "verbose=true" >> $HGRCPATH
105 $ echo "style=~/.hgstyle" >> $HGRCPATH
109 $ echo "style=~/.hgstyle" >> $HGRCPATH
106 $ echo "logtemplate={node}" >> $HGRCPATH
110 $ echo "logtemplate={node}" >> $HGRCPATH
107 $ echo "[defaults]" >> $HGRCPATH
111 $ echo "[defaults]" >> $HGRCPATH
108 $ echo "identify=-n" >> $HGRCPATH
112 $ echo "identify=-n" >> $HGRCPATH
109 $ echo "[alias]" >> $HGRCPATH
113 $ echo "[alias]" >> $HGRCPATH
110 $ echo "log=log -g" >> $HGRCPATH
114 $ echo "log=log -g" >> $HGRCPATH
111
115
112 customized hgrc
116 customized hgrc
113
117
114 $ hg showconfig
118 $ hg showconfig
115 read config from: $TESTTMP/hgrc
119 read config from: $TESTTMP/hgrc
116 $TESTTMP/hgrc:13: alias.log=log -g
120 $TESTTMP/hgrc:13: alias.log=log -g
117 $TESTTMP/hgrc:11: defaults.identify=-n
121 $TESTTMP/hgrc:11: defaults.identify=-n
118 $TESTTMP/hgrc:2: ui.debug=true
122 $TESTTMP/hgrc:2: ui.debug=true
119 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
123 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
120 $TESTTMP/hgrc:4: ui.quiet=true
124 $TESTTMP/hgrc:4: ui.quiet=true
121 $TESTTMP/hgrc:5: ui.slash=true
125 $TESTTMP/hgrc:5: ui.slash=true
122 $TESTTMP/hgrc:6: ui.traceback=true
126 $TESTTMP/hgrc:6: ui.traceback=true
123 $TESTTMP/hgrc:7: ui.verbose=true
127 $TESTTMP/hgrc:7: ui.verbose=true
124 $TESTTMP/hgrc:8: ui.style=~/.hgstyle
128 $TESTTMP/hgrc:8: ui.style=~/.hgstyle
125 $TESTTMP/hgrc:9: ui.logtemplate={node}
129 $TESTTMP/hgrc:9: ui.logtemplate={node}
126
130
127 plain hgrc
131 plain hgrc
128
132
129 $ HGPLAIN=; export HGPLAIN
133 $ HGPLAIN=; export HGPLAIN
130 $ hg showconfig --config ui.traceback=True --debug
134 $ hg showconfig --config ui.traceback=True --debug
131 read config from: $TESTTMP/hgrc
135 read config from: $TESTTMP/hgrc
132 none: ui.traceback=True
136 none: ui.traceback=True
133 none: ui.verbose=False
137 none: ui.verbose=False
134 none: ui.debug=True
138 none: ui.debug=True
135 none: ui.quiet=False
139 none: ui.quiet=False
136
140
137 plain mode with exceptions
141 plain mode with exceptions
138
142
139 $ cat > plain.py <<EOF
143 $ cat > plain.py <<EOF
140 > def uisetup(ui):
144 > def uisetup(ui):
141 > ui.write('plain: %r\n' % ui.plain())
145 > ui.write('plain: %r\n' % ui.plain())
142 > EOF
146 > EOF
143 $ echo "[extensions]" >> $HGRCPATH
147 $ echo "[extensions]" >> $HGRCPATH
144 $ echo "plain=./plain.py" >> $HGRCPATH
148 $ echo "plain=./plain.py" >> $HGRCPATH
145 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
149 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
146 $ hg showconfig --config ui.traceback=True --debug
150 $ hg showconfig --config ui.traceback=True --debug
147 plain: True
151 plain: True
148 read config from: $TESTTMP/hgrc
152 read config from: $TESTTMP/hgrc
149 $TESTTMP/hgrc:15: extensions.plain=./plain.py
153 $TESTTMP/hgrc:15: extensions.plain=./plain.py
150 none: ui.traceback=True
154 none: ui.traceback=True
151 none: ui.verbose=False
155 none: ui.verbose=False
152 none: ui.debug=True
156 none: ui.debug=True
153 none: ui.quiet=False
157 none: ui.quiet=False
154 $ unset HGPLAIN
158 $ unset HGPLAIN
155 $ hg showconfig --config ui.traceback=True --debug
159 $ hg showconfig --config ui.traceback=True --debug
156 plain: True
160 plain: True
157 read config from: $TESTTMP/hgrc
161 read config from: $TESTTMP/hgrc
158 $TESTTMP/hgrc:15: extensions.plain=./plain.py
162 $TESTTMP/hgrc:15: extensions.plain=./plain.py
159 none: ui.traceback=True
163 none: ui.traceback=True
160 none: ui.verbose=False
164 none: ui.verbose=False
161 none: ui.debug=True
165 none: ui.debug=True
162 none: ui.quiet=False
166 none: ui.quiet=False
163 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
167 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
164 $ hg showconfig --config ui.traceback=True --debug
168 $ hg showconfig --config ui.traceback=True --debug
165 plain: True
169 plain: True
166 read config from: $TESTTMP/hgrc
170 read config from: $TESTTMP/hgrc
167 $TESTTMP/hgrc:15: extensions.plain=./plain.py
171 $TESTTMP/hgrc:15: extensions.plain=./plain.py
168 none: ui.traceback=True
172 none: ui.traceback=True
169 none: ui.verbose=False
173 none: ui.verbose=False
170 none: ui.debug=True
174 none: ui.debug=True
171 none: ui.quiet=False
175 none: ui.quiet=False
General Comments 0
You need to be logged in to leave comments. Login now