##// END OF EJS Templates
tests: skip non-readable check for root...
Joerg Sonnenberger -
r45217:28aacddf default
parent child Browse files
Show More
@@ -1,309 +1,309 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 hide outer repo
6 hide outer repo
7 $ hg init
7 $ hg init
8
8
9 Use an alternate var for scribbling on hgrc to keep check-code from
9 Use an alternate var for scribbling on hgrc to keep check-code from
10 complaining about the important settings we may be overwriting:
10 complaining about the important settings we may be overwriting:
11
11
12 $ HGRC=`pwd`/hgrc
12 $ HGRC=`pwd`/hgrc
13 $ export HGRC
13 $ export HGRC
14
14
15 Basic syntax error
15 Basic syntax error
16
16
17 $ echo "invalid" > $HGRC
17 $ echo "invalid" > $HGRC
18 $ hg version
18 $ hg version
19 hg: parse error at $TESTTMP/hgrc:1: invalid
19 hg: parse error at $TESTTMP/hgrc:1: invalid
20 [255]
20 [255]
21 $ echo "" > $HGRC
21 $ echo "" > $HGRC
22
22
23 Issue1199: Can't use '%' in hgrc (eg url encoded username)
23 Issue1199: Can't use '%' in hgrc (eg url encoded username)
24
24
25 $ hg init "foo%bar"
25 $ hg init "foo%bar"
26 $ hg clone "foo%bar" foobar
26 $ hg clone "foo%bar" foobar
27 updating to branch default
27 updating to branch default
28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 $ cd foobar
29 $ cd foobar
30 $ cat .hg/hgrc
30 $ cat .hg/hgrc
31 # example repository config (see 'hg help config' for more info)
31 # example repository config (see 'hg help config' for more info)
32 [paths]
32 [paths]
33 default = $TESTTMP/foo%bar
33 default = $TESTTMP/foo%bar
34
34
35 # path aliases to other clones of this repo in URLs or filesystem paths
35 # path aliases to other clones of this repo in URLs or filesystem paths
36 # (see 'hg help config.paths' for more info)
36 # (see 'hg help config.paths' for more info)
37 #
37 #
38 # default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
38 # default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
39 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
39 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
40 # my-clone = /home/jdoe/jdoes-clone
40 # my-clone = /home/jdoe/jdoes-clone
41
41
42 [ui]
42 [ui]
43 # name and email (local to this repository, optional), e.g.
43 # name and email (local to this repository, optional), e.g.
44 # username = Jane Doe <jdoe@example.com>
44 # username = Jane Doe <jdoe@example.com>
45 $ hg paths
45 $ hg paths
46 default = $TESTTMP/foo%bar
46 default = $TESTTMP/foo%bar
47 $ hg showconfig
47 $ hg showconfig
48 bundle.mainreporoot=$TESTTMP/foobar
48 bundle.mainreporoot=$TESTTMP/foobar
49 paths.default=$TESTTMP/foo%bar
49 paths.default=$TESTTMP/foo%bar
50 $ cd ..
50 $ cd ..
51
51
52 Check %include
52 Check %include
53
53
54 $ echo '[section]' > $TESTTMP/included
54 $ echo '[section]' > $TESTTMP/included
55 $ echo 'option = value' >> $TESTTMP/included
55 $ echo 'option = value' >> $TESTTMP/included
56 $ echo '%include $TESTTMP/included' >> $HGRC
56 $ echo '%include $TESTTMP/included' >> $HGRC
57 $ hg showconfig section
57 $ hg showconfig section
58 section.option=value
58 section.option=value
59 #if no-windows
59 #if unix-permissions no-root
60 $ chmod u-r $TESTTMP/included
60 $ chmod u-r $TESTTMP/included
61 $ hg showconfig section
61 $ hg showconfig section
62 hg: parse error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied)
62 hg: parse error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied)
63 [255]
63 [255]
64 #endif
64 #endif
65
65
66 issue1829: wrong indentation
66 issue1829: wrong indentation
67
67
68 $ echo '[foo]' > $HGRC
68 $ echo '[foo]' > $HGRC
69 $ echo ' x = y' >> $HGRC
69 $ echo ' x = y' >> $HGRC
70 $ hg version
70 $ hg version
71 hg: parse error at $TESTTMP/hgrc:2: x = y
71 hg: parse error at $TESTTMP/hgrc:2: x = y
72 unexpected leading whitespace
72 unexpected leading whitespace
73 [255]
73 [255]
74
74
75 $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \
75 $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \
76 > > $HGRC
76 > > $HGRC
77 $ hg showconfig foo
77 $ hg showconfig foo
78 foo.bar=a\nb\nc\nde\nfg
78 foo.bar=a\nb\nc\nde\nfg
79 foo.baz=bif cb
79 foo.baz=bif cb
80
80
81 $ FAKEPATH=/path/to/nowhere
81 $ FAKEPATH=/path/to/nowhere
82 $ export FAKEPATH
82 $ export FAKEPATH
83 $ echo '%include $FAKEPATH/no-such-file' > $HGRC
83 $ echo '%include $FAKEPATH/no-such-file' > $HGRC
84 $ hg version
84 $ hg version
85 Mercurial Distributed SCM (version *) (glob)
85 Mercurial Distributed SCM (version *) (glob)
86 (see https://mercurial-scm.org for more information)
86 (see https://mercurial-scm.org for more information)
87
87
88 Copyright (C) 2005-* Matt Mackall and others (glob)
88 Copyright (C) 2005-* Matt Mackall and others (glob)
89 This is free software; see the source for copying conditions. There is NO
89 This is free software; see the source for copying conditions. There is NO
90 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
90 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
91 $ unset FAKEPATH
91 $ unset FAKEPATH
92
92
93 make sure global options given on the cmdline take precedence
93 make sure global options given on the cmdline take precedence
94
94
95 $ hg showconfig --config ui.verbose=True --quiet
95 $ hg showconfig --config ui.verbose=True --quiet
96 bundle.mainreporoot=$TESTTMP
96 bundle.mainreporoot=$TESTTMP
97 ui.verbose=False
97 ui.verbose=False
98 ui.debug=False
98 ui.debug=False
99 ui.quiet=True
99 ui.quiet=True
100
100
101 $ touch foobar/untracked
101 $ touch foobar/untracked
102 $ cat >> foobar/.hg/hgrc <<EOF
102 $ cat >> foobar/.hg/hgrc <<EOF
103 > [ui]
103 > [ui]
104 > verbose=True
104 > verbose=True
105 > EOF
105 > EOF
106 $ hg -R foobar st -q
106 $ hg -R foobar st -q
107
107
108 username expansion
108 username expansion
109
109
110 $ olduser=$HGUSER
110 $ olduser=$HGUSER
111 $ unset HGUSER
111 $ unset HGUSER
112
112
113 $ FAKEUSER='John Doe'
113 $ FAKEUSER='John Doe'
114 $ export FAKEUSER
114 $ export FAKEUSER
115 $ echo '[ui]' > $HGRC
115 $ echo '[ui]' > $HGRC
116 $ echo 'username = $FAKEUSER' >> $HGRC
116 $ echo 'username = $FAKEUSER' >> $HGRC
117
117
118 $ hg init usertest
118 $ hg init usertest
119 $ cd usertest
119 $ cd usertest
120 $ touch bar
120 $ touch bar
121 $ hg commit --addremove --quiet -m "added bar"
121 $ hg commit --addremove --quiet -m "added bar"
122 $ hg log --template "{author}\n"
122 $ hg log --template "{author}\n"
123 John Doe
123 John Doe
124 $ cd ..
124 $ cd ..
125
125
126 $ hg showconfig
126 $ hg showconfig
127 bundle.mainreporoot=$TESTTMP
127 bundle.mainreporoot=$TESTTMP
128 ui.username=$FAKEUSER
128 ui.username=$FAKEUSER
129
129
130 $ unset FAKEUSER
130 $ unset FAKEUSER
131 $ HGUSER=$olduser
131 $ HGUSER=$olduser
132 $ export HGUSER
132 $ export HGUSER
133
133
134 showconfig with multiple arguments
134 showconfig with multiple arguments
135
135
136 $ echo "[alias]" > $HGRC
136 $ echo "[alias]" > $HGRC
137 $ echo "log = log -g" >> $HGRC
137 $ echo "log = log -g" >> $HGRC
138 $ echo "[defaults]" >> $HGRC
138 $ echo "[defaults]" >> $HGRC
139 $ echo "identify = -n" >> $HGRC
139 $ echo "identify = -n" >> $HGRC
140 $ hg showconfig alias defaults
140 $ hg showconfig alias defaults
141 alias.log=log -g
141 alias.log=log -g
142 defaults.identify=-n
142 defaults.identify=-n
143 $ hg showconfig alias alias
143 $ hg showconfig alias alias
144 alias.log=log -g
144 alias.log=log -g
145 $ hg showconfig alias.log alias.log
145 $ hg showconfig alias.log alias.log
146 alias.log=log -g
146 alias.log=log -g
147 $ hg showconfig alias defaults.identify
147 $ hg showconfig alias defaults.identify
148 alias.log=log -g
148 alias.log=log -g
149 defaults.identify=-n
149 defaults.identify=-n
150 $ hg showconfig alias.log defaults.identify
150 $ hg showconfig alias.log defaults.identify
151 alias.log=log -g
151 alias.log=log -g
152 defaults.identify=-n
152 defaults.identify=-n
153
153
154 HGPLAIN
154 HGPLAIN
155
155
156 $ echo "[ui]" > $HGRC
156 $ echo "[ui]" > $HGRC
157 $ echo "debug=true" >> $HGRC
157 $ echo "debug=true" >> $HGRC
158 $ echo "fallbackencoding=ASCII" >> $HGRC
158 $ echo "fallbackencoding=ASCII" >> $HGRC
159 $ echo "quiet=true" >> $HGRC
159 $ echo "quiet=true" >> $HGRC
160 $ echo "slash=true" >> $HGRC
160 $ echo "slash=true" >> $HGRC
161 $ echo "traceback=true" >> $HGRC
161 $ echo "traceback=true" >> $HGRC
162 $ echo "verbose=true" >> $HGRC
162 $ echo "verbose=true" >> $HGRC
163 $ echo "style=~/.hgstyle" >> $HGRC
163 $ echo "style=~/.hgstyle" >> $HGRC
164 $ echo "logtemplate={node}" >> $HGRC
164 $ echo "logtemplate={node}" >> $HGRC
165 $ echo "[defaults]" >> $HGRC
165 $ echo "[defaults]" >> $HGRC
166 $ echo "identify=-n" >> $HGRC
166 $ echo "identify=-n" >> $HGRC
167 $ echo "[alias]" >> $HGRC
167 $ echo "[alias]" >> $HGRC
168 $ echo "log=log -g" >> $HGRC
168 $ echo "log=log -g" >> $HGRC
169
169
170 customized hgrc
170 customized hgrc
171
171
172 $ hg showconfig
172 $ hg showconfig
173 read config from: $TESTTMP/hgrc
173 read config from: $TESTTMP/hgrc
174 $TESTTMP/hgrc:13: alias.log=log -g
174 $TESTTMP/hgrc:13: alias.log=log -g
175 repo: bundle.mainreporoot=$TESTTMP
175 repo: bundle.mainreporoot=$TESTTMP
176 $TESTTMP/hgrc:11: defaults.identify=-n
176 $TESTTMP/hgrc:11: defaults.identify=-n
177 $TESTTMP/hgrc:2: ui.debug=true
177 $TESTTMP/hgrc:2: ui.debug=true
178 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
178 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
179 $TESTTMP/hgrc:4: ui.quiet=true
179 $TESTTMP/hgrc:4: ui.quiet=true
180 $TESTTMP/hgrc:5: ui.slash=true
180 $TESTTMP/hgrc:5: ui.slash=true
181 $TESTTMP/hgrc:6: ui.traceback=true
181 $TESTTMP/hgrc:6: ui.traceback=true
182 $TESTTMP/hgrc:7: ui.verbose=true
182 $TESTTMP/hgrc:7: ui.verbose=true
183 $TESTTMP/hgrc:8: ui.style=~/.hgstyle
183 $TESTTMP/hgrc:8: ui.style=~/.hgstyle
184 $TESTTMP/hgrc:9: ui.logtemplate={node}
184 $TESTTMP/hgrc:9: ui.logtemplate={node}
185
185
186 plain hgrc
186 plain hgrc
187
187
188 $ HGPLAIN=; export HGPLAIN
188 $ HGPLAIN=; export HGPLAIN
189 $ hg showconfig --config ui.traceback=True --debug
189 $ hg showconfig --config ui.traceback=True --debug
190 read config from: $TESTTMP/hgrc
190 read config from: $TESTTMP/hgrc
191 repo: bundle.mainreporoot=$TESTTMP
191 repo: bundle.mainreporoot=$TESTTMP
192 --config: ui.traceback=True
192 --config: ui.traceback=True
193 --verbose: ui.verbose=False
193 --verbose: ui.verbose=False
194 --debug: ui.debug=True
194 --debug: ui.debug=True
195 --quiet: ui.quiet=False
195 --quiet: ui.quiet=False
196
196
197 with environment variables
197 with environment variables
198
198
199 $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug
199 $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug
200 read config from: $TESTTMP/hgrc
200 read config from: $TESTTMP/hgrc
201 repo: bundle.mainreporoot=$TESTTMP
201 repo: bundle.mainreporoot=$TESTTMP
202 $PAGER: pager.pager=p1
202 $PAGER: pager.pager=p1
203 $VISUAL: ui.editor=e2
203 $VISUAL: ui.editor=e2
204 --verbose: ui.verbose=False
204 --verbose: ui.verbose=False
205 --debug: ui.debug=True
205 --debug: ui.debug=True
206 --quiet: ui.quiet=False
206 --quiet: ui.quiet=False
207
207
208 plain mode with exceptions
208 plain mode with exceptions
209
209
210 $ cat > plain.py <<EOF
210 $ cat > plain.py <<EOF
211 > from mercurial import commands, extensions
211 > from mercurial import commands, extensions
212 > def _config(orig, ui, repo, *values, **opts):
212 > def _config(orig, ui, repo, *values, **opts):
213 > ui.write(b'plain: %r\n' % ui.plain())
213 > ui.write(b'plain: %r\n' % ui.plain())
214 > return orig(ui, repo, *values, **opts)
214 > return orig(ui, repo, *values, **opts)
215 > def uisetup(ui):
215 > def uisetup(ui):
216 > extensions.wrapcommand(commands.table, b'config', _config)
216 > extensions.wrapcommand(commands.table, b'config', _config)
217 > EOF
217 > EOF
218 $ echo "[extensions]" >> $HGRC
218 $ echo "[extensions]" >> $HGRC
219 $ echo "plain=./plain.py" >> $HGRC
219 $ echo "plain=./plain.py" >> $HGRC
220 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
220 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
221 $ hg showconfig --config ui.traceback=True --debug
221 $ hg showconfig --config ui.traceback=True --debug
222 plain: True
222 plain: True
223 read config from: $TESTTMP/hgrc
223 read config from: $TESTTMP/hgrc
224 repo: bundle.mainreporoot=$TESTTMP
224 repo: bundle.mainreporoot=$TESTTMP
225 $TESTTMP/hgrc:15: extensions.plain=./plain.py
225 $TESTTMP/hgrc:15: extensions.plain=./plain.py
226 --config: ui.traceback=True
226 --config: ui.traceback=True
227 --verbose: ui.verbose=False
227 --verbose: ui.verbose=False
228 --debug: ui.debug=True
228 --debug: ui.debug=True
229 --quiet: ui.quiet=False
229 --quiet: ui.quiet=False
230 $ unset HGPLAIN
230 $ unset HGPLAIN
231 $ hg showconfig --config ui.traceback=True --debug
231 $ hg showconfig --config ui.traceback=True --debug
232 plain: True
232 plain: True
233 read config from: $TESTTMP/hgrc
233 read config from: $TESTTMP/hgrc
234 repo: bundle.mainreporoot=$TESTTMP
234 repo: bundle.mainreporoot=$TESTTMP
235 $TESTTMP/hgrc:15: extensions.plain=./plain.py
235 $TESTTMP/hgrc:15: extensions.plain=./plain.py
236 --config: ui.traceback=True
236 --config: ui.traceback=True
237 --verbose: ui.verbose=False
237 --verbose: ui.verbose=False
238 --debug: ui.debug=True
238 --debug: ui.debug=True
239 --quiet: ui.quiet=False
239 --quiet: ui.quiet=False
240 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
240 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
241 $ hg showconfig --config ui.traceback=True --debug
241 $ hg showconfig --config ui.traceback=True --debug
242 plain: True
242 plain: True
243 read config from: $TESTTMP/hgrc
243 read config from: $TESTTMP/hgrc
244 repo: bundle.mainreporoot=$TESTTMP
244 repo: bundle.mainreporoot=$TESTTMP
245 $TESTTMP/hgrc:15: extensions.plain=./plain.py
245 $TESTTMP/hgrc:15: extensions.plain=./plain.py
246 --config: ui.traceback=True
246 --config: ui.traceback=True
247 --verbose: ui.verbose=False
247 --verbose: ui.verbose=False
248 --debug: ui.debug=True
248 --debug: ui.debug=True
249 --quiet: ui.quiet=False
249 --quiet: ui.quiet=False
250
250
251 source of paths is not mangled
251 source of paths is not mangled
252
252
253 $ cat >> $HGRCPATH <<EOF
253 $ cat >> $HGRCPATH <<EOF
254 > [paths]
254 > [paths]
255 > foo = bar
255 > foo = bar
256 > EOF
256 > EOF
257 $ hg showconfig --debug paths
257 $ hg showconfig --debug paths
258 plain: True
258 plain: True
259 read config from: $TESTTMP/hgrc
259 read config from: $TESTTMP/hgrc
260 $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar
260 $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar
261
261
262 Test we can skip the user configuration
262 Test we can skip the user configuration
263
263
264 $ cat >> .hg/hgrc <<EOF
264 $ cat >> .hg/hgrc <<EOF
265 > [paths]
265 > [paths]
266 > elephant = babar
266 > elephant = babar
267 > EOF
267 > EOF
268 $ hg path
268 $ hg path
269 elephant = $TESTTMP/babar
269 elephant = $TESTTMP/babar
270 foo = $TESTTMP/bar
270 foo = $TESTTMP/bar
271 $ HGRCSKIPREPO=1 hg path
271 $ HGRCSKIPREPO=1 hg path
272 foo = $TESTTMP/bar
272 foo = $TESTTMP/bar
273
273
274 $ cat >> .hg/hgrc <<EOF
274 $ cat >> .hg/hgrc <<EOF
275 > [broken
275 > [broken
276 > EOF
276 > EOF
277
277
278 $ hg path
278 $ hg path
279 hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
279 hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
280 [255]
280 [255]
281 $ HGRCSKIPREPO=1 hg path
281 $ HGRCSKIPREPO=1 hg path
282 foo = $TESTTMP/bar
282 foo = $TESTTMP/bar
283
283
284 Check that hgweb respect HGRCSKIPREPO=1
284 Check that hgweb respect HGRCSKIPREPO=1
285
285
286 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
286 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
287 hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
287 hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
288 [255]
288 [255]
289 $ test -f hg.pid && (cat hg.pid >> $DAEMON_PIDS)
289 $ test -f hg.pid && (cat hg.pid >> $DAEMON_PIDS)
290 [1]
290 [1]
291 $ killdaemons.py
291 $ killdaemons.py
292 $ test -f access.log && cat access.log
292 $ test -f access.log && cat access.log
293 [1]
293 [1]
294 $ test -f errors.log && cat errors.log
294 $ test -f errors.log && cat errors.log
295 [1]
295 [1]
296
296
297 $ HGRCSKIPREPO=1 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
297 $ HGRCSKIPREPO=1 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
298 $ cat hg.pid >> $DAEMON_PIDS
298 $ cat hg.pid >> $DAEMON_PIDS
299 $ killdaemons.py
299 $ killdaemons.py
300 $ cat access.log
300 $ cat access.log
301 $ cat errors.log
301 $ cat errors.log
302
302
303 Check that zeroconf respect HGRCSKIPREPO=1
303 Check that zeroconf respect HGRCSKIPREPO=1
304
304
305 $ hg paths --config extensions.zeroconf=
305 $ hg paths --config extensions.zeroconf=
306 hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
306 hg: parse error at $TESTTMP/.hg/hgrc:3: [broken
307 [255]
307 [255]
308 $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf=
308 $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf=
309 foo = $TESTTMP/bar
309 foo = $TESTTMP/bar
General Comments 0
You need to be logged in to leave comments. Login now