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