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