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