##// END OF EJS Templates
tests: handle Windows file separator differences in test-config.t...
Matt Harbison -
r47626:915a60bf default
parent child Browse files
Show More
@@ -1,501 +1,515 b''
1 Windows needs ';' as a file separator in an environment variable, and MSYS
2 doesn't automatically convert it in every case.
3
4 #if windows
5 $ path_list_var() {
6 > echo $1 | sed 's/:/;/'
7 > }
8 #else
9 $ path_list_var() {
10 > echo $1
11 > }
12 #endif
13
14
1 hide outer repo
15 hide outer repo
2 $ hg init
16 $ hg init
3
17
4 Invalid syntax: no value
18 Invalid syntax: no value
5
19
6 $ cat > .hg/hgrc << EOF
20 $ cat > .hg/hgrc << EOF
7 > novaluekey
21 > novaluekey
8 > EOF
22 > EOF
9 $ hg showconfig
23 $ hg showconfig
10 config error at $TESTTMP/.hg/hgrc:1: novaluekey
24 config error at $TESTTMP/.hg/hgrc:1: novaluekey
11 [30]
25 [30]
12
26
13 Invalid syntax: no key
27 Invalid syntax: no key
14
28
15 $ cat > .hg/hgrc << EOF
29 $ cat > .hg/hgrc << EOF
16 > =nokeyvalue
30 > =nokeyvalue
17 > EOF
31 > EOF
18 $ hg showconfig
32 $ hg showconfig
19 config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
33 config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
20 [30]
34 [30]
21
35
22 Test hint about invalid syntax from leading white space
36 Test hint about invalid syntax from leading white space
23
37
24 $ cat > .hg/hgrc << EOF
38 $ cat > .hg/hgrc << EOF
25 > key=value
39 > key=value
26 > EOF
40 > EOF
27 $ hg showconfig
41 $ hg showconfig
28 config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: key=value
42 config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: key=value
29 [30]
43 [30]
30
44
31 $ cat > .hg/hgrc << EOF
45 $ cat > .hg/hgrc << EOF
32 > [section]
46 > [section]
33 > key=value
47 > key=value
34 > EOF
48 > EOF
35 $ hg showconfig
49 $ hg showconfig
36 config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: [section]
50 config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: [section]
37 [30]
51 [30]
38
52
39 Reset hgrc
53 Reset hgrc
40
54
41 $ echo > .hg/hgrc
55 $ echo > .hg/hgrc
42
56
43 Test case sensitive configuration
57 Test case sensitive configuration
44
58
45 $ cat <<EOF >> $HGRCPATH
59 $ cat <<EOF >> $HGRCPATH
46 > [Section]
60 > [Section]
47 > KeY = Case Sensitive
61 > KeY = Case Sensitive
48 > key = lower case
62 > key = lower case
49 > EOF
63 > EOF
50
64
51 $ hg showconfig Section
65 $ hg showconfig Section
52 Section.KeY=Case Sensitive
66 Section.KeY=Case Sensitive
53 Section.key=lower case
67 Section.key=lower case
54
68
55 $ hg showconfig Section -Tjson
69 $ hg showconfig Section -Tjson
56 [
70 [
57 {
71 {
58 "defaultvalue": null,
72 "defaultvalue": null,
59 "name": "Section.KeY",
73 "name": "Section.KeY",
60 "source": "*.hgrc:*", (glob)
74 "source": "*.hgrc:*", (glob)
61 "value": "Case Sensitive"
75 "value": "Case Sensitive"
62 },
76 },
63 {
77 {
64 "defaultvalue": null,
78 "defaultvalue": null,
65 "name": "Section.key",
79 "name": "Section.key",
66 "source": "*.hgrc:*", (glob)
80 "source": "*.hgrc:*", (glob)
67 "value": "lower case"
81 "value": "lower case"
68 }
82 }
69 ]
83 ]
70 $ hg showconfig Section.KeY -Tjson
84 $ hg showconfig Section.KeY -Tjson
71 [
85 [
72 {
86 {
73 "defaultvalue": null,
87 "defaultvalue": null,
74 "name": "Section.KeY",
88 "name": "Section.KeY",
75 "source": "*.hgrc:*", (glob)
89 "source": "*.hgrc:*", (glob)
76 "value": "Case Sensitive"
90 "value": "Case Sensitive"
77 }
91 }
78 ]
92 ]
79 $ hg showconfig -Tjson | tail -7
93 $ hg showconfig -Tjson | tail -7
80 {
94 {
81 "defaultvalue": null,
95 "defaultvalue": null,
82 "name": "*", (glob)
96 "name": "*", (glob)
83 "source": "*", (glob)
97 "source": "*", (glob)
84 "value": "*" (glob)
98 "value": "*" (glob)
85 }
99 }
86 ]
100 ]
87
101
88 Test config default of various types:
102 Test config default of various types:
89
103
90 {"defaultvalue": ""} for -T'json(defaultvalue)' looks weird, but that's
104 {"defaultvalue": ""} for -T'json(defaultvalue)' looks weird, but that's
91 how the templater works. Unknown keywords are evaluated to "".
105 how the templater works. Unknown keywords are evaluated to "".
92
106
93 dynamicdefault
107 dynamicdefault
94
108
95 $ hg config --config alias.foo= alias -Tjson
109 $ hg config --config alias.foo= alias -Tjson
96 [
110 [
97 {
111 {
98 "name": "alias.foo",
112 "name": "alias.foo",
99 "source": "--config",
113 "source": "--config",
100 "value": ""
114 "value": ""
101 }
115 }
102 ]
116 ]
103 $ hg config --config alias.foo= alias -T'json(defaultvalue)'
117 $ hg config --config alias.foo= alias -T'json(defaultvalue)'
104 [
118 [
105 {"defaultvalue": ""}
119 {"defaultvalue": ""}
106 ]
120 ]
107 $ hg config --config alias.foo= alias -T'{defaultvalue}\n'
121 $ hg config --config alias.foo= alias -T'{defaultvalue}\n'
108
122
109
123
110 null
124 null
111
125
112 $ hg config --config auth.cookiefile= auth -Tjson
126 $ hg config --config auth.cookiefile= auth -Tjson
113 [
127 [
114 {
128 {
115 "defaultvalue": null,
129 "defaultvalue": null,
116 "name": "auth.cookiefile",
130 "name": "auth.cookiefile",
117 "source": "--config",
131 "source": "--config",
118 "value": ""
132 "value": ""
119 }
133 }
120 ]
134 ]
121 $ hg config --config auth.cookiefile= auth -T'json(defaultvalue)'
135 $ hg config --config auth.cookiefile= auth -T'json(defaultvalue)'
122 [
136 [
123 {"defaultvalue": null}
137 {"defaultvalue": null}
124 ]
138 ]
125 $ hg config --config auth.cookiefile= auth -T'{defaultvalue}\n'
139 $ hg config --config auth.cookiefile= auth -T'{defaultvalue}\n'
126
140
127
141
128 false
142 false
129
143
130 $ hg config --config commands.commit.post-status= commands -Tjson
144 $ hg config --config commands.commit.post-status= commands -Tjson
131 [
145 [
132 {
146 {
133 "defaultvalue": false,
147 "defaultvalue": false,
134 "name": "commands.commit.post-status",
148 "name": "commands.commit.post-status",
135 "source": "--config",
149 "source": "--config",
136 "value": ""
150 "value": ""
137 }
151 }
138 ]
152 ]
139 $ hg config --config commands.commit.post-status= commands -T'json(defaultvalue)'
153 $ hg config --config commands.commit.post-status= commands -T'json(defaultvalue)'
140 [
154 [
141 {"defaultvalue": false}
155 {"defaultvalue": false}
142 ]
156 ]
143 $ hg config --config commands.commit.post-status= commands -T'{defaultvalue}\n'
157 $ hg config --config commands.commit.post-status= commands -T'{defaultvalue}\n'
144 False
158 False
145
159
146 true
160 true
147
161
148 $ hg config --config format.dotencode= format -Tjson
162 $ hg config --config format.dotencode= format -Tjson
149 [
163 [
150 {
164 {
151 "defaultvalue": true,
165 "defaultvalue": true,
152 "name": "format.dotencode",
166 "name": "format.dotencode",
153 "source": "--config",
167 "source": "--config",
154 "value": ""
168 "value": ""
155 }
169 }
156 ]
170 ]
157 $ hg config --config format.dotencode= format -T'json(defaultvalue)'
171 $ hg config --config format.dotencode= format -T'json(defaultvalue)'
158 [
172 [
159 {"defaultvalue": true}
173 {"defaultvalue": true}
160 ]
174 ]
161 $ hg config --config format.dotencode= format -T'{defaultvalue}\n'
175 $ hg config --config format.dotencode= format -T'{defaultvalue}\n'
162 True
176 True
163
177
164 bytes
178 bytes
165
179
166 $ hg config --config commands.resolve.mark-check= commands -Tjson
180 $ hg config --config commands.resolve.mark-check= commands -Tjson
167 [
181 [
168 {
182 {
169 "defaultvalue": "none",
183 "defaultvalue": "none",
170 "name": "commands.resolve.mark-check",
184 "name": "commands.resolve.mark-check",
171 "source": "--config",
185 "source": "--config",
172 "value": ""
186 "value": ""
173 }
187 }
174 ]
188 ]
175 $ hg config --config commands.resolve.mark-check= commands -T'json(defaultvalue)'
189 $ hg config --config commands.resolve.mark-check= commands -T'json(defaultvalue)'
176 [
190 [
177 {"defaultvalue": "none"}
191 {"defaultvalue": "none"}
178 ]
192 ]
179 $ hg config --config commands.resolve.mark-check= commands -T'{defaultvalue}\n'
193 $ hg config --config commands.resolve.mark-check= commands -T'{defaultvalue}\n'
180 none
194 none
181
195
182 empty list
196 empty list
183
197
184 $ hg config --config commands.show.aliasprefix= commands -Tjson
198 $ hg config --config commands.show.aliasprefix= commands -Tjson
185 [
199 [
186 {
200 {
187 "defaultvalue": [],
201 "defaultvalue": [],
188 "name": "commands.show.aliasprefix",
202 "name": "commands.show.aliasprefix",
189 "source": "--config",
203 "source": "--config",
190 "value": ""
204 "value": ""
191 }
205 }
192 ]
206 ]
193 $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)'
207 $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)'
194 [
208 [
195 {"defaultvalue": []}
209 {"defaultvalue": []}
196 ]
210 ]
197 $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n'
211 $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n'
198
212
199
213
200 nonempty list
214 nonempty list
201
215
202 $ hg config --config progress.format= progress -Tjson
216 $ hg config --config progress.format= progress -Tjson
203 [
217 [
204 {
218 {
205 "defaultvalue": ["topic", "bar", "number", "estimate"],
219 "defaultvalue": ["topic", "bar", "number", "estimate"],
206 "name": "progress.format",
220 "name": "progress.format",
207 "source": "--config",
221 "source": "--config",
208 "value": ""
222 "value": ""
209 }
223 }
210 ]
224 ]
211 $ hg config --config progress.format= progress -T'json(defaultvalue)'
225 $ hg config --config progress.format= progress -T'json(defaultvalue)'
212 [
226 [
213 {"defaultvalue": ["topic", "bar", "number", "estimate"]}
227 {"defaultvalue": ["topic", "bar", "number", "estimate"]}
214 ]
228 ]
215 $ hg config --config progress.format= progress -T'{defaultvalue}\n'
229 $ hg config --config progress.format= progress -T'{defaultvalue}\n'
216 topic bar number estimate
230 topic bar number estimate
217
231
218 int
232 int
219
233
220 $ hg config --config profiling.freq= profiling -Tjson
234 $ hg config --config profiling.freq= profiling -Tjson
221 [
235 [
222 {
236 {
223 "defaultvalue": 1000,
237 "defaultvalue": 1000,
224 "name": "profiling.freq",
238 "name": "profiling.freq",
225 "source": "--config",
239 "source": "--config",
226 "value": ""
240 "value": ""
227 }
241 }
228 ]
242 ]
229 $ hg config --config profiling.freq= profiling -T'json(defaultvalue)'
243 $ hg config --config profiling.freq= profiling -T'json(defaultvalue)'
230 [
244 [
231 {"defaultvalue": 1000}
245 {"defaultvalue": 1000}
232 ]
246 ]
233 $ hg config --config profiling.freq= profiling -T'{defaultvalue}\n'
247 $ hg config --config profiling.freq= profiling -T'{defaultvalue}\n'
234 1000
248 1000
235
249
236 float
250 float
237
251
238 $ hg config --config profiling.showmax= profiling -Tjson
252 $ hg config --config profiling.showmax= profiling -Tjson
239 [
253 [
240 {
254 {
241 "defaultvalue": 0.999,
255 "defaultvalue": 0.999,
242 "name": "profiling.showmax",
256 "name": "profiling.showmax",
243 "source": "--config",
257 "source": "--config",
244 "value": ""
258 "value": ""
245 }
259 }
246 ]
260 ]
247 $ hg config --config profiling.showmax= profiling -T'json(defaultvalue)'
261 $ hg config --config profiling.showmax= profiling -T'json(defaultvalue)'
248 [
262 [
249 {"defaultvalue": 0.999}
263 {"defaultvalue": 0.999}
250 ]
264 ]
251 $ hg config --config profiling.showmax= profiling -T'{defaultvalue}\n'
265 $ hg config --config profiling.showmax= profiling -T'{defaultvalue}\n'
252 0.999
266 0.999
253
267
254 Test empty config source:
268 Test empty config source:
255
269
256 $ cat <<EOF > emptysource.py
270 $ cat <<EOF > emptysource.py
257 > def reposetup(ui, repo):
271 > def reposetup(ui, repo):
258 > ui.setconfig(b'empty', b'source', b'value')
272 > ui.setconfig(b'empty', b'source', b'value')
259 > EOF
273 > EOF
260 $ cp .hg/hgrc .hg/hgrc.orig
274 $ cp .hg/hgrc .hg/hgrc.orig
261 $ cat <<EOF >> .hg/hgrc
275 $ cat <<EOF >> .hg/hgrc
262 > [extensions]
276 > [extensions]
263 > emptysource = `pwd`/emptysource.py
277 > emptysource = `pwd`/emptysource.py
264 > EOF
278 > EOF
265
279
266 $ hg config --debug empty.source
280 $ hg config --debug empty.source
267 read config from: * (glob)
281 read config from: * (glob)
268 none: value
282 none: value
269 $ hg config empty.source -Tjson
283 $ hg config empty.source -Tjson
270 [
284 [
271 {
285 {
272 "defaultvalue": null,
286 "defaultvalue": null,
273 "name": "empty.source",
287 "name": "empty.source",
274 "source": "",
288 "source": "",
275 "value": "value"
289 "value": "value"
276 }
290 }
277 ]
291 ]
278
292
279 $ cp .hg/hgrc.orig .hg/hgrc
293 $ cp .hg/hgrc.orig .hg/hgrc
280
294
281 Test "%unset"
295 Test "%unset"
282
296
283 $ cat >> $HGRCPATH <<EOF
297 $ cat >> $HGRCPATH <<EOF
284 > [unsettest]
298 > [unsettest]
285 > local-hgrcpath = should be unset (HGRCPATH)
299 > local-hgrcpath = should be unset (HGRCPATH)
286 > %unset local-hgrcpath
300 > %unset local-hgrcpath
287 >
301 >
288 > global = should be unset (HGRCPATH)
302 > global = should be unset (HGRCPATH)
289 >
303 >
290 > both = should be unset (HGRCPATH)
304 > both = should be unset (HGRCPATH)
291 >
305 >
292 > set-after-unset = should be unset (HGRCPATH)
306 > set-after-unset = should be unset (HGRCPATH)
293 > EOF
307 > EOF
294
308
295 $ cat >> .hg/hgrc <<EOF
309 $ cat >> .hg/hgrc <<EOF
296 > [unsettest]
310 > [unsettest]
297 > local-hgrc = should be unset (.hg/hgrc)
311 > local-hgrc = should be unset (.hg/hgrc)
298 > %unset local-hgrc
312 > %unset local-hgrc
299 >
313 >
300 > %unset global
314 > %unset global
301 >
315 >
302 > both = should be unset (.hg/hgrc)
316 > both = should be unset (.hg/hgrc)
303 > %unset both
317 > %unset both
304 >
318 >
305 > set-after-unset = should be unset (.hg/hgrc)
319 > set-after-unset = should be unset (.hg/hgrc)
306 > %unset set-after-unset
320 > %unset set-after-unset
307 > set-after-unset = should be set (.hg/hgrc)
321 > set-after-unset = should be set (.hg/hgrc)
308 > EOF
322 > EOF
309
323
310 $ hg showconfig unsettest
324 $ hg showconfig unsettest
311 unsettest.set-after-unset=should be set (.hg/hgrc)
325 unsettest.set-after-unset=should be set (.hg/hgrc)
312
326
313 Test exit code when no config matches
327 Test exit code when no config matches
314
328
315 $ hg config Section.idontexist
329 $ hg config Section.idontexist
316 [1]
330 [1]
317
331
318 sub-options in [paths] aren't expanded
332 sub-options in [paths] aren't expanded
319
333
320 $ cat > .hg/hgrc << EOF
334 $ cat > .hg/hgrc << EOF
321 > [paths]
335 > [paths]
322 > foo = ~/foo
336 > foo = ~/foo
323 > foo:suboption = ~/foo
337 > foo:suboption = ~/foo
324 > EOF
338 > EOF
325
339
326 $ hg showconfig paths
340 $ hg showconfig paths
327 paths.foo:suboption=~/foo
341 paths.foo:suboption=~/foo
328 paths.foo=$TESTTMP/foo
342 paths.foo=$TESTTMP/foo
329
343
330 edit failure
344 edit failure
331
345
332 $ HGEDITOR=false hg config --edit
346 $ HGEDITOR=false hg config --edit
333 abort: edit failed: false exited with status 1
347 abort: edit failed: false exited with status 1
334 [10]
348 [10]
335
349
336 config affected by environment variables
350 config affected by environment variables
337
351
338 $ EDITOR=e1 VISUAL=e2 hg config --debug | grep 'ui\.editor'
352 $ EDITOR=e1 VISUAL=e2 hg config --debug | grep 'ui\.editor'
339 $VISUAL: ui.editor=e2
353 $VISUAL: ui.editor=e2
340
354
341 $ VISUAL=e2 hg config --debug --config ui.editor=e3 | grep 'ui\.editor'
355 $ VISUAL=e2 hg config --debug --config ui.editor=e3 | grep 'ui\.editor'
342 --config: ui.editor=e3
356 --config: ui.editor=e3
343
357
344 $ PAGER=p1 hg config --debug | grep 'pager\.pager'
358 $ PAGER=p1 hg config --debug | grep 'pager\.pager'
345 $PAGER: pager.pager=p1
359 $PAGER: pager.pager=p1
346
360
347 $ PAGER=p1 hg config --debug --config pager.pager=p2 | grep 'pager\.pager'
361 $ PAGER=p1 hg config --debug --config pager.pager=p2 | grep 'pager\.pager'
348 --config: pager.pager=p2
362 --config: pager.pager=p2
349
363
350 verify that aliases are evaluated as well
364 verify that aliases are evaluated as well
351
365
352 $ hg init aliastest
366 $ hg init aliastest
353 $ cd aliastest
367 $ cd aliastest
354 $ cat > .hg/hgrc << EOF
368 $ cat > .hg/hgrc << EOF
355 > [ui]
369 > [ui]
356 > user = repo user
370 > user = repo user
357 > EOF
371 > EOF
358 $ touch index
372 $ touch index
359 $ unset HGUSER
373 $ unset HGUSER
360 $ hg ci -Am test
374 $ hg ci -Am test
361 adding index
375 adding index
362 $ hg log --template '{author}\n'
376 $ hg log --template '{author}\n'
363 repo user
377 repo user
364 $ cd ..
378 $ cd ..
365
379
366 alias has lower priority
380 alias has lower priority
367
381
368 $ hg init aliaspriority
382 $ hg init aliaspriority
369 $ cd aliaspriority
383 $ cd aliaspriority
370 $ cat > .hg/hgrc << EOF
384 $ cat > .hg/hgrc << EOF
371 > [ui]
385 > [ui]
372 > user = alias user
386 > user = alias user
373 > username = repo user
387 > username = repo user
374 > EOF
388 > EOF
375 $ touch index
389 $ touch index
376 $ unset HGUSER
390 $ unset HGUSER
377 $ hg ci -Am test
391 $ hg ci -Am test
378 adding index
392 adding index
379 $ hg log --template '{author}\n'
393 $ hg log --template '{author}\n'
380 repo user
394 repo user
381 $ cd ..
395 $ cd ..
382
396
383 configs should be read in lexicographical order
397 configs should be read in lexicographical order
384
398
385 $ mkdir configs
399 $ mkdir configs
386 $ for i in `$TESTDIR/seq.py 10 99`; do
400 $ for i in `$TESTDIR/seq.py 10 99`; do
387 > printf "[section]\nkey=$i" > configs/$i.rc
401 > printf "[section]\nkey=$i" > configs/$i.rc
388 > done
402 > done
389 $ HGRCPATH=configs hg config section.key
403 $ HGRCPATH=configs hg config section.key
390 99
404 99
391
405
392 Configuration priority
406 Configuration priority
393 ======================
407 ======================
394
408
395 setup necessary file
409 setup necessary file
396
410
397 $ cat > file-A.rc << EOF
411 $ cat > file-A.rc << EOF
398 > [config-test]
412 > [config-test]
399 > basic = value-A
413 > basic = value-A
400 > pre-include= value-A
414 > pre-include= value-A
401 > %include ./included.rc
415 > %include ./included.rc
402 > post-include= value-A
416 > post-include= value-A
403 > [command-templates]
417 > [command-templates]
404 > log = "value-A\n"
418 > log = "value-A\n"
405 > EOF
419 > EOF
406
420
407 $ cat > file-B.rc << EOF
421 $ cat > file-B.rc << EOF
408 > [config-test]
422 > [config-test]
409 > basic = value-B
423 > basic = value-B
410 > [ui]
424 > [ui]
411 > logtemplate = "value-B\n"
425 > logtemplate = "value-B\n"
412 > EOF
426 > EOF
413
427
414
428
415 $ cat > included.rc << EOF
429 $ cat > included.rc << EOF
416 > [config-test]
430 > [config-test]
417 > pre-include= value-included
431 > pre-include= value-included
418 > post-include= value-included
432 > post-include= value-included
419 > EOF
433 > EOF
420
434
421 $ cat > file-C.rc << EOF
435 $ cat > file-C.rc << EOF
422 > %include ./included-alias-C.rc
436 > %include ./included-alias-C.rc
423 > [ui]
437 > [ui]
424 > logtemplate = "value-C\n"
438 > logtemplate = "value-C\n"
425 > EOF
439 > EOF
426
440
427 $ cat > included-alias-C.rc << EOF
441 $ cat > included-alias-C.rc << EOF
428 > [command-templates]
442 > [command-templates]
429 > log = "value-included\n"
443 > log = "value-included\n"
430 > EOF
444 > EOF
431
445
432
446
433 $ cat > file-D.rc << EOF
447 $ cat > file-D.rc << EOF
434 > [command-templates]
448 > [command-templates]
435 > log = "value-D\n"
449 > log = "value-D\n"
436 > %include ./included-alias-D.rc
450 > %include ./included-alias-D.rc
437 > EOF
451 > EOF
438
452
439 $ cat > included-alias-D.rc << EOF
453 $ cat > included-alias-D.rc << EOF
440 > [ui]
454 > [ui]
441 > logtemplate = "value-included\n"
455 > logtemplate = "value-included\n"
442 > EOF
456 > EOF
443
457
444 Simple order checking
458 Simple order checking
445 ---------------------
459 ---------------------
446
460
447 If file B is read after file A, value from B overwrite value from A.
461 If file B is read after file A, value from B overwrite value from A.
448
462
449 $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic
463 $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg config config-test.basic
450 value-B
464 value-B
451
465
452 Ordering from include
466 Ordering from include
453 ---------------------
467 ---------------------
454
468
455 value from an include overwrite value defined before the include, but not the one defined after the include
469 value from an include overwrite value defined before the include, but not the one defined after the include
456
470
457 $ HGRCPATH="file-A.rc" hg config config-test.pre-include
471 $ HGRCPATH="file-A.rc" hg config config-test.pre-include
458 value-included
472 value-included
459 $ HGRCPATH="file-A.rc" hg config config-test.post-include
473 $ HGRCPATH="file-A.rc" hg config config-test.post-include
460 value-A
474 value-A
461
475
462 command line override
476 command line override
463 ---------------------
477 ---------------------
464
478
465 $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic --config config-test.basic=value-CLI
479 $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg config config-test.basic --config config-test.basic=value-CLI
466 value-CLI
480 value-CLI
467
481
468 Alias ordering
482 Alias ordering
469 --------------
483 --------------
470
484
471 The official config is now `command-templates.log`, the historical
485 The official config is now `command-templates.log`, the historical
472 `ui.logtemplate` is a valid alternative for it.
486 `ui.logtemplate` is a valid alternative for it.
473
487
474 When both are defined, The config value read the last "win", this should keep
488 When both are defined, The config value read the last "win", this should keep
475 being true if the config have other alias. In other word, the config value read
489 being true if the config have other alias. In other word, the config value read
476 earlier will be considered "lower level" and the config read later would be
490 earlier will be considered "lower level" and the config read later would be
477 considered "higher level". And higher level values wins.
491 considered "higher level". And higher level values wins.
478
492
479 $ HGRCPATH="file-A.rc" hg log -r .
493 $ HGRCPATH="file-A.rc" hg log -r .
480 value-A
494 value-A
481 $ HGRCPATH="file-B.rc" hg log -r .
495 $ HGRCPATH="file-B.rc" hg log -r .
482 value-B
496 value-B
483 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
497 $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg log -r .
484 value-B
498 value-B
485
499
486 Alias and include
500 Alias and include
487 -----------------
501 -----------------
488
502
489 The pre/post include priority should also apply when tie-breaking alternatives.
503 The pre/post include priority should also apply when tie-breaking alternatives.
490 See the case above for details about the two config options used.
504 See the case above for details about the two config options used.
491
505
492 $ HGRCPATH="file-C.rc" hg log -r .
506 $ HGRCPATH="file-C.rc" hg log -r .
493 value-C
507 value-C
494 $ HGRCPATH="file-D.rc" hg log -r .
508 $ HGRCPATH="file-D.rc" hg log -r .
495 value-included
509 value-included
496
510
497 command line override
511 command line override
498 ---------------------
512 ---------------------
499
513
500 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r . --config ui.logtemplate="value-CLI\n"
514 $ HGRCPATH=`path_list_var "file-A.rc:file-B.rc"` hg log -r . --config ui.logtemplate="value-CLI\n"
501 value-CLI
515 value-CLI
General Comments 0
You need to be logged in to leave comments. Login now