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