Show More
@@ -1,307 +1,318 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 | config 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 | 59 | #if unix-permissions no-root |
|
60 | 60 | $ chmod u-r $TESTTMP/included |
|
61 | 61 | $ hg showconfig section |
|
62 | 62 | config error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied*) (glob) |
|
63 | 63 | [255] |
|
64 | 64 | #endif |
|
65 | 65 | |
|
66 | 66 | issue1829: wrong indentation |
|
67 | 67 | |
|
68 | 68 | $ echo '[foo]' > $HGRC |
|
69 | 69 | $ echo ' x = y' >> $HGRC |
|
70 | 70 | $ hg version |
|
71 | 71 | config error at $TESTTMP/hgrc:2: unexpected leading whitespace: x = y |
|
72 | 72 | [255] |
|
73 | 73 | |
|
74 | 74 | $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \ |
|
75 | 75 | > > $HGRC |
|
76 | 76 | $ hg showconfig foo |
|
77 | 77 | foo.bar=a\nb\nc\nde\nfg |
|
78 | 78 | foo.baz=bif cb |
|
79 | 79 | |
|
80 | 80 | $ FAKEPATH=/path/to/nowhere |
|
81 | 81 | $ export FAKEPATH |
|
82 | 82 | $ echo '%include $FAKEPATH/no-such-file' > $HGRC |
|
83 | 83 | $ hg version |
|
84 | 84 | Mercurial Distributed SCM (version *) (glob) |
|
85 | 85 | (see https://mercurial-scm.org for more information) |
|
86 | 86 | |
|
87 | 87 | Copyright (C) 2005-* Olivia Mackall and others (glob) |
|
88 | 88 | This is free software; see the source for copying conditions. There is NO |
|
89 | 89 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
90 | 90 | $ unset FAKEPATH |
|
91 | 91 | |
|
92 | 92 | make sure global options given on the cmdline take precedence |
|
93 | 93 | |
|
94 | 94 | $ hg showconfig --config ui.verbose=True --quiet |
|
95 | 95 | bundle.mainreporoot=$TESTTMP |
|
96 | 96 | ui.verbose=False |
|
97 | 97 | ui.debug=False |
|
98 | 98 | ui.quiet=True |
|
99 | 99 | |
|
100 | 100 | $ touch foobar/untracked |
|
101 | 101 | $ cat >> foobar/.hg/hgrc <<EOF |
|
102 | 102 | > [ui] |
|
103 | 103 | > verbose=True |
|
104 | 104 | > EOF |
|
105 | 105 | $ hg -R foobar st -q |
|
106 | 106 | |
|
107 | 107 | username expansion |
|
108 | 108 | |
|
109 | 109 | $ olduser=$HGUSER |
|
110 | 110 | $ unset HGUSER |
|
111 | 111 | |
|
112 | 112 | $ FAKEUSER='John Doe' |
|
113 | 113 | $ export FAKEUSER |
|
114 | 114 | $ echo '[ui]' > $HGRC |
|
115 | 115 | $ echo 'username = $FAKEUSER' >> $HGRC |
|
116 | 116 | |
|
117 | 117 | $ hg init usertest |
|
118 | 118 | $ cd usertest |
|
119 | 119 | $ touch bar |
|
120 | 120 | $ hg commit --addremove --quiet -m "added bar" |
|
121 | 121 | $ hg log --template "{author}\n" |
|
122 | 122 | John Doe |
|
123 | 123 | $ cd .. |
|
124 | 124 | |
|
125 | 125 | $ hg showconfig |
|
126 | 126 | bundle.mainreporoot=$TESTTMP |
|
127 | 127 | ui.username=$FAKEUSER |
|
128 | 128 | |
|
129 | 129 | $ unset FAKEUSER |
|
130 | 130 | $ HGUSER=$olduser |
|
131 | 131 | $ export HGUSER |
|
132 | 132 | |
|
133 | 133 | showconfig with multiple arguments |
|
134 | 134 | |
|
135 | 135 | $ echo "[alias]" > $HGRC |
|
136 | 136 | $ echo "log = log -g" >> $HGRC |
|
137 | 137 | $ echo "[defaults]" >> $HGRC |
|
138 | 138 | $ echo "identify = -n" >> $HGRC |
|
139 | 139 | $ hg showconfig alias defaults |
|
140 | 140 | alias.log=log -g |
|
141 | 141 | defaults.identify=-n |
|
142 | 142 | $ hg showconfig alias alias |
|
143 | 143 | alias.log=log -g |
|
144 | 144 | $ hg showconfig alias.log alias.log |
|
145 | 145 | alias.log=log -g |
|
146 | 146 | $ hg showconfig alias defaults.identify |
|
147 | 147 | alias.log=log -g |
|
148 | 148 | defaults.identify=-n |
|
149 | 149 | $ hg showconfig alias.log defaults.identify |
|
150 | 150 | alias.log=log -g |
|
151 | 151 | defaults.identify=-n |
|
152 | 152 | |
|
153 | 153 | HGPLAIN |
|
154 | 154 | |
|
155 | 155 | $ echo "[ui]" > $HGRC |
|
156 | 156 | $ echo "debug=true" >> $HGRC |
|
157 | 157 | $ echo "fallbackencoding=ASCII" >> $HGRC |
|
158 | 158 | $ echo "quiet=true" >> $HGRC |
|
159 | 159 | $ echo "slash=true" >> $HGRC |
|
160 | 160 | $ echo "traceback=true" >> $HGRC |
|
161 | 161 | $ echo "verbose=true" >> $HGRC |
|
162 | 162 | $ echo "style=~/.hgstyle" >> $HGRC |
|
163 | 163 | $ echo "logtemplate={node}" >> $HGRC |
|
164 | 164 | $ echo "[defaults]" >> $HGRC |
|
165 | 165 | $ echo "identify=-n" >> $HGRC |
|
166 | 166 | $ echo "[alias]" >> $HGRC |
|
167 | 167 | $ echo "log=log -g" >> $HGRC |
|
168 | 168 | |
|
169 | 169 | customized hgrc |
|
170 | 170 | |
|
171 | 171 | $ hg showconfig |
|
172 | 172 | read config from: $TESTTMP/hgrc |
|
173 | 173 | $TESTTMP/hgrc:13: alias.log=log -g |
|
174 | 174 | repo: bundle.mainreporoot=$TESTTMP |
|
175 | 175 | $TESTTMP/hgrc:11: defaults.identify=-n |
|
176 | 176 | $TESTTMP/hgrc:2: ui.debug=true |
|
177 | 177 | $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII |
|
178 | 178 | $TESTTMP/hgrc:4: ui.quiet=true |
|
179 | 179 | $TESTTMP/hgrc:5: ui.slash=true |
|
180 | 180 | $TESTTMP/hgrc:6: ui.traceback=true |
|
181 | 181 | $TESTTMP/hgrc:7: ui.verbose=true |
|
182 | 182 | $TESTTMP/hgrc:8: ui.style=~/.hgstyle |
|
183 | 183 | $TESTTMP/hgrc:9: ui.logtemplate={node} |
|
184 | 184 | |
|
185 | 185 | plain hgrc |
|
186 | 186 | |
|
187 | 187 | $ HGPLAIN=; export HGPLAIN |
|
188 | 188 | $ hg showconfig --config ui.traceback=True --debug |
|
189 | 189 | read config from: $TESTTMP/hgrc |
|
190 | 190 | repo: bundle.mainreporoot=$TESTTMP |
|
191 | 191 | --config: ui.traceback=True |
|
192 | 192 | --verbose: ui.verbose=False |
|
193 | 193 | --debug: ui.debug=True |
|
194 | 194 | --quiet: ui.quiet=False |
|
195 | 195 | |
|
196 | 196 | with environment variables |
|
197 | 197 | |
|
198 | 198 | $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug |
|
199 | 199 | read config from: $TESTTMP/hgrc |
|
200 | 200 | repo: bundle.mainreporoot=$TESTTMP |
|
201 | 201 | $PAGER: pager.pager=p1 |
|
202 | 202 | $VISUAL: ui.editor=e2 |
|
203 | 203 | --verbose: ui.verbose=False |
|
204 | 204 | --debug: ui.debug=True |
|
205 | 205 | --quiet: ui.quiet=False |
|
206 | 206 | |
|
207 | 207 | plain mode with exceptions |
|
208 | 208 | |
|
209 | 209 | $ cat > plain.py <<EOF |
|
210 | 210 | > from mercurial import commands, extensions |
|
211 | 211 | > def _config(orig, ui, repo, *values, **opts): |
|
212 | 212 | > ui.write(b'plain: %r\n' % ui.plain()) |
|
213 | 213 | > return orig(ui, repo, *values, **opts) |
|
214 | 214 | > def uisetup(ui): |
|
215 | 215 | > extensions.wrapcommand(commands.table, b'config', _config) |
|
216 | 216 | > EOF |
|
217 | 217 | $ echo "[extensions]" >> $HGRC |
|
218 | 218 | $ echo "plain=./plain.py" >> $HGRC |
|
219 | 219 | $ HGPLAINEXCEPT=; export HGPLAINEXCEPT |
|
220 | 220 | $ hg showconfig --config ui.traceback=True --debug |
|
221 | 221 | plain: True |
|
222 | 222 | read config from: $TESTTMP/hgrc |
|
223 | 223 | repo: bundle.mainreporoot=$TESTTMP |
|
224 | 224 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
225 | 225 | --config: ui.traceback=True |
|
226 | 226 | --verbose: ui.verbose=False |
|
227 | 227 | --debug: ui.debug=True |
|
228 | 228 | --quiet: ui.quiet=False |
|
229 | 229 | $ unset HGPLAIN |
|
230 | 230 | $ hg showconfig --config ui.traceback=True --debug |
|
231 | 231 | plain: True |
|
232 | 232 | read config from: $TESTTMP/hgrc |
|
233 | 233 | repo: bundle.mainreporoot=$TESTTMP |
|
234 | 234 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
235 | 235 | --config: ui.traceback=True |
|
236 | 236 | --verbose: ui.verbose=False |
|
237 | 237 | --debug: ui.debug=True |
|
238 | 238 | --quiet: ui.quiet=False |
|
239 | 239 | $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT |
|
240 | 240 | $ hg showconfig --config ui.traceback=True --debug |
|
241 | 241 | plain: True |
|
242 | 242 | read config from: $TESTTMP/hgrc |
|
243 | 243 | repo: bundle.mainreporoot=$TESTTMP |
|
244 | 244 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
245 | 245 | --config: ui.traceback=True |
|
246 | 246 | --verbose: ui.verbose=False |
|
247 | 247 | --debug: ui.debug=True |
|
248 | 248 | --quiet: ui.quiet=False |
|
249 | 249 | |
|
250 | 250 | source of paths is not mangled |
|
251 | 251 | |
|
252 | 252 | $ cat >> $HGRCPATH <<EOF |
|
253 | 253 | > [paths] |
|
254 | 254 | > foo = bar |
|
255 | 255 | > EOF |
|
256 | 256 | $ hg showconfig --source paths |
|
257 | 257 | plain: True |
|
258 | 258 | $TESTTMP/hgrc:17: paths.foo=bar |
|
259 | 259 | |
|
260 | 260 | Test we can skip the user configuration |
|
261 | 261 | |
|
262 | 262 | $ cat >> .hg/hgrc <<EOF |
|
263 | 263 | > [paths] |
|
264 | 264 | > elephant = babar |
|
265 | 265 | > EOF |
|
266 | 266 | $ hg path |
|
267 | 267 | elephant = $TESTTMP/babar |
|
268 | 268 | foo = $TESTTMP/bar |
|
269 | 269 | $ HGRCSKIPREPO=1 hg path |
|
270 | 270 | foo = $TESTTMP/bar |
|
271 | 271 | |
|
272 | 272 | $ cat >> .hg/hgrc <<EOF |
|
273 | 273 | > [broken |
|
274 | 274 | > EOF |
|
275 | 275 | |
|
276 | 276 | $ hg path |
|
277 | 277 | config error at $TESTTMP/.hg/hgrc:3: [broken |
|
278 | 278 | [255] |
|
279 | 279 | $ HGRCSKIPREPO=1 hg path |
|
280 | 280 | foo = $TESTTMP/bar |
|
281 | 281 | |
|
282 | 282 | Check that hgweb respect HGRCSKIPREPO=1 |
|
283 | 283 | |
|
284 | 284 | $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
285 | 285 | config error at $TESTTMP/.hg/hgrc:3: [broken |
|
286 | 286 | [255] |
|
287 | 287 | $ test -f hg.pid && (cat hg.pid >> $DAEMON_PIDS) |
|
288 | 288 | [1] |
|
289 | 289 | $ killdaemons.py |
|
290 | 290 | $ test -f access.log && cat access.log |
|
291 | 291 | [1] |
|
292 | 292 | $ test -f errors.log && cat errors.log |
|
293 | 293 | [1] |
|
294 | 294 | |
|
295 | 295 | $ HGRCSKIPREPO=1 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
296 | 296 | $ cat hg.pid >> $DAEMON_PIDS |
|
297 | 297 | $ killdaemons.py |
|
298 | 298 | $ cat access.log |
|
299 | 299 | $ cat errors.log |
|
300 | 300 | |
|
301 | 301 | Check that zeroconf respect HGRCSKIPREPO=1 |
|
302 | 302 | |
|
303 | 303 | $ hg paths --config extensions.zeroconf= |
|
304 | 304 | config error at $TESTTMP/.hg/hgrc:3: [broken |
|
305 | 305 | [255] |
|
306 | ||
|
307 | XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason, | |
|
308 | we accept the bad output for now as this is the last thing in the way of | |
|
309 | testing the pyoxidizer build. | |
|
310 | ||
|
311 | #if no-pyoxidizer | |
|
306 | 312 | $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf= |
|
307 | 313 | foo = $TESTTMP/bar |
|
314 | #else | |
|
315 | $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf= | |
|
316 | abort: An invalid argument was supplied (known-bad-output !) | |
|
317 | [255] | |
|
318 | #endif |
@@ -1,521 +1,532 b'' | |||
|
1 | 1 | $ hg init a |
|
2 | 2 | $ hg clone a b |
|
3 | 3 | updating to branch default |
|
4 | 4 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
5 | 5 | $ cd a |
|
6 | 6 | |
|
7 | 7 | with no paths: |
|
8 | 8 | |
|
9 | 9 | $ hg paths |
|
10 | 10 | $ hg paths unknown |
|
11 | 11 | not found! |
|
12 | 12 | [1] |
|
13 | 13 | $ hg paths -Tjson |
|
14 | 14 | [ |
|
15 | 15 | ] |
|
16 | 16 | |
|
17 | 17 | with paths: |
|
18 | 18 | |
|
19 | 19 | $ echo '[paths]' >> .hg/hgrc |
|
20 | 20 | $ echo 'dupe = ../b#tip' >> .hg/hgrc |
|
21 | 21 | $ echo 'expand = $SOMETHING/bar' >> .hg/hgrc |
|
22 | 22 | $ hg in dupe |
|
23 | 23 | comparing with $TESTTMP/b |
|
24 | 24 | no changes found |
|
25 | 25 | [1] |
|
26 | 26 | $ cd .. |
|
27 | 27 | $ hg -R a in dupe |
|
28 | 28 | comparing with $TESTTMP/b |
|
29 | 29 | no changes found |
|
30 | 30 | [1] |
|
31 | 31 | $ cd a |
|
32 | 32 | $ hg paths |
|
33 | 33 | dupe = $TESTTMP/b#tip |
|
34 | 34 | expand = $TESTTMP/a/$SOMETHING/bar |
|
35 | 35 | $ SOMETHING=foo hg paths |
|
36 | 36 | dupe = $TESTTMP/b#tip |
|
37 | 37 | expand = $TESTTMP/a/foo/bar |
|
38 | 38 | #if msys |
|
39 | 39 | $ SOMETHING=//foo hg paths |
|
40 | 40 | dupe = $TESTTMP/b#tip |
|
41 | 41 | expand = /foo/bar |
|
42 | 42 | #else |
|
43 | 43 | $ SOMETHING=/foo hg paths |
|
44 | 44 | dupe = $TESTTMP/b#tip |
|
45 | 45 | expand = /foo/bar |
|
46 | 46 | #endif |
|
47 | 47 | $ hg paths -q |
|
48 | 48 | dupe |
|
49 | 49 | expand |
|
50 | 50 | $ hg paths dupe |
|
51 | 51 | $TESTTMP/b#tip |
|
52 | 52 | $ hg paths -q dupe |
|
53 | 53 | $ hg paths unknown |
|
54 | 54 | not found! |
|
55 | 55 | [1] |
|
56 | 56 | $ hg paths -q unknown |
|
57 | 57 | [1] |
|
58 | 58 | |
|
59 | 59 | formatter output with paths: |
|
60 | 60 | |
|
61 | 61 | $ echo 'dupe:pushurl = https://example.com/dupe' >> .hg/hgrc |
|
62 | 62 | $ hg paths -Tjson | sed 's|\\\\|\\|g' |
|
63 | 63 | [ |
|
64 | 64 | { |
|
65 | 65 | "name": "dupe", |
|
66 | 66 | "pushurl": "https://example.com/dupe", |
|
67 | 67 | "url": "$TESTTMP/b#tip" |
|
68 | 68 | }, |
|
69 | 69 | { |
|
70 | 70 | "name": "expand", |
|
71 | 71 | "url": "$TESTTMP/a/$SOMETHING/bar" |
|
72 | 72 | } |
|
73 | 73 | ] |
|
74 | 74 | $ hg paths -Tjson dupe | sed 's|\\\\|\\|g' |
|
75 | 75 | [ |
|
76 | 76 | { |
|
77 | 77 | "name": "dupe", |
|
78 | 78 | "pushurl": "https://example.com/dupe", |
|
79 | 79 | "url": "$TESTTMP/b#tip" |
|
80 | 80 | } |
|
81 | 81 | ] |
|
82 | 82 | $ hg paths -Tjson -q unknown |
|
83 | 83 | [ |
|
84 | 84 | ] |
|
85 | 85 | [1] |
|
86 | 86 | |
|
87 | 87 | log template: |
|
88 | 88 | |
|
89 | 89 | (behaves as a {name: path-string} dict by default) |
|
90 | 90 | |
|
91 | 91 | $ hg log -rnull -T '{peerurls}\n' |
|
92 | 92 | dupe=$TESTTMP/b#tip expand=$TESTTMP/a/$SOMETHING/bar |
|
93 | 93 | $ hg log -rnull -T '{join(peerurls, "\n")}\n' |
|
94 | 94 | dupe=$TESTTMP/b#tip |
|
95 | 95 | expand=$TESTTMP/a/$SOMETHING/bar |
|
96 | 96 | $ hg log -rnull -T '{peerurls % "{name}: {url}\n"}' |
|
97 | 97 | dupe: $TESTTMP/b#tip |
|
98 | 98 | expand: $TESTTMP/a/$SOMETHING/bar |
|
99 | 99 | $ hg log -rnull -T '{get(peerurls, "dupe")}\n' |
|
100 | 100 | $TESTTMP/b#tip |
|
101 | 101 | #if windows |
|
102 | 102 | $ hg log -rnull -T '{peerurls % "{urls|json}\n"}' |
|
103 | 103 | [{"pushurl": "https://example.com/dupe", "url": "$STR_REPR_TESTTMP\\b#tip"}] |
|
104 | 104 | [{"url": "$STR_REPR_TESTTMP\\a\\$SOMETHING\\bar"}] |
|
105 | 105 | #else |
|
106 | 106 | $ hg log -rnull -T '{peerurls % "{urls|json}\n"}' |
|
107 | 107 | [{"pushurl": "https://example.com/dupe", "url": "$TESTTMP/b#tip"}] |
|
108 | 108 | [{"url": "$TESTTMP/a/$SOMETHING/bar"}] |
|
109 | 109 | #endif |
|
110 | 110 | |
|
111 | 111 | (sub options can be populated by map/dot operation) |
|
112 | 112 | |
|
113 | 113 | $ hg log -rnull \ |
|
114 | 114 | > -T '{get(peerurls, "dupe") % "url: {url}\npushurl: {pushurl}\n"}' |
|
115 | 115 | url: $TESTTMP/b#tip |
|
116 | 116 | pushurl: https://example.com/dupe |
|
117 | 117 | $ hg log -rnull -T '{peerurls.dupe.pushurl}\n' |
|
118 | 118 | https://example.com/dupe |
|
119 | 119 | |
|
120 | 120 | (in JSON, it's a dict of urls) |
|
121 | 121 | |
|
122 | 122 | $ hg log -rnull -T '{peerurls|json}\n' | sed 's|\\\\|/|g' |
|
123 | 123 | {"dupe": "$TESTTMP/b#tip", "expand": "$TESTTMP/a/$SOMETHING/bar"} |
|
124 | 124 | |
|
125 | 125 | password should be masked in plain output, but not in machine-readable/template |
|
126 | 126 | output: |
|
127 | 127 | |
|
128 | 128 | $ echo 'insecure = http://foo:insecure@example.com/' >> .hg/hgrc |
|
129 | 129 | $ hg paths insecure |
|
130 | 130 | http://foo:***@example.com/ |
|
131 | 131 | $ hg paths -Tjson insecure |
|
132 | 132 | [ |
|
133 | 133 | { |
|
134 | 134 | "name": "insecure", |
|
135 | 135 | "url": "http://foo:insecure@example.com/" |
|
136 | 136 | } |
|
137 | 137 | ] |
|
138 | 138 | $ hg log -rnull -T '{get(peerurls, "insecure")}\n' |
|
139 | 139 | http://foo:insecure@example.com/ |
|
140 | 140 | |
|
141 | 141 | zeroconf wraps ui.configitems(), which shouldn't crash at least: |
|
142 | 142 | |
|
143 | XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason, | |
|
144 | we accept the bad output for now as this is the last thing in the way of | |
|
145 | testing the pyoxidizer build. | |
|
146 | ||
|
147 | #if no-pyoxidizer | |
|
143 | 148 | $ hg paths --config extensions.zeroconf= |
|
144 | 149 | dupe = $TESTTMP/b#tip |
|
145 | 150 | dupe:pushurl = https://example.com/dupe |
|
146 | 151 | expand = $TESTTMP/a/$SOMETHING/bar |
|
147 | 152 | insecure = http://foo:***@example.com/ |
|
153 | #else | |
|
154 | $ hg paths --config extensions.zeroconf= | |
|
155 | abort: An invalid argument was supplied (known-bad-output !) | |
|
156 | [255] | |
|
157 | #endif | |
|
158 | ||
|
148 | 159 | |
|
149 | 160 | $ cd .. |
|
150 | 161 | |
|
151 | 162 | sub-options for an undeclared path are ignored |
|
152 | 163 | |
|
153 | 164 | $ hg init suboptions |
|
154 | 165 | $ cd suboptions |
|
155 | 166 | |
|
156 | 167 | $ cat > .hg/hgrc << EOF |
|
157 | 168 | > [paths] |
|
158 | 169 | > path0 = https://example.com/path0 |
|
159 | 170 | > path1:pushurl = https://example.com/path1 |
|
160 | 171 | > EOF |
|
161 | 172 | $ hg paths |
|
162 | 173 | path0 = https://example.com/path0 |
|
163 | 174 | |
|
164 | 175 | unknown sub-options aren't displayed |
|
165 | 176 | |
|
166 | 177 | $ cat > .hg/hgrc << EOF |
|
167 | 178 | > [paths] |
|
168 | 179 | > path0 = https://example.com/path0 |
|
169 | 180 | > path0:foo = https://example.com/path1 |
|
170 | 181 | > EOF |
|
171 | 182 | |
|
172 | 183 | $ hg paths |
|
173 | 184 | path0 = https://example.com/path0 |
|
174 | 185 | |
|
175 | 186 | :pushurl must be a URL |
|
176 | 187 | |
|
177 | 188 | $ cat > .hg/hgrc << EOF |
|
178 | 189 | > [paths] |
|
179 | 190 | > default = /path/to/nothing |
|
180 | 191 | > default:pushurl = /not/a/url |
|
181 | 192 | > EOF |
|
182 | 193 | |
|
183 | 194 | $ hg paths |
|
184 | 195 | (paths.default:pushurl not a URL; ignoring: "/not/a/url") |
|
185 | 196 | default = /path/to/nothing |
|
186 | 197 | |
|
187 | 198 | #fragment is not allowed in :pushurl |
|
188 | 199 | |
|
189 | 200 | $ cat > .hg/hgrc << EOF |
|
190 | 201 | > [paths] |
|
191 | 202 | > default = https://example.com/repo |
|
192 | 203 | > invalid = https://example.com/repo |
|
193 | 204 | > invalid:pushurl = https://example.com/repo#branch |
|
194 | 205 | > EOF |
|
195 | 206 | |
|
196 | 207 | $ hg paths |
|
197 | 208 | ("#fragment" in paths.invalid:pushurl not supported; ignoring) |
|
198 | 209 | default = https://example.com/repo |
|
199 | 210 | invalid = https://example.com/repo |
|
200 | 211 | invalid:pushurl = https://example.com/repo |
|
201 | 212 | |
|
202 | 213 | $ cd .. |
|
203 | 214 | |
|
204 | 215 | 'file:' disables [paths] entries for clone destination |
|
205 | 216 | |
|
206 | 217 | $ cat >> $HGRCPATH <<EOF |
|
207 | 218 | > [paths] |
|
208 | 219 | > gpath1 = http://hg.example.com |
|
209 | 220 | > EOF |
|
210 | 221 | |
|
211 | 222 | $ hg clone a gpath1 |
|
212 | 223 | abort: cannot create new http repository |
|
213 | 224 | [255] |
|
214 | 225 | |
|
215 | 226 | $ hg clone a file:gpath1 |
|
216 | 227 | updating to branch default |
|
217 | 228 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
218 | 229 | $ cd gpath1 |
|
219 | 230 | $ hg -q id |
|
220 | 231 | 000000000000 |
|
221 | 232 | |
|
222 | 233 | $ cd .. |
|
223 | 234 | |
|
224 | 235 | Testing path referencing other paths |
|
225 | 236 | ==================================== |
|
226 | 237 | |
|
227 | 238 | basic setup |
|
228 | 239 | ----------- |
|
229 | 240 | |
|
230 | 241 | $ ls -1 |
|
231 | 242 | a |
|
232 | 243 | b |
|
233 | 244 | gpath1 |
|
234 | 245 | suboptions |
|
235 | 246 | $ hg init chained_path |
|
236 | 247 | $ cd chained_path |
|
237 | 248 | $ cat << EOF > .hg/hgrc |
|
238 | 249 | > [paths] |
|
239 | 250 | > default=../a |
|
240 | 251 | > other_default=path://default |
|
241 | 252 | > path_with_branch=../branchy#foo |
|
242 | 253 | > other_branch=path://path_with_branch |
|
243 | 254 | > other_branched=path://path_with_branch#default |
|
244 | 255 | > pushdest=../push-dest |
|
245 | 256 | > pushdest:pushrev=default |
|
246 | 257 | > pushdest2=path://pushdest |
|
247 | 258 | > pushdest-overwrite=path://pushdest |
|
248 | 259 | > pushdest-overwrite:pushrev=foo |
|
249 | 260 | > EOF |
|
250 | 261 | |
|
251 | 262 | $ hg init ../branchy |
|
252 | 263 | $ hg init ../push-dest |
|
253 | 264 | $ hg debugbuilddag -R ../branchy '.:base+3<base@foo+5' |
|
254 | 265 | $ hg log -G -T '{branch}\n' -R ../branchy |
|
255 | 266 | o foo |
|
256 | 267 | | |
|
257 | 268 | o foo |
|
258 | 269 | | |
|
259 | 270 | o foo |
|
260 | 271 | | |
|
261 | 272 | o foo |
|
262 | 273 | | |
|
263 | 274 | o foo |
|
264 | 275 | | |
|
265 | 276 | | o default |
|
266 | 277 | | | |
|
267 | 278 | | o default |
|
268 | 279 | | | |
|
269 | 280 | | o default |
|
270 | 281 | |/ |
|
271 | 282 | o default |
|
272 | 283 | |
|
273 | 284 | |
|
274 | 285 | $ hg paths |
|
275 | 286 | default = $TESTTMP/a |
|
276 | 287 | gpath1 = http://hg.example.com/ |
|
277 | 288 | other_branch = $TESTTMP/branchy#foo |
|
278 | 289 | other_branched = $TESTTMP/branchy#default |
|
279 | 290 | other_default = $TESTTMP/a |
|
280 | 291 | path_with_branch = $TESTTMP/branchy#foo |
|
281 | 292 | pushdest = $TESTTMP/push-dest |
|
282 | 293 | pushdest:pushrev = default |
|
283 | 294 | pushdest-overwrite = $TESTTMP/push-dest |
|
284 | 295 | pushdest-overwrite:pushrev = foo |
|
285 | 296 | pushdest2 = $TESTTMP/push-dest |
|
286 | 297 | pushdest2:pushrev = default |
|
287 | 298 | |
|
288 | 299 | test basic chaining |
|
289 | 300 | ------------------- |
|
290 | 301 | |
|
291 | 302 | $ hg path other_default |
|
292 | 303 | $TESTTMP/a |
|
293 | 304 | $ hg pull default |
|
294 | 305 | pulling from $TESTTMP/a |
|
295 | 306 | no changes found |
|
296 | 307 | $ hg pull other_default |
|
297 | 308 | pulling from $TESTTMP/a |
|
298 | 309 | no changes found |
|
299 | 310 | |
|
300 | 311 | test inheritance of the #fragment part |
|
301 | 312 | -------------------------------------- |
|
302 | 313 | |
|
303 | 314 | $ hg pull path_with_branch |
|
304 | 315 | pulling from $TESTTMP/branchy |
|
305 | 316 | adding changesets |
|
306 | 317 | adding manifests |
|
307 | 318 | adding file changes |
|
308 | 319 | added 6 changesets with 0 changes to 0 files |
|
309 | 320 | new changesets 1ea73414a91b:bcebb50b77de |
|
310 | 321 | (run 'hg update' to get a working copy) |
|
311 | 322 | $ hg pull other_branch |
|
312 | 323 | pulling from $TESTTMP/branchy |
|
313 | 324 | no changes found |
|
314 | 325 | $ hg pull other_branched |
|
315 | 326 | pulling from $TESTTMP/branchy |
|
316 | 327 | searching for changes |
|
317 | 328 | adding changesets |
|
318 | 329 | adding manifests |
|
319 | 330 | adding file changes |
|
320 | 331 | added 3 changesets with 0 changes to 0 files (+1 heads) |
|
321 | 332 | new changesets 66f7d451a68b:2dc09a01254d |
|
322 | 333 | (run 'hg heads' to see heads) |
|
323 | 334 | |
|
324 | 335 | test inheritance of the suboptions |
|
325 | 336 | ---------------------------------- |
|
326 | 337 | |
|
327 | 338 | $ hg push pushdest |
|
328 | 339 | pushing to $TESTTMP/push-dest |
|
329 | 340 | searching for changes |
|
330 | 341 | adding changesets |
|
331 | 342 | adding manifests |
|
332 | 343 | adding file changes |
|
333 | 344 | added 4 changesets with 0 changes to 0 files |
|
334 | 345 | $ hg push pushdest2 |
|
335 | 346 | pushing to $TESTTMP/push-dest |
|
336 | 347 | searching for changes |
|
337 | 348 | no changes found |
|
338 | 349 | [1] |
|
339 | 350 | $ hg push pushdest-overwrite --new-branch |
|
340 | 351 | pushing to $TESTTMP/push-dest |
|
341 | 352 | searching for changes |
|
342 | 353 | adding changesets |
|
343 | 354 | adding manifests |
|
344 | 355 | adding file changes |
|
345 | 356 | added 5 changesets with 0 changes to 0 files (+1 heads) |
|
346 | 357 | |
|
347 | 358 | Test chaining path:// definition |
|
348 | 359 | -------------------------------- |
|
349 | 360 | |
|
350 | 361 | This is currently unsupported, but feel free to implement the necessary |
|
351 | 362 | dependency detection. |
|
352 | 363 | |
|
353 | 364 | $ cat << EOF >> .hg/hgrc |
|
354 | 365 | > chain_path=path://other_default |
|
355 | 366 | > EOF |
|
356 | 367 | |
|
357 | 368 | $ hg id |
|
358 | 369 | 000000000000 |
|
359 | 370 | $ hg path |
|
360 | 371 | abort: cannot use `path://other_default`, "other_default" is also defined as a `path://` |
|
361 | 372 | [255] |
|
362 | 373 | $ hg pull chain_path |
|
363 | 374 | abort: cannot use `path://other_default`, "other_default" is also defined as a `path://` |
|
364 | 375 | [255] |
|
365 | 376 | |
|
366 | 377 | Doing an actual circle should always be an issue |
|
367 | 378 | |
|
368 | 379 | $ cat << EOF >> .hg/hgrc |
|
369 | 380 | > rock=path://cissors |
|
370 | 381 | > cissors=path://paper |
|
371 | 382 | > paper=://rock |
|
372 | 383 | > EOF |
|
373 | 384 | |
|
374 | 385 | $ hg id |
|
375 | 386 | 000000000000 |
|
376 | 387 | $ hg path |
|
377 | 388 | abort: cannot use `path://other_default`, "other_default" is also defined as a `path://` |
|
378 | 389 | [255] |
|
379 | 390 | $ hg pull chain_path |
|
380 | 391 | abort: cannot use `path://other_default`, "other_default" is also defined as a `path://` |
|
381 | 392 | [255] |
|
382 | 393 | |
|
383 | 394 | Test basic error cases |
|
384 | 395 | ---------------------- |
|
385 | 396 | |
|
386 | 397 | $ cat << EOF > .hg/hgrc |
|
387 | 398 | > [paths] |
|
388 | 399 | > error-missing=path://unknown |
|
389 | 400 | > EOF |
|
390 | 401 | $ hg path |
|
391 | 402 | abort: cannot use `path://unknown`, "unknown" is not a known path |
|
392 | 403 | [255] |
|
393 | 404 | $ hg pull error-missing |
|
394 | 405 | abort: cannot use `path://unknown`, "unknown" is not a known path |
|
395 | 406 | [255] |
|
396 | 407 | |
|
397 | 408 | Test path pointing to multiple urls |
|
398 | 409 | =================================== |
|
399 | 410 | |
|
400 | 411 | Simple cases |
|
401 | 412 | ------------ |
|
402 | 413 | - one layer |
|
403 | 414 | - one list |
|
404 | 415 | - no special option |
|
405 | 416 | |
|
406 | 417 | $ cat << EOF > .hg/hgrc |
|
407 | 418 | > [paths] |
|
408 | 419 | > one-path=foo |
|
409 | 420 | > multiple-path=foo,bar,baz,https://example.org/ |
|
410 | 421 | > multiple-path:multi-urls=yes |
|
411 | 422 | > EOF |
|
412 | 423 | $ hg path |
|
413 | 424 | gpath1 = http://hg.example.com/ |
|
414 | 425 | multiple-path = $TESTTMP/chained_path/foo |
|
415 | 426 | multiple-path:multi-urls = yes |
|
416 | 427 | multiple-path = $TESTTMP/chained_path/bar |
|
417 | 428 | multiple-path:multi-urls = yes |
|
418 | 429 | multiple-path = $TESTTMP/chained_path/baz |
|
419 | 430 | multiple-path:multi-urls = yes |
|
420 | 431 | multiple-path = https://example.org/ |
|
421 | 432 | multiple-path:multi-urls = yes |
|
422 | 433 | one-path = $TESTTMP/chained_path/foo |
|
423 | 434 | |
|
424 | 435 | Reference to a list |
|
425 | 436 | ------------------- |
|
426 | 437 | |
|
427 | 438 | $ cat << EOF >> .hg/hgrc |
|
428 | 439 | > ref-to-multi=path://multiple-path |
|
429 | 440 | > EOF |
|
430 | 441 | $ hg path | grep ref-to-multi |
|
431 | 442 | ref-to-multi = $TESTTMP/chained_path/foo |
|
432 | 443 | ref-to-multi:multi-urls = yes |
|
433 | 444 | ref-to-multi = $TESTTMP/chained_path/bar |
|
434 | 445 | ref-to-multi:multi-urls = yes |
|
435 | 446 | ref-to-multi = $TESTTMP/chained_path/baz |
|
436 | 447 | ref-to-multi:multi-urls = yes |
|
437 | 448 | ref-to-multi = https://example.org/ |
|
438 | 449 | ref-to-multi:multi-urls = yes |
|
439 | 450 | |
|
440 | 451 | List with a reference |
|
441 | 452 | --------------------- |
|
442 | 453 | |
|
443 | 454 | $ cat << EOF >> .hg/hgrc |
|
444 | 455 | > multi-with-ref=path://one-path, ssh://babar@savannah/celeste-ville |
|
445 | 456 | > multi-with-ref:multi-urls=yes |
|
446 | 457 | > EOF |
|
447 | 458 | $ hg path | grep multi-with-ref |
|
448 | 459 | multi-with-ref = $TESTTMP/chained_path/foo |
|
449 | 460 | multi-with-ref:multi-urls = yes |
|
450 | 461 | multi-with-ref = ssh://babar@savannah/celeste-ville |
|
451 | 462 | multi-with-ref:multi-urls = yes |
|
452 | 463 | |
|
453 | 464 | List with a reference to a list |
|
454 | 465 | ------------------------------- |
|
455 | 466 | |
|
456 | 467 | $ cat << EOF >> .hg/hgrc |
|
457 | 468 | > multi-to-multi-ref = path://multiple-path, ssh://celeste@savannah/celeste-ville |
|
458 | 469 | > multi-to-multi-ref:multi-urls = yes |
|
459 | 470 | > EOF |
|
460 | 471 | $ hg path | grep multi-to-multi-ref |
|
461 | 472 | multi-to-multi-ref = $TESTTMP/chained_path/foo |
|
462 | 473 | multi-to-multi-ref:multi-urls = yes |
|
463 | 474 | multi-to-multi-ref = $TESTTMP/chained_path/bar |
|
464 | 475 | multi-to-multi-ref:multi-urls = yes |
|
465 | 476 | multi-to-multi-ref = $TESTTMP/chained_path/baz |
|
466 | 477 | multi-to-multi-ref:multi-urls = yes |
|
467 | 478 | multi-to-multi-ref = https://example.org/ |
|
468 | 479 | multi-to-multi-ref:multi-urls = yes |
|
469 | 480 | multi-to-multi-ref = ssh://celeste@savannah/celeste-ville |
|
470 | 481 | multi-to-multi-ref:multi-urls = yes |
|
471 | 482 | |
|
472 | 483 | individual suboptions are inherited |
|
473 | 484 | ----------------------------------- |
|
474 | 485 | |
|
475 | 486 | $ cat << EOF >> .hg/hgrc |
|
476 | 487 | > with-pushurl = foo |
|
477 | 488 | > with-pushurl:pushurl = http://foo.bar/ |
|
478 | 489 | > with-pushrev = bar |
|
479 | 490 | > with-pushrev:pushrev = draft() |
|
480 | 491 | > with-both = toto |
|
481 | 492 | > with-both:pushurl = http://ta.ta |
|
482 | 493 | > with-both:pushrev = secret() |
|
483 | 494 | > ref-all-no-opts = path://with-pushurl, path://with-pushrev, path://with-both |
|
484 | 495 | > ref-all-no-opts:multi-urls = yes |
|
485 | 496 | > with-overwrite = path://with-pushurl, path://with-pushrev, path://with-both |
|
486 | 497 | > with-overwrite:multi-urls = yes |
|
487 | 498 | > with-overwrite:pushrev = public() |
|
488 | 499 | > EOF |
|
489 | 500 | $ hg path | grep with-pushurl |
|
490 | 501 | with-pushurl = $TESTTMP/chained_path/foo |
|
491 | 502 | with-pushurl:pushurl = http://foo.bar/ |
|
492 | 503 | $ hg path | grep with-pushrev |
|
493 | 504 | with-pushrev = $TESTTMP/chained_path/bar |
|
494 | 505 | with-pushrev:pushrev = draft() |
|
495 | 506 | $ hg path | grep with-both |
|
496 | 507 | with-both = $TESTTMP/chained_path/toto |
|
497 | 508 | with-both:pushrev = secret() |
|
498 | 509 | with-both:pushurl = http://ta.ta/ |
|
499 | 510 | $ hg path | grep ref-all-no-opts |
|
500 | 511 | ref-all-no-opts = $TESTTMP/chained_path/foo |
|
501 | 512 | ref-all-no-opts:multi-urls = yes |
|
502 | 513 | ref-all-no-opts:pushurl = http://foo.bar/ |
|
503 | 514 | ref-all-no-opts = $TESTTMP/chained_path/bar |
|
504 | 515 | ref-all-no-opts:multi-urls = yes |
|
505 | 516 | ref-all-no-opts:pushrev = draft() |
|
506 | 517 | ref-all-no-opts = $TESTTMP/chained_path/toto |
|
507 | 518 | ref-all-no-opts:multi-urls = yes |
|
508 | 519 | ref-all-no-opts:pushrev = secret() |
|
509 | 520 | ref-all-no-opts:pushurl = http://ta.ta/ |
|
510 | 521 | $ hg path | grep with-overwrite |
|
511 | 522 | with-overwrite = $TESTTMP/chained_path/foo |
|
512 | 523 | with-overwrite:multi-urls = yes |
|
513 | 524 | with-overwrite:pushrev = public() |
|
514 | 525 | with-overwrite:pushurl = http://foo.bar/ |
|
515 | 526 | with-overwrite = $TESTTMP/chained_path/bar |
|
516 | 527 | with-overwrite:multi-urls = yes |
|
517 | 528 | with-overwrite:pushrev = public() |
|
518 | 529 | with-overwrite = $TESTTMP/chained_path/toto |
|
519 | 530 | with-overwrite:multi-urls = yes |
|
520 | 531 | with-overwrite:pushrev = public() |
|
521 | 532 | with-overwrite:pushurl = http://ta.ta/ |
General Comments 0
You need to be logged in to leave comments.
Login now