Show More
@@ -1,261 +1,263 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 | $ chmod u-r $TESTTMP/included |
|
60 | $ chmod u-r $TESTTMP/included | |
60 | $ hg showconfig section |
|
61 | $ hg showconfig section | |
61 | 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) | |
62 | [255] |
|
63 | [255] | |
|
64 | #endif | |||
63 |
|
65 | |||
64 | issue1829: wrong indentation |
|
66 | issue1829: wrong indentation | |
65 |
|
67 | |||
66 | $ echo '[foo]' > $HGRC |
|
68 | $ echo '[foo]' > $HGRC | |
67 | $ echo ' x = y' >> $HGRC |
|
69 | $ echo ' x = y' >> $HGRC | |
68 | $ hg version |
|
70 | $ hg version | |
69 | hg: parse error at $TESTTMP/hgrc:2: x = y |
|
71 | hg: parse error at $TESTTMP/hgrc:2: x = y | |
70 | unexpected leading whitespace |
|
72 | unexpected leading whitespace | |
71 | [255] |
|
73 | [255] | |
72 |
|
74 | |||
73 | $ "$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')" \ | |
74 | > > $HGRC |
|
76 | > > $HGRC | |
75 | $ hg showconfig foo |
|
77 | $ hg showconfig foo | |
76 | foo.bar=a\nb\nc\nde\nfg |
|
78 | foo.bar=a\nb\nc\nde\nfg | |
77 | foo.baz=bif cb |
|
79 | foo.baz=bif cb | |
78 |
|
80 | |||
79 | $ FAKEPATH=/path/to/nowhere |
|
81 | $ FAKEPATH=/path/to/nowhere | |
80 | $ export FAKEPATH |
|
82 | $ export FAKEPATH | |
81 | $ echo '%include $FAKEPATH/no-such-file' > $HGRC |
|
83 | $ echo '%include $FAKEPATH/no-such-file' > $HGRC | |
82 | $ hg version |
|
84 | $ hg version | |
83 | Mercurial Distributed SCM (version *) (glob) |
|
85 | Mercurial Distributed SCM (version *) (glob) | |
84 | (see https://mercurial-scm.org for more information) |
|
86 | (see https://mercurial-scm.org for more information) | |
85 |
|
87 | |||
86 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
88 | Copyright (C) 2005-* Matt Mackall and others (glob) | |
87 | 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 | |
88 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
90 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
89 | $ unset FAKEPATH |
|
91 | $ unset FAKEPATH | |
90 |
|
92 | |||
91 | make sure global options given on the cmdline take precedence |
|
93 | make sure global options given on the cmdline take precedence | |
92 |
|
94 | |||
93 | $ hg showconfig --config ui.verbose=True --quiet |
|
95 | $ hg showconfig --config ui.verbose=True --quiet | |
94 | bundle.mainreporoot=$TESTTMP |
|
96 | bundle.mainreporoot=$TESTTMP | |
95 | ui.verbose=False |
|
97 | ui.verbose=False | |
96 | ui.debug=False |
|
98 | ui.debug=False | |
97 | ui.quiet=True |
|
99 | ui.quiet=True | |
98 |
|
100 | |||
99 | $ touch foobar/untracked |
|
101 | $ touch foobar/untracked | |
100 | $ cat >> foobar/.hg/hgrc <<EOF |
|
102 | $ cat >> foobar/.hg/hgrc <<EOF | |
101 | > [ui] |
|
103 | > [ui] | |
102 | > verbose=True |
|
104 | > verbose=True | |
103 | > EOF |
|
105 | > EOF | |
104 | $ hg -R foobar st -q |
|
106 | $ hg -R foobar st -q | |
105 |
|
107 | |||
106 | username expansion |
|
108 | username expansion | |
107 |
|
109 | |||
108 | $ olduser=$HGUSER |
|
110 | $ olduser=$HGUSER | |
109 | $ unset HGUSER |
|
111 | $ unset HGUSER | |
110 |
|
112 | |||
111 | $ FAKEUSER='John Doe' |
|
113 | $ FAKEUSER='John Doe' | |
112 | $ export FAKEUSER |
|
114 | $ export FAKEUSER | |
113 | $ echo '[ui]' > $HGRC |
|
115 | $ echo '[ui]' > $HGRC | |
114 | $ echo 'username = $FAKEUSER' >> $HGRC |
|
116 | $ echo 'username = $FAKEUSER' >> $HGRC | |
115 |
|
117 | |||
116 | $ hg init usertest |
|
118 | $ hg init usertest | |
117 | $ cd usertest |
|
119 | $ cd usertest | |
118 | $ touch bar |
|
120 | $ touch bar | |
119 | $ hg commit --addremove --quiet -m "added bar" |
|
121 | $ hg commit --addremove --quiet -m "added bar" | |
120 | $ hg log --template "{author}\n" |
|
122 | $ hg log --template "{author}\n" | |
121 | John Doe |
|
123 | John Doe | |
122 | $ cd .. |
|
124 | $ cd .. | |
123 |
|
125 | |||
124 | $ hg showconfig |
|
126 | $ hg showconfig | |
125 | bundle.mainreporoot=$TESTTMP |
|
127 | bundle.mainreporoot=$TESTTMP | |
126 | ui.username=$FAKEUSER |
|
128 | ui.username=$FAKEUSER | |
127 |
|
129 | |||
128 | $ unset FAKEUSER |
|
130 | $ unset FAKEUSER | |
129 | $ HGUSER=$olduser |
|
131 | $ HGUSER=$olduser | |
130 | $ export HGUSER |
|
132 | $ export HGUSER | |
131 |
|
133 | |||
132 | showconfig with multiple arguments |
|
134 | showconfig with multiple arguments | |
133 |
|
135 | |||
134 | $ echo "[alias]" > $HGRC |
|
136 | $ echo "[alias]" > $HGRC | |
135 | $ echo "log = log -g" >> $HGRC |
|
137 | $ echo "log = log -g" >> $HGRC | |
136 | $ echo "[defaults]" >> $HGRC |
|
138 | $ echo "[defaults]" >> $HGRC | |
137 | $ echo "identify = -n" >> $HGRC |
|
139 | $ echo "identify = -n" >> $HGRC | |
138 | $ hg showconfig alias defaults |
|
140 | $ hg showconfig alias defaults | |
139 | alias.log=log -g |
|
141 | alias.log=log -g | |
140 | defaults.identify=-n |
|
142 | defaults.identify=-n | |
141 | $ hg showconfig alias alias |
|
143 | $ hg showconfig alias alias | |
142 | alias.log=log -g |
|
144 | alias.log=log -g | |
143 | $ hg showconfig alias.log alias.log |
|
145 | $ hg showconfig alias.log alias.log | |
144 | alias.log=log -g |
|
146 | alias.log=log -g | |
145 | $ hg showconfig alias defaults.identify |
|
147 | $ hg showconfig alias defaults.identify | |
146 | alias.log=log -g |
|
148 | alias.log=log -g | |
147 | defaults.identify=-n |
|
149 | defaults.identify=-n | |
148 | $ hg showconfig alias.log defaults.identify |
|
150 | $ hg showconfig alias.log defaults.identify | |
149 | alias.log=log -g |
|
151 | alias.log=log -g | |
150 | defaults.identify=-n |
|
152 | defaults.identify=-n | |
151 |
|
153 | |||
152 | HGPLAIN |
|
154 | HGPLAIN | |
153 |
|
155 | |||
154 | $ echo "[ui]" > $HGRC |
|
156 | $ echo "[ui]" > $HGRC | |
155 | $ echo "debug=true" >> $HGRC |
|
157 | $ echo "debug=true" >> $HGRC | |
156 | $ echo "fallbackencoding=ASCII" >> $HGRC |
|
158 | $ echo "fallbackencoding=ASCII" >> $HGRC | |
157 | $ echo "quiet=true" >> $HGRC |
|
159 | $ echo "quiet=true" >> $HGRC | |
158 | $ echo "slash=true" >> $HGRC |
|
160 | $ echo "slash=true" >> $HGRC | |
159 | $ echo "traceback=true" >> $HGRC |
|
161 | $ echo "traceback=true" >> $HGRC | |
160 | $ echo "verbose=true" >> $HGRC |
|
162 | $ echo "verbose=true" >> $HGRC | |
161 | $ echo "style=~/.hgstyle" >> $HGRC |
|
163 | $ echo "style=~/.hgstyle" >> $HGRC | |
162 | $ echo "logtemplate={node}" >> $HGRC |
|
164 | $ echo "logtemplate={node}" >> $HGRC | |
163 | $ echo "[defaults]" >> $HGRC |
|
165 | $ echo "[defaults]" >> $HGRC | |
164 | $ echo "identify=-n" >> $HGRC |
|
166 | $ echo "identify=-n" >> $HGRC | |
165 | $ echo "[alias]" >> $HGRC |
|
167 | $ echo "[alias]" >> $HGRC | |
166 | $ echo "log=log -g" >> $HGRC |
|
168 | $ echo "log=log -g" >> $HGRC | |
167 |
|
169 | |||
168 | customized hgrc |
|
170 | customized hgrc | |
169 |
|
171 | |||
170 | $ hg showconfig |
|
172 | $ hg showconfig | |
171 | read config from: $TESTTMP/hgrc |
|
173 | read config from: $TESTTMP/hgrc | |
172 | $TESTTMP/hgrc:13: alias.log=log -g |
|
174 | $TESTTMP/hgrc:13: alias.log=log -g | |
173 | repo: bundle.mainreporoot=$TESTTMP |
|
175 | repo: bundle.mainreporoot=$TESTTMP | |
174 | $TESTTMP/hgrc:11: defaults.identify=-n |
|
176 | $TESTTMP/hgrc:11: defaults.identify=-n | |
175 | $TESTTMP/hgrc:2: ui.debug=true |
|
177 | $TESTTMP/hgrc:2: ui.debug=true | |
176 | $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII |
|
178 | $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII | |
177 | $TESTTMP/hgrc:4: ui.quiet=true |
|
179 | $TESTTMP/hgrc:4: ui.quiet=true | |
178 | $TESTTMP/hgrc:5: ui.slash=true |
|
180 | $TESTTMP/hgrc:5: ui.slash=true | |
179 | $TESTTMP/hgrc:6: ui.traceback=true |
|
181 | $TESTTMP/hgrc:6: ui.traceback=true | |
180 | $TESTTMP/hgrc:7: ui.verbose=true |
|
182 | $TESTTMP/hgrc:7: ui.verbose=true | |
181 | $TESTTMP/hgrc:8: ui.style=~/.hgstyle |
|
183 | $TESTTMP/hgrc:8: ui.style=~/.hgstyle | |
182 | $TESTTMP/hgrc:9: ui.logtemplate={node} |
|
184 | $TESTTMP/hgrc:9: ui.logtemplate={node} | |
183 |
|
185 | |||
184 | plain hgrc |
|
186 | plain hgrc | |
185 |
|
187 | |||
186 | $ HGPLAIN=; export HGPLAIN |
|
188 | $ HGPLAIN=; export HGPLAIN | |
187 | $ hg showconfig --config ui.traceback=True --debug |
|
189 | $ hg showconfig --config ui.traceback=True --debug | |
188 | read config from: $TESTTMP/hgrc |
|
190 | read config from: $TESTTMP/hgrc | |
189 | repo: bundle.mainreporoot=$TESTTMP |
|
191 | repo: bundle.mainreporoot=$TESTTMP | |
190 | --config: ui.traceback=True |
|
192 | --config: ui.traceback=True | |
191 | --verbose: ui.verbose=False |
|
193 | --verbose: ui.verbose=False | |
192 | --debug: ui.debug=True |
|
194 | --debug: ui.debug=True | |
193 | --quiet: ui.quiet=False |
|
195 | --quiet: ui.quiet=False | |
194 |
|
196 | |||
195 | with environment variables |
|
197 | with environment variables | |
196 |
|
198 | |||
197 | $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug |
|
199 | $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug | |
198 | set config by: $EDITOR |
|
200 | set config by: $EDITOR | |
199 | set config by: $VISUAL |
|
201 | set config by: $VISUAL | |
200 | set config by: $PAGER |
|
202 | set config by: $PAGER | |
201 | read config from: $TESTTMP/hgrc |
|
203 | read config from: $TESTTMP/hgrc | |
202 | repo: bundle.mainreporoot=$TESTTMP |
|
204 | repo: bundle.mainreporoot=$TESTTMP | |
203 | $PAGER: pager.pager=p1 |
|
205 | $PAGER: pager.pager=p1 | |
204 | $VISUAL: ui.editor=e2 |
|
206 | $VISUAL: ui.editor=e2 | |
205 | --verbose: ui.verbose=False |
|
207 | --verbose: ui.verbose=False | |
206 | --debug: ui.debug=True |
|
208 | --debug: ui.debug=True | |
207 | --quiet: ui.quiet=False |
|
209 | --quiet: ui.quiet=False | |
208 |
|
210 | |||
209 | plain mode with exceptions |
|
211 | plain mode with exceptions | |
210 |
|
212 | |||
211 | $ cat > plain.py <<EOF |
|
213 | $ cat > plain.py <<EOF | |
212 | > from mercurial import commands, extensions |
|
214 | > from mercurial import commands, extensions | |
213 | > def _config(orig, ui, repo, *values, **opts): |
|
215 | > def _config(orig, ui, repo, *values, **opts): | |
214 | > ui.write(b'plain: %r\n' % ui.plain()) |
|
216 | > ui.write(b'plain: %r\n' % ui.plain()) | |
215 | > return orig(ui, repo, *values, **opts) |
|
217 | > return orig(ui, repo, *values, **opts) | |
216 | > def uisetup(ui): |
|
218 | > def uisetup(ui): | |
217 | > extensions.wrapcommand(commands.table, b'config', _config) |
|
219 | > extensions.wrapcommand(commands.table, b'config', _config) | |
218 | > EOF |
|
220 | > EOF | |
219 | $ echo "[extensions]" >> $HGRC |
|
221 | $ echo "[extensions]" >> $HGRC | |
220 | $ echo "plain=./plain.py" >> $HGRC |
|
222 | $ echo "plain=./plain.py" >> $HGRC | |
221 | $ HGPLAINEXCEPT=; export HGPLAINEXCEPT |
|
223 | $ HGPLAINEXCEPT=; export HGPLAINEXCEPT | |
222 | $ hg showconfig --config ui.traceback=True --debug |
|
224 | $ hg showconfig --config ui.traceback=True --debug | |
223 | plain: True |
|
225 | plain: True | |
224 | read config from: $TESTTMP/hgrc |
|
226 | read config from: $TESTTMP/hgrc | |
225 | repo: bundle.mainreporoot=$TESTTMP |
|
227 | repo: bundle.mainreporoot=$TESTTMP | |
226 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
228 | $TESTTMP/hgrc:15: extensions.plain=./plain.py | |
227 | --config: ui.traceback=True |
|
229 | --config: ui.traceback=True | |
228 | --verbose: ui.verbose=False |
|
230 | --verbose: ui.verbose=False | |
229 | --debug: ui.debug=True |
|
231 | --debug: ui.debug=True | |
230 | --quiet: ui.quiet=False |
|
232 | --quiet: ui.quiet=False | |
231 | $ unset HGPLAIN |
|
233 | $ unset HGPLAIN | |
232 | $ hg showconfig --config ui.traceback=True --debug |
|
234 | $ hg showconfig --config ui.traceback=True --debug | |
233 | plain: True |
|
235 | plain: True | |
234 | read config from: $TESTTMP/hgrc |
|
236 | read config from: $TESTTMP/hgrc | |
235 | repo: bundle.mainreporoot=$TESTTMP |
|
237 | repo: bundle.mainreporoot=$TESTTMP | |
236 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
238 | $TESTTMP/hgrc:15: extensions.plain=./plain.py | |
237 | --config: ui.traceback=True |
|
239 | --config: ui.traceback=True | |
238 | --verbose: ui.verbose=False |
|
240 | --verbose: ui.verbose=False | |
239 | --debug: ui.debug=True |
|
241 | --debug: ui.debug=True | |
240 | --quiet: ui.quiet=False |
|
242 | --quiet: ui.quiet=False | |
241 | $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT |
|
243 | $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT | |
242 | $ hg showconfig --config ui.traceback=True --debug |
|
244 | $ hg showconfig --config ui.traceback=True --debug | |
243 | plain: True |
|
245 | plain: True | |
244 | read config from: $TESTTMP/hgrc |
|
246 | read config from: $TESTTMP/hgrc | |
245 | repo: bundle.mainreporoot=$TESTTMP |
|
247 | repo: bundle.mainreporoot=$TESTTMP | |
246 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
248 | $TESTTMP/hgrc:15: extensions.plain=./plain.py | |
247 | --config: ui.traceback=True |
|
249 | --config: ui.traceback=True | |
248 | --verbose: ui.verbose=False |
|
250 | --verbose: ui.verbose=False | |
249 | --debug: ui.debug=True |
|
251 | --debug: ui.debug=True | |
250 | --quiet: ui.quiet=False |
|
252 | --quiet: ui.quiet=False | |
251 |
|
253 | |||
252 | source of paths is not mangled |
|
254 | source of paths is not mangled | |
253 |
|
255 | |||
254 | $ cat >> $HGRCPATH <<EOF |
|
256 | $ cat >> $HGRCPATH <<EOF | |
255 | > [paths] |
|
257 | > [paths] | |
256 | > foo = bar |
|
258 | > foo = bar | |
257 | > EOF |
|
259 | > EOF | |
258 | $ hg showconfig --debug paths |
|
260 | $ hg showconfig --debug paths | |
259 | plain: True |
|
261 | plain: True | |
260 | read config from: $TESTTMP/hgrc |
|
262 | read config from: $TESTTMP/hgrc | |
261 | $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar |
|
263 | $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar |
General Comments 0
You need to be logged in to leave comments.
Login now