##// END OF EJS Templates
tests: Disable for rhg remaining tests that fail in that mode...
Simon Sapin -
r47483:5a2212d4 default
parent child Browse files
Show More
@@ -1,501 +1,504 b''
1 1 hide outer repo
2 2 $ hg init
3 3
4 4 Invalid syntax: no value
5 5
6 TODO: add rhg support for detailed exit codes
7 #if no-rhg
6 8 $ cat > .hg/hgrc << EOF
7 9 > novaluekey
8 10 > EOF
9 11 $ hg showconfig
10 12 config error at $TESTTMP/.hg/hgrc:1: novaluekey
11 13 [30]
12 14
13 15 Invalid syntax: no key
14 16
15 17 $ cat > .hg/hgrc << EOF
16 18 > =nokeyvalue
17 19 > EOF
18 20 $ hg showconfig
19 21 config error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
20 22 [30]
21 23
22 24 Test hint about invalid syntax from leading white space
23 25
24 26 $ cat > .hg/hgrc << EOF
25 27 > key=value
26 28 > EOF
27 29 $ hg showconfig
28 30 config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: key=value
29 31 [30]
30 32
31 33 $ cat > .hg/hgrc << EOF
32 34 > [section]
33 35 > key=value
34 36 > EOF
35 37 $ hg showconfig
36 38 config error at $TESTTMP/.hg/hgrc:1: unexpected leading whitespace: [section]
37 39 [30]
40 #endif
38 41
39 42 Reset hgrc
40 43
41 44 $ echo > .hg/hgrc
42 45
43 46 Test case sensitive configuration
44 47
45 48 $ cat <<EOF >> $HGRCPATH
46 49 > [Section]
47 50 > KeY = Case Sensitive
48 51 > key = lower case
49 52 > EOF
50 53
51 54 $ hg showconfig Section
52 55 Section.KeY=Case Sensitive
53 56 Section.key=lower case
54 57
55 58 $ hg showconfig Section -Tjson
56 59 [
57 60 {
58 61 "defaultvalue": null,
59 62 "name": "Section.KeY",
60 63 "source": "*.hgrc:*", (glob)
61 64 "value": "Case Sensitive"
62 65 },
63 66 {
64 67 "defaultvalue": null,
65 68 "name": "Section.key",
66 69 "source": "*.hgrc:*", (glob)
67 70 "value": "lower case"
68 71 }
69 72 ]
70 73 $ hg showconfig Section.KeY -Tjson
71 74 [
72 75 {
73 76 "defaultvalue": null,
74 77 "name": "Section.KeY",
75 78 "source": "*.hgrc:*", (glob)
76 79 "value": "Case Sensitive"
77 80 }
78 81 ]
79 82 $ hg showconfig -Tjson | tail -7
80 83 {
81 84 "defaultvalue": null,
82 85 "name": "*", (glob)
83 86 "source": "*", (glob)
84 87 "value": "*" (glob)
85 88 }
86 89 ]
87 90
88 91 Test config default of various types:
89 92
90 93 {"defaultvalue": ""} for -T'json(defaultvalue)' looks weird, but that's
91 94 how the templater works. Unknown keywords are evaluated to "".
92 95
93 96 dynamicdefault
94 97
95 98 $ hg config --config alias.foo= alias -Tjson
96 99 [
97 100 {
98 101 "name": "alias.foo",
99 102 "source": "--config",
100 103 "value": ""
101 104 }
102 105 ]
103 106 $ hg config --config alias.foo= alias -T'json(defaultvalue)'
104 107 [
105 108 {"defaultvalue": ""}
106 109 ]
107 110 $ hg config --config alias.foo= alias -T'{defaultvalue}\n'
108 111
109 112
110 113 null
111 114
112 115 $ hg config --config auth.cookiefile= auth -Tjson
113 116 [
114 117 {
115 118 "defaultvalue": null,
116 119 "name": "auth.cookiefile",
117 120 "source": "--config",
118 121 "value": ""
119 122 }
120 123 ]
121 124 $ hg config --config auth.cookiefile= auth -T'json(defaultvalue)'
122 125 [
123 126 {"defaultvalue": null}
124 127 ]
125 128 $ hg config --config auth.cookiefile= auth -T'{defaultvalue}\n'
126 129
127 130
128 131 false
129 132
130 133 $ hg config --config commands.commit.post-status= commands -Tjson
131 134 [
132 135 {
133 136 "defaultvalue": false,
134 137 "name": "commands.commit.post-status",
135 138 "source": "--config",
136 139 "value": ""
137 140 }
138 141 ]
139 142 $ hg config --config commands.commit.post-status= commands -T'json(defaultvalue)'
140 143 [
141 144 {"defaultvalue": false}
142 145 ]
143 146 $ hg config --config commands.commit.post-status= commands -T'{defaultvalue}\n'
144 147 False
145 148
146 149 true
147 150
148 151 $ hg config --config format.dotencode= format -Tjson
149 152 [
150 153 {
151 154 "defaultvalue": true,
152 155 "name": "format.dotencode",
153 156 "source": "--config",
154 157 "value": ""
155 158 }
156 159 ]
157 160 $ hg config --config format.dotencode= format -T'json(defaultvalue)'
158 161 [
159 162 {"defaultvalue": true}
160 163 ]
161 164 $ hg config --config format.dotencode= format -T'{defaultvalue}\n'
162 165 True
163 166
164 167 bytes
165 168
166 169 $ hg config --config commands.resolve.mark-check= commands -Tjson
167 170 [
168 171 {
169 172 "defaultvalue": "none",
170 173 "name": "commands.resolve.mark-check",
171 174 "source": "--config",
172 175 "value": ""
173 176 }
174 177 ]
175 178 $ hg config --config commands.resolve.mark-check= commands -T'json(defaultvalue)'
176 179 [
177 180 {"defaultvalue": "none"}
178 181 ]
179 182 $ hg config --config commands.resolve.mark-check= commands -T'{defaultvalue}\n'
180 183 none
181 184
182 185 empty list
183 186
184 187 $ hg config --config commands.show.aliasprefix= commands -Tjson
185 188 [
186 189 {
187 190 "defaultvalue": [],
188 191 "name": "commands.show.aliasprefix",
189 192 "source": "--config",
190 193 "value": ""
191 194 }
192 195 ]
193 196 $ hg config --config commands.show.aliasprefix= commands -T'json(defaultvalue)'
194 197 [
195 198 {"defaultvalue": []}
196 199 ]
197 200 $ hg config --config commands.show.aliasprefix= commands -T'{defaultvalue}\n'
198 201
199 202
200 203 nonempty list
201 204
202 205 $ hg config --config progress.format= progress -Tjson
203 206 [
204 207 {
205 208 "defaultvalue": ["topic", "bar", "number", "estimate"],
206 209 "name": "progress.format",
207 210 "source": "--config",
208 211 "value": ""
209 212 }
210 213 ]
211 214 $ hg config --config progress.format= progress -T'json(defaultvalue)'
212 215 [
213 216 {"defaultvalue": ["topic", "bar", "number", "estimate"]}
214 217 ]
215 218 $ hg config --config progress.format= progress -T'{defaultvalue}\n'
216 219 topic bar number estimate
217 220
218 221 int
219 222
220 223 $ hg config --config profiling.freq= profiling -Tjson
221 224 [
222 225 {
223 226 "defaultvalue": 1000,
224 227 "name": "profiling.freq",
225 228 "source": "--config",
226 229 "value": ""
227 230 }
228 231 ]
229 232 $ hg config --config profiling.freq= profiling -T'json(defaultvalue)'
230 233 [
231 234 {"defaultvalue": 1000}
232 235 ]
233 236 $ hg config --config profiling.freq= profiling -T'{defaultvalue}\n'
234 237 1000
235 238
236 239 float
237 240
238 241 $ hg config --config profiling.showmax= profiling -Tjson
239 242 [
240 243 {
241 244 "defaultvalue": 0.999,
242 245 "name": "profiling.showmax",
243 246 "source": "--config",
244 247 "value": ""
245 248 }
246 249 ]
247 250 $ hg config --config profiling.showmax= profiling -T'json(defaultvalue)'
248 251 [
249 252 {"defaultvalue": 0.999}
250 253 ]
251 254 $ hg config --config profiling.showmax= profiling -T'{defaultvalue}\n'
252 255 0.999
253 256
254 257 Test empty config source:
255 258
256 259 $ cat <<EOF > emptysource.py
257 260 > def reposetup(ui, repo):
258 261 > ui.setconfig(b'empty', b'source', b'value')
259 262 > EOF
260 263 $ cp .hg/hgrc .hg/hgrc.orig
261 264 $ cat <<EOF >> .hg/hgrc
262 265 > [extensions]
263 266 > emptysource = `pwd`/emptysource.py
264 267 > EOF
265 268
266 269 $ hg config --debug empty.source
267 270 read config from: * (glob)
268 271 none: value
269 272 $ hg config empty.source -Tjson
270 273 [
271 274 {
272 275 "defaultvalue": null,
273 276 "name": "empty.source",
274 277 "source": "",
275 278 "value": "value"
276 279 }
277 280 ]
278 281
279 282 $ cp .hg/hgrc.orig .hg/hgrc
280 283
281 284 Test "%unset"
282 285
283 286 $ cat >> $HGRCPATH <<EOF
284 287 > [unsettest]
285 288 > local-hgrcpath = should be unset (HGRCPATH)
286 289 > %unset local-hgrcpath
287 290 >
288 291 > global = should be unset (HGRCPATH)
289 292 >
290 293 > both = should be unset (HGRCPATH)
291 294 >
292 295 > set-after-unset = should be unset (HGRCPATH)
293 296 > EOF
294 297
295 298 $ cat >> .hg/hgrc <<EOF
296 299 > [unsettest]
297 300 > local-hgrc = should be unset (.hg/hgrc)
298 301 > %unset local-hgrc
299 302 >
300 303 > %unset global
301 304 >
302 305 > both = should be unset (.hg/hgrc)
303 306 > %unset both
304 307 >
305 308 > set-after-unset = should be unset (.hg/hgrc)
306 309 > %unset set-after-unset
307 310 > set-after-unset = should be set (.hg/hgrc)
308 311 > EOF
309 312
310 313 $ hg showconfig unsettest
311 314 unsettest.set-after-unset=should be set (.hg/hgrc)
312 315
313 316 Test exit code when no config matches
314 317
315 318 $ hg config Section.idontexist
316 319 [1]
317 320
318 321 sub-options in [paths] aren't expanded
319 322
320 323 $ cat > .hg/hgrc << EOF
321 324 > [paths]
322 325 > foo = ~/foo
323 326 > foo:suboption = ~/foo
324 327 > EOF
325 328
326 329 $ hg showconfig paths
327 330 paths.foo:suboption=~/foo
328 331 paths.foo=$TESTTMP/foo
329 332
330 333 edit failure
331 334
332 335 $ HGEDITOR=false hg config --edit
333 336 abort: edit failed: false exited with status 1
334 337 [10]
335 338
336 339 config affected by environment variables
337 340
338 341 $ EDITOR=e1 VISUAL=e2 hg config --debug | grep 'ui\.editor'
339 342 $VISUAL: ui.editor=e2
340 343
341 344 $ VISUAL=e2 hg config --debug --config ui.editor=e3 | grep 'ui\.editor'
342 345 --config: ui.editor=e3
343 346
344 347 $ PAGER=p1 hg config --debug | grep 'pager\.pager'
345 348 $PAGER: pager.pager=p1
346 349
347 350 $ PAGER=p1 hg config --debug --config pager.pager=p2 | grep 'pager\.pager'
348 351 --config: pager.pager=p2
349 352
350 353 verify that aliases are evaluated as well
351 354
352 355 $ hg init aliastest
353 356 $ cd aliastest
354 357 $ cat > .hg/hgrc << EOF
355 358 > [ui]
356 359 > user = repo user
357 360 > EOF
358 361 $ touch index
359 362 $ unset HGUSER
360 363 $ hg ci -Am test
361 364 adding index
362 365 $ hg log --template '{author}\n'
363 366 repo user
364 367 $ cd ..
365 368
366 369 alias has lower priority
367 370
368 371 $ hg init aliaspriority
369 372 $ cd aliaspriority
370 373 $ cat > .hg/hgrc << EOF
371 374 > [ui]
372 375 > user = alias user
373 376 > username = repo user
374 377 > EOF
375 378 $ touch index
376 379 $ unset HGUSER
377 380 $ hg ci -Am test
378 381 adding index
379 382 $ hg log --template '{author}\n'
380 383 repo user
381 384 $ cd ..
382 385
383 386 configs should be read in lexicographical order
384 387
385 388 $ mkdir configs
386 389 $ for i in `$TESTDIR/seq.py 10 99`; do
387 390 > printf "[section]\nkey=$i" > configs/$i.rc
388 391 > done
389 392 $ HGRCPATH=configs hg config section.key
390 393 99
391 394
392 395 Configuration priority
393 396 ======================
394 397
395 398 setup necessary file
396 399
397 400 $ cat > file-A.rc << EOF
398 401 > [config-test]
399 402 > basic = value-A
400 403 > pre-include= value-A
401 404 > %include ./included.rc
402 405 > post-include= value-A
403 406 > [command-templates]
404 407 > log = "value-A\n"
405 408 > EOF
406 409
407 410 $ cat > file-B.rc << EOF
408 411 > [config-test]
409 412 > basic = value-B
410 413 > [ui]
411 414 > logtemplate = "value-B\n"
412 415 > EOF
413 416
414 417
415 418 $ cat > included.rc << EOF
416 419 > [config-test]
417 420 > pre-include= value-included
418 421 > post-include= value-included
419 422 > EOF
420 423
421 424 $ cat > file-C.rc << EOF
422 425 > %include ./included-alias-C.rc
423 426 > [ui]
424 427 > logtemplate = "value-C\n"
425 428 > EOF
426 429
427 430 $ cat > included-alias-C.rc << EOF
428 431 > [command-templates]
429 432 > log = "value-included\n"
430 433 > EOF
431 434
432 435
433 436 $ cat > file-D.rc << EOF
434 437 > [command-templates]
435 438 > log = "value-D\n"
436 439 > %include ./included-alias-D.rc
437 440 > EOF
438 441
439 442 $ cat > included-alias-D.rc << EOF
440 443 > [ui]
441 444 > logtemplate = "value-included\n"
442 445 > EOF
443 446
444 447 Simple order checking
445 448 ---------------------
446 449
447 450 If file B is read after file A, value from B overwrite value from A.
448 451
449 452 $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic
450 453 value-B
451 454
452 455 Ordering from include
453 456 ---------------------
454 457
455 458 value from an include overwrite value defined before the include, but not the one defined after the include
456 459
457 460 $ HGRCPATH="file-A.rc" hg config config-test.pre-include
458 461 value-included
459 462 $ HGRCPATH="file-A.rc" hg config config-test.post-include
460 463 value-A
461 464
462 465 command line override
463 466 ---------------------
464 467
465 468 $ HGRCPATH="file-A.rc:file-B.rc" hg config config-test.basic --config config-test.basic=value-CLI
466 469 value-CLI
467 470
468 471 Alias ordering
469 472 --------------
470 473
471 474 The official config is now `command-templates.log`, the historical
472 475 `ui.logtemplate` is a valid alternative for it.
473 476
474 477 When both are defined, The config value read the last "win", this should keep
475 478 being true if the config have other alias. In other word, the config value read
476 479 earlier will be considered "lower level" and the config read later would be
477 480 considered "higher level". And higher level values wins.
478 481
479 482 $ HGRCPATH="file-A.rc" hg log -r .
480 483 value-A
481 484 $ HGRCPATH="file-B.rc" hg log -r .
482 485 value-B
483 486 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r .
484 487 value-B
485 488
486 489 Alias and include
487 490 -----------------
488 491
489 492 The pre/post include priority should also apply when tie-breaking alternatives.
490 493 See the case above for details about the two config options used.
491 494
492 495 $ HGRCPATH="file-C.rc" hg log -r .
493 496 value-C
494 497 $ HGRCPATH="file-D.rc" hg log -r .
495 498 value-included
496 499
497 500 command line override
498 501 ---------------------
499 502
500 503 $ HGRCPATH="file-A.rc:file-B.rc" hg log -r . --config ui.logtemplate="value-CLI\n"
501 504 value-CLI
@@ -1,664 +1,672 b''
1 1 $ cat << EOF >> $HGRCPATH
2 2 > [ui]
3 3 > interactive=yes
4 4 > EOF
5 5
6 6 $ hg init debugrevlog
7 7 $ cd debugrevlog
8 8 $ echo a > a
9 9 $ hg ci -Am adda
10 10 adding a
11 11 $ hg rm .
12 12 removing a
13 13 $ hg ci -Am make-it-empty
14 14 $ hg revert --all -r 0
15 15 adding a
16 16 $ hg ci -Am make-it-full
17 17 #if reporevlogstore
18 18 $ hg debugrevlog -c
19 19 format : 1
20 20 flags : inline
21 21
22 22 revisions : 3
23 23 merges : 0 ( 0.00%)
24 24 normal : 3 (100.00%)
25 25 revisions : 3
26 26 empty : 0 ( 0.00%)
27 27 text : 0 (100.00%)
28 28 delta : 0 (100.00%)
29 29 snapshot : 3 (100.00%)
30 30 lvl-0 : 3 (100.00%)
31 31 deltas : 0 ( 0.00%)
32 32 revision size : 191
33 33 snapshot : 191 (100.00%)
34 34 lvl-0 : 191 (100.00%)
35 35 deltas : 0 ( 0.00%)
36 36
37 37 chunks : 3
38 38 0x75 (u) : 3 (100.00%)
39 39 chunks size : 191
40 40 0x75 (u) : 191 (100.00%)
41 41
42 42 avg chain length : 0
43 43 max chain length : 0
44 44 max chain reach : 67
45 45 compression ratio : 0
46 46
47 47 uncompressed data size (min/max/avg) : 57 / 66 / 62
48 48 full revision size (min/max/avg) : 58 / 67 / 63
49 49 inter-snapshot size (min/max/avg) : 0 / 0 / 0
50 50 delta size (min/max/avg) : 0 / 0 / 0
51 51 $ hg debugrevlog -m
52 52 format : 1
53 53 flags : inline, generaldelta
54 54
55 55 revisions : 3
56 56 merges : 0 ( 0.00%)
57 57 normal : 3 (100.00%)
58 58 revisions : 3
59 59 empty : 1 (33.33%)
60 60 text : 1 (100.00%)
61 61 delta : 0 ( 0.00%)
62 62 snapshot : 2 (66.67%)
63 63 lvl-0 : 2 (66.67%)
64 64 deltas : 0 ( 0.00%)
65 65 revision size : 88
66 66 snapshot : 88 (100.00%)
67 67 lvl-0 : 88 (100.00%)
68 68 deltas : 0 ( 0.00%)
69 69
70 70 chunks : 3
71 71 empty : 1 (33.33%)
72 72 0x75 (u) : 2 (66.67%)
73 73 chunks size : 88
74 74 empty : 0 ( 0.00%)
75 75 0x75 (u) : 88 (100.00%)
76 76
77 77 avg chain length : 0
78 78 max chain length : 0
79 79 max chain reach : 44
80 80 compression ratio : 0
81 81
82 82 uncompressed data size (min/max/avg) : 0 / 43 / 28
83 83 full revision size (min/max/avg) : 44 / 44 / 44
84 84 inter-snapshot size (min/max/avg) : 0 / 0 / 0
85 85 delta size (min/max/avg) : 0 / 0 / 0
86 86 $ hg debugrevlog a
87 87 format : 1
88 88 flags : inline, generaldelta
89 89
90 90 revisions : 1
91 91 merges : 0 ( 0.00%)
92 92 normal : 1 (100.00%)
93 93 revisions : 1
94 94 empty : 0 ( 0.00%)
95 95 text : 0 (100.00%)
96 96 delta : 0 (100.00%)
97 97 snapshot : 1 (100.00%)
98 98 lvl-0 : 1 (100.00%)
99 99 deltas : 0 ( 0.00%)
100 100 revision size : 3
101 101 snapshot : 3 (100.00%)
102 102 lvl-0 : 3 (100.00%)
103 103 deltas : 0 ( 0.00%)
104 104
105 105 chunks : 1
106 106 0x75 (u) : 1 (100.00%)
107 107 chunks size : 3
108 108 0x75 (u) : 3 (100.00%)
109 109
110 110 avg chain length : 0
111 111 max chain length : 0
112 112 max chain reach : 3
113 113 compression ratio : 0
114 114
115 115 uncompressed data size (min/max/avg) : 2 / 2 / 2
116 116 full revision size (min/max/avg) : 3 / 3 / 3
117 117 inter-snapshot size (min/max/avg) : 0 / 0 / 0
118 118 delta size (min/max/avg) : 0 / 0 / 0
119 119 #endif
120 120
121 121 Test debugindex, with and without the --verbose/--debug flag
122 122 $ hg debugrevlogindex a
123 123 rev linkrev nodeid p1 p2
124 124 0 0 b789fdd96dc2 000000000000 000000000000
125 125
126 126 #if no-reposimplestore
127 127 $ hg --verbose debugrevlogindex a
128 128 rev offset length linkrev nodeid p1 p2
129 129 0 0 3 0 b789fdd96dc2 000000000000 000000000000
130 130
131 131 $ hg --debug debugrevlogindex a
132 132 rev offset length linkrev nodeid p1 p2
133 133 0 0 3 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
134 134 #endif
135 135
136 136 $ hg debugrevlogindex -f 1 a
137 137 rev flag size link p1 p2 nodeid
138 138 0 0000 2 0 -1 -1 b789fdd96dc2
139 139
140 140 #if no-reposimplestore
141 141 $ hg --verbose debugrevlogindex -f 1 a
142 142 rev flag offset length size link p1 p2 nodeid
143 143 0 0000 0 3 2 0 -1 -1 b789fdd96dc2
144 144
145 145 $ hg --debug debugrevlogindex -f 1 a
146 146 rev flag offset length size link p1 p2 nodeid
147 147 0 0000 0 3 2 0 -1 -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
148 148 #endif
149 149
150 150 $ hg debugindex -c
151 151 rev linkrev nodeid p1 p2
152 152 0 0 07f494440405 000000000000 000000000000
153 153 1 1 8cccb4b5fec2 07f494440405 000000000000
154 154 2 2 b1e228c512c5 8cccb4b5fec2 000000000000
155 155 $ hg debugindex -c --debug
156 156 rev linkrev nodeid p1 p2
157 157 0 0 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
158 158 1 1 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 07f4944404050f47db2e5c5071e0e84e7a27bba9 0000000000000000000000000000000000000000
159 159 2 2 b1e228c512c5d7066d70562ed839c3323a62d6d2 8cccb4b5fec20cafeb99dd01c26d4dee8ea4388a 0000000000000000000000000000000000000000
160 160 $ hg debugindex -m
161 161 rev linkrev nodeid p1 p2
162 162 0 0 a0c8bcbbb45c 000000000000 000000000000
163 163 1 1 57faf8a737ae a0c8bcbbb45c 000000000000
164 164 2 2 a35b10320954 57faf8a737ae 000000000000
165 165 $ hg debugindex -m --debug
166 166 rev linkrev nodeid p1 p2
167 167 0 0 a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
168 168 1 1 57faf8a737ae7faf490582941a82319ba6529dca a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 0000000000000000000000000000000000000000
169 169 2 2 a35b103209548032201c16c7688cb2657f037a38 57faf8a737ae7faf490582941a82319ba6529dca 0000000000000000000000000000000000000000
170 170 $ hg debugindex a
171 171 rev linkrev nodeid p1 p2
172 172 0 0 b789fdd96dc2 000000000000 000000000000
173 173 $ hg debugindex --debug a
174 174 rev linkrev nodeid p1 p2
175 175 0 0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
176 176
177 177 debugdelta chain basic output
178 178
179 179 #if reporevlogstore pure
180 180 $ hg debugindexstats
181 181 abort: debugindexstats only works with native code
182 182 [255]
183 183 #endif
184 184 #if reporevlogstore no-pure
185 185 $ hg debugindexstats
186 186 node trie capacity: 4
187 187 node trie count: 2
188 188 node trie depth: 1
189 189 node trie last rev scanned: -1
190 190 node trie lookups: 4
191 191 node trie misses: 1
192 192 node trie splits: 1
193 193 revs in memory: 3
194 194 #endif
195 195
196 196 #if reporevlogstore no-pure
197 197 $ hg debugdeltachain -m
198 198 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
199 199 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
200 200 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1
201 201 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
202 202
203 203 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen}\n'
204 204 0 1 1
205 205 1 2 1
206 206 2 3 1
207 207
208 208 $ hg debugdeltachain -m -Tjson
209 209 [
210 210 {
211 211 "chainid": 1,
212 212 "chainlen": 1,
213 213 "chainratio": 1.02325581395, (no-py3 !)
214 214 "chainratio": 1.0232558139534884, (py3 !)
215 215 "chainsize": 44,
216 216 "compsize": 44,
217 217 "deltatype": "base",
218 218 "extradist": 0,
219 219 "extraratio": 0.0,
220 220 "largestblock": 44,
221 221 "lindist": 44,
222 222 "prevrev": -1,
223 223 "readdensity": 1.0,
224 224 "readsize": 44,
225 225 "rev": 0,
226 226 "srchunks": 1,
227 227 "uncompsize": 43
228 228 },
229 229 {
230 230 "chainid": 2,
231 231 "chainlen": 1,
232 232 "chainratio": 0,
233 233 "chainsize": 0,
234 234 "compsize": 0,
235 235 "deltatype": "base",
236 236 "extradist": 0,
237 237 "extraratio": 0,
238 238 "largestblock": 0,
239 239 "lindist": 0,
240 240 "prevrev": -1,
241 241 "readdensity": 1,
242 242 "readsize": 0,
243 243 "rev": 1,
244 244 "srchunks": 1,
245 245 "uncompsize": 0
246 246 },
247 247 {
248 248 "chainid": 3,
249 249 "chainlen": 1,
250 250 "chainratio": 1.02325581395, (no-py3 !)
251 251 "chainratio": 1.0232558139534884, (py3 !)
252 252 "chainsize": 44,
253 253 "compsize": 44,
254 254 "deltatype": "base",
255 255 "extradist": 0,
256 256 "extraratio": 0.0,
257 257 "largestblock": 44,
258 258 "lindist": 44,
259 259 "prevrev": -1,
260 260 "readdensity": 1.0,
261 261 "readsize": 44,
262 262 "rev": 2,
263 263 "srchunks": 1,
264 264 "uncompsize": 43
265 265 }
266 266 ]
267 267
268 268 debugdelta chain with sparse read enabled
269 269
270 270 $ cat >> $HGRCPATH <<EOF
271 271 > [experimental]
272 272 > sparse-read = True
273 273 > EOF
274 274 $ hg debugdeltachain -m
275 275 rev chain# chainlen prev delta size rawsize chainsize ratio lindist extradist extraratio readsize largestblk rddensity srchunks
276 276 0 1 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
277 277 1 2 1 -1 base 0 0 0 0.00000 0 0 0.00000 0 0 1.00000 1
278 278 2 3 1 -1 base 44 43 44 1.02326 44 0 0.00000 44 44 1.00000 1
279 279
280 280 $ hg debugdeltachain -m -T '{rev} {chainid} {chainlen} {readsize} {largestblock} {readdensity}\n'
281 281 0 1 1 44 44 1.0
282 282 1 2 1 0 0 1
283 283 2 3 1 44 44 1.0
284 284
285 285 $ hg debugdeltachain -m -Tjson
286 286 [
287 287 {
288 288 "chainid": 1,
289 289 "chainlen": 1,
290 290 "chainratio": 1.02325581395, (no-py3 !)
291 291 "chainratio": 1.0232558139534884, (py3 !)
292 292 "chainsize": 44,
293 293 "compsize": 44,
294 294 "deltatype": "base",
295 295 "extradist": 0,
296 296 "extraratio": 0.0,
297 297 "largestblock": 44,
298 298 "lindist": 44,
299 299 "prevrev": -1,
300 300 "readdensity": 1.0,
301 301 "readsize": 44,
302 302 "rev": 0,
303 303 "srchunks": 1,
304 304 "uncompsize": 43
305 305 },
306 306 {
307 307 "chainid": 2,
308 308 "chainlen": 1,
309 309 "chainratio": 0,
310 310 "chainsize": 0,
311 311 "compsize": 0,
312 312 "deltatype": "base",
313 313 "extradist": 0,
314 314 "extraratio": 0,
315 315 "largestblock": 0,
316 316 "lindist": 0,
317 317 "prevrev": -1,
318 318 "readdensity": 1,
319 319 "readsize": 0,
320 320 "rev": 1,
321 321 "srchunks": 1,
322 322 "uncompsize": 0
323 323 },
324 324 {
325 325 "chainid": 3,
326 326 "chainlen": 1,
327 327 "chainratio": 1.02325581395, (no-py3 !)
328 328 "chainratio": 1.0232558139534884, (py3 !)
329 329 "chainsize": 44,
330 330 "compsize": 44,
331 331 "deltatype": "base",
332 332 "extradist": 0,
333 333 "extraratio": 0.0,
334 334 "largestblock": 44,
335 335 "lindist": 44,
336 336 "prevrev": -1,
337 337 "readdensity": 1.0,
338 338 "readsize": 44,
339 339 "rev": 2,
340 340 "srchunks": 1,
341 341 "uncompsize": 43
342 342 }
343 343 ]
344 344
345 345 $ printf "This test checks things.\n" >> a
346 346 $ hg ci -m a
347 347 $ hg branch other
348 348 marked working directory as branch other
349 349 (branches are permanent and global, did you want a bookmark?)
350 350 $ for i in `$TESTDIR/seq.py 5`; do
351 351 > printf "shorter ${i}" >> a
352 352 > hg ci -m "a other:$i"
353 353 > hg up -q default
354 354 > printf "for the branch default we want longer chains: ${i}" >> a
355 355 > hg ci -m "a default:$i"
356 356 > hg up -q other
357 357 > done
358 358 $ hg debugdeltachain a -T '{rev} {srchunks}\n' \
359 359 > --config experimental.sparse-read.density-threshold=0.50 \
360 360 > --config experimental.sparse-read.min-gap-size=0
361 361 0 1
362 362 1 1
363 363 2 1
364 364 3 1
365 365 4 1
366 366 5 1
367 367 6 1
368 368 7 1
369 369 8 1
370 370 9 1
371 371 10 2
372 372 11 1
373 373 $ hg --config extensions.strip= strip --no-backup -r 1
374 374 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
375 375
376 376 Test max chain len
377 377 $ cat >> $HGRCPATH << EOF
378 378 > [format]
379 379 > maxchainlen=4
380 380 > EOF
381 381
382 382 $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
383 383 $ hg ci -m a
384 384 $ printf "b\n" >> a
385 385 $ hg ci -m a
386 386 $ printf "c\n" >> a
387 387 $ hg ci -m a
388 388 $ printf "d\n" >> a
389 389 $ hg ci -m a
390 390 $ printf "e\n" >> a
391 391 $ hg ci -m a
392 392 $ printf "f\n" >> a
393 393 $ hg ci -m a
394 394 $ printf 'g\n' >> a
395 395 $ hg ci -m a
396 396 $ printf 'h\n' >> a
397 397 $ hg ci -m a
398 398
399 399 $ hg debugrevlog -d a
400 400 # rev p1rev p2rev start end deltastart base p1 p2 rawsize totalsize compression heads chainlen
401 401 0 -1 -1 0 ??? 0 0 0 0 ??? ???? ? 1 0 (glob)
402 402 1 0 -1 ??? ??? 0 0 0 0 ??? ???? ? 1 1 (glob)
403 403 2 1 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
404 404 3 2 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
405 405 4 3 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 4 (glob)
406 406 5 4 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 0 (glob)
407 407 6 5 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 1 (glob)
408 408 7 6 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 2 (glob)
409 409 8 7 -1 ??? ??? ??? ??? ??? 0 ??? ???? ? 1 3 (glob)
410 410 #endif
411 411
412 412 Test debuglocks command:
413 413
414 414 $ hg debuglocks
415 415 lock: free
416 416 wlock: free
417 417
418 418 * Test setting the lock
419 419
420 420 waitlock <file> will wait for file to be created. If it isn't in a reasonable
421 421 amount of time, displays error message and returns 1
422 422 $ waitlock() {
423 423 > start=`date +%s`
424 424 > timeout=5
425 425 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do
426 426 > now=`date +%s`
427 427 > if [ "`expr $now - $start`" -gt $timeout ]; then
428 428 > echo "timeout: $1 was not created in $timeout seconds"
429 429 > return 1
430 430 > fi
431 431 > sleep 0.1
432 432 > done
433 433 > }
434 434 $ dolock() {
435 435 > {
436 436 > waitlock .hg/unlock
437 437 > rm -f .hg/unlock
438 438 > echo y
439 439 > } | hg debuglocks "$@" > /dev/null
440 440 > }
441 441 $ dolock -s &
442 442 $ waitlock .hg/store/lock
443 443
444 444 $ hg debuglocks
445 445 lock: user *, process * (*s) (glob)
446 446 wlock: free
447 447 [1]
448 448 $ touch .hg/unlock
449 449 $ wait
450 450 $ [ -f .hg/store/lock ] || echo "There is no lock"
451 451 There is no lock
452 452
453 453 * Test setting the wlock
454 454
455 455 $ dolock -S &
456 456 $ waitlock .hg/wlock
457 457
458 458 $ hg debuglocks
459 459 lock: free
460 460 wlock: user *, process * (*s) (glob)
461 461 [1]
462 462 $ touch .hg/unlock
463 463 $ wait
464 464 $ [ -f .hg/wlock ] || echo "There is no wlock"
465 465 There is no wlock
466 466
467 467 * Test setting both locks
468 468
469 469 $ dolock -Ss &
470 470 $ waitlock .hg/wlock && waitlock .hg/store/lock
471 471
472 472 $ hg debuglocks
473 473 lock: user *, process * (*s) (glob)
474 474 wlock: user *, process * (*s) (glob)
475 475 [2]
476 476
477 477 * Test failing to set a lock
478 478
479 479 $ hg debuglocks -s
480 480 abort: lock is already held
481 481 [255]
482 482
483 483 $ hg debuglocks -S
484 484 abort: wlock is already held
485 485 [255]
486 486
487 487 $ touch .hg/unlock
488 488 $ wait
489 489
490 490 $ hg debuglocks
491 491 lock: free
492 492 wlock: free
493 493
494 494 * Test forcing the lock
495 495
496 496 $ dolock -s &
497 497 $ waitlock .hg/store/lock
498 498
499 499 $ hg debuglocks
500 500 lock: user *, process * (*s) (glob)
501 501 wlock: free
502 502 [1]
503 503
504 504 $ hg debuglocks -L
505 505
506 506 $ hg debuglocks
507 507 lock: free
508 508 wlock: free
509 509
510 510 $ touch .hg/unlock
511 511 $ wait
512 512
513 513 * Test forcing the wlock
514 514
515 515 $ dolock -S &
516 516 $ waitlock .hg/wlock
517 517
518 518 $ hg debuglocks
519 519 lock: free
520 520 wlock: user *, process * (*s) (glob)
521 521 [1]
522 522
523 523 $ hg debuglocks -W
524 524
525 525 $ hg debuglocks
526 526 lock: free
527 527 wlock: free
528 528
529 529 $ touch .hg/unlock
530 530 $ wait
531 531
532 532 Test WdirUnsupported exception
533 533
534 #if no-rhg
534 535 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
535 536 abort: working directory revision cannot be specified
536 537 [255]
538 #else
539 TODO: add rhg support for (at least parsing) the working directory pseudo-changeset
540 $ hg debugdata -c ffffffffffffffffffffffffffffffffffffffff
541 abort: working directory revision cannot be specified (missing-correct-output !)
542 abort: invalid revision identifier: ffffffffffffffffffffffffffffffffffffffff (known-bad-output !)
543 [255]
544 #endif
537 545
538 546 Test cache warming command
539 547
540 548 $ rm -rf .hg/cache/
541 549 $ hg debugupdatecaches --debug
542 550 updating the branch cache
543 551 $ ls -r .hg/cache/*
544 552 .hg/cache/tags2-served
545 553 .hg/cache/tags2
546 554 .hg/cache/rbc-revs-v1
547 555 .hg/cache/rbc-names-v1
548 556 .hg/cache/hgtagsfnodes1
549 557 .hg/cache/branch2-visible-hidden
550 558 .hg/cache/branch2-visible
551 559 .hg/cache/branch2-served.hidden
552 560 .hg/cache/branch2-served
553 561 .hg/cache/branch2-immutable
554 562 .hg/cache/branch2-base
555 563
556 564 Test debugcolor
557 565
558 566 #if no-windows
559 567 $ hg debugcolor --style --color always | egrep 'mode|style|log\.'
560 568 color mode: 'ansi'
561 569 available style:
562 570 \x1b[0;33mlog.changeset\x1b[0m: \x1b[0;33myellow\x1b[0m (esc)
563 571 #endif
564 572
565 573 $ hg debugcolor --style --color never
566 574 color mode: None
567 575 available style:
568 576
569 577 $ cd ..
570 578
571 579 Test internal debugstacktrace command
572 580
573 581 $ cat > debugstacktrace.py << EOF
574 582 > from __future__ import absolute_import
575 583 > from mercurial import (
576 584 > util,
577 585 > )
578 586 > from mercurial.utils import (
579 587 > procutil,
580 588 > )
581 589 > def f():
582 590 > util.debugstacktrace(f=procutil.stdout)
583 591 > g()
584 592 > def g():
585 593 > util.dst(b'hello from g\\n', skip=1)
586 594 > h()
587 595 > def h():
588 596 > util.dst(b'hi ...\\nfrom h hidden in g', 1, depth=2)
589 597 > f()
590 598 > EOF
591 599 $ "$PYTHON" debugstacktrace.py
592 600 stacktrace at:
593 601 *debugstacktrace.py:16 in * (glob)
594 602 *debugstacktrace.py:9 in f (glob)
595 603 hello from g at:
596 604 *debugstacktrace.py:16 in * (glob)
597 605 *debugstacktrace.py:10 in f (glob)
598 606 hi ...
599 607 from h hidden in g at:
600 608 *debugstacktrace.py:10 in f (glob)
601 609 *debugstacktrace.py:13 in g (glob)
602 610
603 611 Test debugcapabilities command:
604 612
605 613 $ hg debugcapabilities ./debugrevlog/
606 614 Main capabilities:
607 615 branchmap
608 616 $USUAL_BUNDLE2_CAPS$
609 617 getbundle
610 618 known
611 619 lookup
612 620 pushkey
613 621 unbundle
614 622 Bundle2 capabilities:
615 623 HG20
616 624 bookmarks
617 625 changegroup
618 626 01
619 627 02
620 628 checkheads
621 629 related
622 630 digests
623 631 md5
624 632 sha1
625 633 sha512
626 634 error
627 635 abort
628 636 unsupportedcontent
629 637 pushraced
630 638 pushkey
631 639 hgtagsfnodes
632 640 listkeys
633 641 phases
634 642 heads
635 643 pushkey
636 644 remote-changegroup
637 645 http
638 646 https
639 647 stream
640 648 v2
641 649
642 650 Test debugpeer
643 651
644 652 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" debugpeer ssh://user@dummy/debugrevlog
645 653 url: ssh://user@dummy/debugrevlog
646 654 local: no
647 655 pushable: yes
648 656
649 657 $ hg --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" --debug debugpeer ssh://user@dummy/debugrevlog
650 658 running "*" "*/tests/dummyssh" 'user@dummy' 'hg -R debugrevlog serve --stdio' (glob) (no-windows !)
651 659 running "*" "*\tests/dummyssh" "user@dummy" "hg -R debugrevlog serve --stdio" (glob) (windows !)
652 660 devel-peer-request: hello+between
653 661 devel-peer-request: pairs: 81 bytes
654 662 sending hello command
655 663 sending between command
656 664 remote: 444
657 665 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
658 666 remote: 1
659 667 devel-peer-request: protocaps
660 668 devel-peer-request: caps: * bytes (glob)
661 669 sending protocaps command
662 670 url: ssh://user@dummy/debugrevlog
663 671 local: no
664 672 pushable: yes
@@ -1,221 +1,224 b''
1 1 test command parsing and dispatch
2 2
3 3 $ hg init a
4 4 $ cd a
5 5
6 6 Redundant options used to crash (issue436):
7 7 $ hg -v log -v
8 8 $ hg -v log -v x
9 9
10 10 $ echo a > a
11 11 $ hg ci -Ama
12 12 adding a
13 13
14 14 Missing arg:
15 15
16 16 $ hg cat
17 17 hg cat: invalid arguments
18 18 hg cat [OPTION]... FILE...
19 19
20 20 output the current or given revision of files
21 21
22 22 options ([+] can be repeated):
23 23
24 24 -o --output FORMAT print output to file with formatted name
25 25 -r --rev REV print the given revision
26 26 --decode apply any matching decode filter
27 27 -I --include PATTERN [+] include names matching the given patterns
28 28 -X --exclude PATTERN [+] exclude names matching the given patterns
29 29 -T --template TEMPLATE display with template
30 30
31 31 (use 'hg cat -h' to show more help)
32 32 [10]
33 33
34 34 Missing parameter for early option:
35 35
36 36 $ hg log -R 2>&1 | grep 'hg log'
37 37 hg log: option -R requires argument
38 38 hg log [OPTION]... [FILE]
39 39 (use 'hg log -h' to show more help)
40 40
41 41 "--" may be an option value:
42 42
43 43 $ hg -R -- log
44 44 abort: repository -- not found
45 45 [255]
46 46 $ hg log -R --
47 47 abort: repository -- not found
48 48 [255]
49 49 $ hg log -T --
50 50 -- (no-eol)
51 51 $ hg log -T -- -k nomatch
52 52
53 53 Parsing of early options should stop at "--":
54 54
55 55 $ hg cat -- --config=hooks.pre-cat=false
56 56 --config=hooks.pre-cat=false: no such file in rev cb9a9f314b8b
57 57 [1]
58 58 $ hg cat -- --debugger
59 59 --debugger: no such file in rev cb9a9f314b8b
60 60 [1]
61 61
62 62 Unparsable form of early options:
63 63
64 64 $ hg cat --debugg
65 65 abort: option --debugger may not be abbreviated
66 66 [10]
67 67
68 68 Parsing failure of early options should be detected before executing the
69 69 command:
70 70
71 71 $ hg log -b '--config=hooks.pre-log=false' default
72 72 abort: option --config may not be abbreviated
73 73 [10]
74 74 $ hg log -b -R. default
75 75 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
76 76 [10]
77 77 $ hg log --cwd .. -b --cwd=. default
78 78 abort: option --cwd may not be abbreviated
79 79 [10]
80 80
81 81 However, we can't prevent it from loading extensions and configs:
82 82
83 83 $ cat <<EOF > bad.py
84 84 > raise Exception('bad')
85 85 > EOF
86 86 $ hg log -b '--config=extensions.bad=bad.py' default
87 87 *** failed to import extension bad from bad.py: bad
88 88 abort: option --config may not be abbreviated
89 89 [10]
90 90
91 91 $ mkdir -p badrepo/.hg
92 92 $ echo 'invalid-syntax' > badrepo/.hg/hgrc
93 TODO: add rhg support for detailed exit codes
94 #if no-rhg
93 95 $ hg log -b -Rbadrepo default
94 96 config error at badrepo/.hg/hgrc:1: invalid-syntax
95 97 [30]
98 #endif
96 99
97 100 $ hg log -b --cwd=inexistent default
98 101 abort: $ENOENT$: 'inexistent'
99 102 [255]
100 103
101 104 $ hg log -b '--config=ui.traceback=yes' 2>&1 | grep '^Traceback'
102 105 Traceback (most recent call last):
103 106 $ hg log -b '--config=profiling.enabled=yes' 2>&1 | grep -i sample
104 107 Sample count: .*|No samples recorded\. (re)
105 108
106 109 Early options can't be specified in [aliases] and [defaults] because they are
107 110 applied before the command name is resolved:
108 111
109 112 $ hg log -b '--config=alias.log=log --config=hooks.pre-log=false'
110 113 hg log: option -b not recognized
111 114 error in definition for alias 'log': --config may only be given on the command
112 115 line
113 116 [10]
114 117
115 118 $ hg log -b '--config=defaults.log=--config=hooks.pre-log=false'
116 119 abort: option --config may not be abbreviated
117 120 [10]
118 121
119 122 Shell aliases bypass any command parsing rules but for the early one:
120 123
121 124 $ hg log -b '--config=alias.log=!echo howdy'
122 125 howdy
123 126
124 127 Early options must come first if HGPLAIN=+strictflags is specified:
125 128 (BUG: chg cherry-picks early options to pass them as a server command)
126 129
127 130 #if no-chg
128 131 $ HGPLAIN=+strictflags hg log -b --config='hooks.pre-log=false' default
129 132 abort: unknown revision '--config=hooks.pre-log=false'
130 133 [255]
131 134 $ HGPLAIN=+strictflags hg log -b -R. default
132 135 abort: unknown revision '-R.'
133 136 [255]
134 137 $ HGPLAIN=+strictflags hg log -b --cwd=. default
135 138 abort: unknown revision '--cwd=.'
136 139 [255]
137 140 #endif
138 141 $ HGPLAIN=+strictflags hg log -b --debugger default
139 142 abort: unknown revision '--debugger'
140 143 [255]
141 144 $ HGPLAIN=+strictflags hg log -b --config='alias.log=!echo pwned' default
142 145 abort: unknown revision '--config=alias.log=!echo pwned'
143 146 [255]
144 147
145 148 $ HGPLAIN=+strictflags hg log --config='hooks.pre-log=false' -b default
146 149 abort: option --config may not be abbreviated
147 150 [10]
148 151 $ HGPLAIN=+strictflags hg log -q --cwd=.. -b default
149 152 abort: option --cwd may not be abbreviated
150 153 [10]
151 154 $ HGPLAIN=+strictflags hg log -q -R . -b default
152 155 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
153 156 [10]
154 157
155 158 $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default
156 159 abort: pre-log hook exited with status 1
157 160 [40]
158 161 $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default
159 162 0:cb9a9f314b8b
160 163 $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default
161 164 0:cb9a9f314b8b
162 165 $ HGPLAIN=+strictflags hg --cwd .. -q --repo a log -b default
163 166 0:cb9a9f314b8b
164 167
165 168 For compatibility reasons, HGPLAIN=+strictflags is not enabled by plain HGPLAIN:
166 169
167 170 $ HGPLAIN= hg log --config='hooks.pre-log=false' -b default
168 171 abort: pre-log hook exited with status 1
169 172 [40]
170 173 $ HGPLAINEXCEPT= hg log --cwd .. -q -Ra -b default
171 174 0:cb9a9f314b8b
172 175
173 176 [defaults]
174 177
175 178 $ hg cat a
176 179 a
177 180 $ cat >> $HGRCPATH <<EOF
178 181 > [defaults]
179 182 > cat = -r null
180 183 > EOF
181 184 $ hg cat a
182 185 a: no such file in rev 000000000000
183 186 [1]
184 187
185 188 $ cd "$TESTTMP"
186 189
187 190 OSError "No such file or directory" / "The system cannot find the path
188 191 specified" should include filename even when it is empty
189 192
190 193 $ hg -R a archive ''
191 194 abort: $ENOENT$: '' (no-windows !)
192 195 abort: $ENOTDIR$: '' (windows !)
193 196 [255]
194 197
195 198 #if no-outer-repo
196 199
197 200 No repo:
198 201
199 202 $ hg cat
200 203 abort: no repository found in '$TESTTMP' (.hg not found)
201 204 [10]
202 205
203 206 #endif
204 207
205 208 #if rmcwd
206 209
207 210 Current directory removed:
208 211
209 212 $ mkdir $TESTTMP/repo1
210 213 $ cd $TESTTMP/repo1
211 214 $ rm -rf $TESTTMP/repo1
212 215
213 216 The output could be one of the following and something else:
214 217 chg: abort: failed to getcwd (errno = *) (glob)
215 218 abort: error getting current working directory: * (glob)
216 219 sh: 0: getcwd() failed: $ENOENT$
217 220 Since the exact behavior depends on the shell, only check it returns non-zero.
218 221 $ HGDEMANDIMPORT=disable hg version -q 2>/dev/null || false
219 222 [1]
220 223
221 224 #endif
@@ -1,564 +1,570 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo a > a
4 4 $ hg ci -A -d'1 0' -m a
5 5 adding a
6 6
7 7 $ cd ..
8 8
9 9 $ hg init b
10 10 $ cd b
11 11 $ echo b > b
12 12 $ hg ci -A -d'1 0' -m b
13 13 adding b
14 14
15 15 $ cd ..
16 16
17 17 $ hg clone a c
18 18 updating to branch default
19 19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20 $ cd c
21 21 $ cat >> .hg/hgrc <<EOF
22 22 > [paths]
23 23 > relative = ../a
24 24 > EOF
25 25 $ hg pull -f ../b
26 26 pulling from ../b
27 27 searching for changes
28 28 warning: repository is unrelated
29 29 requesting all changes
30 30 adding changesets
31 31 adding manifests
32 32 adding file changes
33 33 added 1 changesets with 1 changes to 1 files (+1 heads)
34 34 new changesets b6c483daf290
35 35 (run 'hg heads' to see heads, 'hg merge' to merge)
36 36 $ hg merge
37 37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 38 (branch merge, don't forget to commit)
39 39
40 40 $ cd ..
41 41
42 42 Testing -R/--repository:
43 43
44 44 $ hg -R a tip
45 45 changeset: 0:8580ff50825a
46 46 tag: tip
47 47 user: test
48 48 date: Thu Jan 01 00:00:01 1970 +0000
49 49 summary: a
50 50
51 51 $ hg --repository b tip
52 52 changeset: 0:b6c483daf290
53 53 tag: tip
54 54 user: test
55 55 date: Thu Jan 01 00:00:01 1970 +0000
56 56 summary: b
57 57
58 58
59 59 -R with a URL:
60 60
61 61 $ hg -R file:a identify
62 62 8580ff50825a tip
63 63 $ hg -R file://localhost/`pwd`/a/ identify
64 64 8580ff50825a tip
65 65
66 66 -R with path aliases:
67 67
68 TODO: add rhg support for path aliases
69 #if no-rhg
68 70 $ cd c
69 71 $ hg -R default identify
70 72 8580ff50825a tip
71 73 $ hg -R relative identify
72 74 8580ff50825a tip
73 75 $ echo '[paths]' >> $HGRCPATH
74 76 $ echo 'relativetohome = a' >> $HGRCPATH
75 77 $ HOME=`pwd`/../ hg -R relativetohome identify
76 78 8580ff50825a tip
77 79 $ cd ..
80 #endif
78 81
79 82 #if no-outer-repo
80 83
81 84 Implicit -R:
82 85
83 86 $ hg ann a/a
84 87 0: a
85 88 $ hg ann a/a a/a
86 89 0: a
87 90 $ hg ann a/a b/b
88 91 abort: no repository found in '$TESTTMP' (.hg not found)
89 92 [10]
90 93 $ hg -R b ann a/a
91 94 abort: a/a not under root '$TESTTMP/b'
92 95 (consider using '--cwd b')
93 96 [255]
94 97 $ hg log
95 98 abort: no repository found in '$TESTTMP' (.hg not found)
96 99 [10]
97 100
98 101 #endif
99 102
100 103 Abbreviation of long option:
101 104
102 105 $ hg --repo c tip
103 106 changeset: 1:b6c483daf290
104 107 tag: tip
105 108 parent: -1:000000000000
106 109 user: test
107 110 date: Thu Jan 01 00:00:01 1970 +0000
108 111 summary: b
109 112
110 113
111 114 earlygetopt with duplicate options (36d23de02da1):
112 115
113 116 $ hg --cwd a --cwd b --cwd c tip
114 117 changeset: 1:b6c483daf290
115 118 tag: tip
116 119 parent: -1:000000000000
117 120 user: test
118 121 date: Thu Jan 01 00:00:01 1970 +0000
119 122 summary: b
120 123
121 124 $ hg --repo c --repository b -R a tip
122 125 changeset: 0:8580ff50825a
123 126 tag: tip
124 127 user: test
125 128 date: Thu Jan 01 00:00:01 1970 +0000
126 129 summary: a
127 130
128 131
129 132 earlygetopt short option without following space:
130 133
131 134 $ hg -q -Rb tip
132 135 0:b6c483daf290
133 136
134 137 earlygetopt with illegal abbreviations:
135 138
136 139 $ hg --confi "foo.bar=baz"
137 140 abort: option --config may not be abbreviated
138 141 [10]
139 142 $ hg --cw a tip
140 143 abort: option --cwd may not be abbreviated
141 144 [10]
142 145 $ hg --rep a tip
143 146 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
144 147 [10]
145 148 $ hg --repositor a tip
146 149 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
147 150 [10]
148 151 $ hg -qR a tip
149 152 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
150 153 [10]
151 154 $ hg -qRa tip
152 155 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
153 156 [10]
154 157
155 158 Testing --cwd:
156 159
157 160 $ hg --cwd a parents
158 161 changeset: 0:8580ff50825a
159 162 tag: tip
160 163 user: test
161 164 date: Thu Jan 01 00:00:01 1970 +0000
162 165 summary: a
163 166
164 167
165 168 Testing -y/--noninteractive - just be sure it is parsed:
166 169
167 170 $ hg --cwd a tip -q --noninteractive
168 171 0:8580ff50825a
169 172 $ hg --cwd a tip -q -y
170 173 0:8580ff50825a
171 174
172 175 Testing -q/--quiet:
173 176
174 177 $ hg -R a -q tip
175 178 0:8580ff50825a
176 179 $ hg -R b -q tip
177 180 0:b6c483daf290
178 181 $ hg -R c --quiet parents
179 182 0:8580ff50825a
180 183 1:b6c483daf290
181 184
182 185 Testing -v/--verbose:
183 186
184 187 $ hg --cwd c head -v
185 188 changeset: 1:b6c483daf290
186 189 tag: tip
187 190 parent: -1:000000000000
188 191 user: test
189 192 date: Thu Jan 01 00:00:01 1970 +0000
190 193 files: b
191 194 description:
192 195 b
193 196
194 197
195 198 changeset: 0:8580ff50825a
196 199 user: test
197 200 date: Thu Jan 01 00:00:01 1970 +0000
198 201 files: a
199 202 description:
200 203 a
201 204
202 205
203 206 $ hg --cwd b tip --verbose
204 207 changeset: 0:b6c483daf290
205 208 tag: tip
206 209 user: test
207 210 date: Thu Jan 01 00:00:01 1970 +0000
208 211 files: b
209 212 description:
210 213 b
211 214
212 215
213 216
214 217 Testing --config:
215 218
216 219 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
217 220 quuxfoo
221 TODO: add rhg support for detailed exit codes
222 #if no-rhg
218 223 $ hg --cwd c --config '' tip -q
219 224 abort: malformed --config option: '' (use --config section.name=value)
220 225 [10]
221 226 $ hg --cwd c --config a.b tip -q
222 227 abort: malformed --config option: 'a.b' (use --config section.name=value)
223 228 [10]
224 229 $ hg --cwd c --config a tip -q
225 230 abort: malformed --config option: 'a' (use --config section.name=value)
226 231 [10]
227 232 $ hg --cwd c --config a.= tip -q
228 233 abort: malformed --config option: 'a.=' (use --config section.name=value)
229 234 [10]
230 235 $ hg --cwd c --config .b= tip -q
231 236 abort: malformed --config option: '.b=' (use --config section.name=value)
232 237 [10]
238 #endif
233 239
234 240 Testing --debug:
235 241
236 242 $ hg --cwd c log --debug
237 243 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
238 244 tag: tip
239 245 phase: public
240 246 parent: -1:0000000000000000000000000000000000000000
241 247 parent: -1:0000000000000000000000000000000000000000
242 248 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
243 249 user: test
244 250 date: Thu Jan 01 00:00:01 1970 +0000
245 251 files+: b
246 252 extra: branch=default
247 253 description:
248 254 b
249 255
250 256
251 257 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
252 258 phase: public
253 259 parent: -1:0000000000000000000000000000000000000000
254 260 parent: -1:0000000000000000000000000000000000000000
255 261 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
256 262 user: test
257 263 date: Thu Jan 01 00:00:01 1970 +0000
258 264 files+: a
259 265 extra: branch=default
260 266 description:
261 267 a
262 268
263 269
264 270
265 271 Testing --traceback:
266 272
267 273 #if no-chg no-rhg
268 274 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
269 275 Traceback (most recent call last):
270 276 Traceback (most recent call last): (py3 !)
271 277 #else
272 278 Traceback for '--config' errors not supported with chg.
273 279 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
274 280 [1]
275 281 #endif
276 282
277 283 Testing --time:
278 284
279 285 $ hg --cwd a --time id
280 286 8580ff50825a tip
281 287 time: real * (glob)
282 288
283 289 Testing --version:
284 290
285 291 $ hg --version -q
286 292 Mercurial Distributed SCM * (glob)
287 293
288 294 hide outer repo
289 295 $ hg init
290 296
291 297 Testing -h/--help:
292 298
293 299 #if no-extraextensions
294 300
295 301 $ hg -h
296 302 Mercurial Distributed SCM
297 303
298 304 list of commands:
299 305
300 306 Repository creation:
301 307
302 308 clone make a copy of an existing repository
303 309 init create a new repository in the given directory
304 310
305 311 Remote repository management:
306 312
307 313 incoming show new changesets found in source
308 314 outgoing show changesets not found in the destination
309 315 paths show aliases for remote repositories
310 316 pull pull changes from the specified source
311 317 push push changes to the specified destination
312 318 serve start stand-alone webserver
313 319
314 320 Change creation:
315 321
316 322 commit commit the specified files or all outstanding changes
317 323
318 324 Change manipulation:
319 325
320 326 backout reverse effect of earlier changeset
321 327 graft copy changes from other branches onto the current branch
322 328 merge merge another revision into working directory
323 329
324 330 Change organization:
325 331
326 332 bookmarks create a new bookmark or list existing bookmarks
327 333 branch set or show the current branch name
328 334 branches list repository named branches
329 335 phase set or show the current phase name
330 336 tag add one or more tags for the current or given revision
331 337 tags list repository tags
332 338
333 339 File content management:
334 340
335 341 annotate show changeset information by line for each file
336 342 cat output the current or given revision of files
337 343 copy mark files as copied for the next commit
338 344 diff diff repository (or selected files)
339 345 grep search for a pattern in specified files
340 346
341 347 Change navigation:
342 348
343 349 bisect subdivision search of changesets
344 350 heads show branch heads
345 351 identify identify the working directory or specified revision
346 352 log show revision history of entire repository or files
347 353
348 354 Working directory management:
349 355
350 356 add add the specified files on the next commit
351 357 addremove add all new files, delete all missing files
352 358 files list tracked files
353 359 forget forget the specified files on the next commit
354 360 purge removes files not tracked by Mercurial
355 361 remove remove the specified files on the next commit
356 362 rename rename files; equivalent of copy + remove
357 363 resolve redo merges or set/view the merge status of files
358 364 revert restore files to their checkout state
359 365 root print the root (top) of the current working directory
360 366 shelve save and set aside changes from the working directory
361 367 status show changed files in the working directory
362 368 summary summarize working directory state
363 369 unshelve restore a shelved change to the working directory
364 370 update update working directory (or switch revisions)
365 371
366 372 Change import/export:
367 373
368 374 archive create an unversioned archive of a repository revision
369 375 bundle create a bundle file
370 376 export dump the header and diffs for one or more changesets
371 377 import import an ordered set of patches
372 378 unbundle apply one or more bundle files
373 379
374 380 Repository maintenance:
375 381
376 382 manifest output the current or given revision of the project manifest
377 383 recover roll back an interrupted transaction
378 384 verify verify the integrity of the repository
379 385
380 386 Help:
381 387
382 388 config show combined config settings from all hgrc files
383 389 help show help for a given topic or a help overview
384 390 version output version and copyright information
385 391
386 392 additional help topics:
387 393
388 394 Mercurial identifiers:
389 395
390 396 filesets Specifying File Sets
391 397 hgignore Syntax for Mercurial Ignore Files
392 398 patterns File Name Patterns
393 399 revisions Specifying Revisions
394 400 urls URL Paths
395 401
396 402 Mercurial output:
397 403
398 404 color Colorizing Outputs
399 405 dates Date Formats
400 406 diffs Diff Formats
401 407 templating Template Usage
402 408
403 409 Mercurial configuration:
404 410
405 411 config Configuration Files
406 412 environment Environment Variables
407 413 extensions Using Additional Features
408 414 flags Command-line flags
409 415 hgweb Configuring hgweb
410 416 merge-tools Merge Tools
411 417 pager Pager Support
412 418
413 419 Concepts:
414 420
415 421 bundlespec Bundle File Formats
416 422 glossary Glossary
417 423 phases Working with Phases
418 424 subrepos Subrepositories
419 425
420 426 Miscellaneous:
421 427
422 428 deprecated Deprecated Features
423 429 internals Technical implementation topics
424 430 scripting Using Mercurial from scripts and automation
425 431
426 432 (use 'hg help -v' to show built-in aliases and global options)
427 433
428 434 $ hg --help
429 435 Mercurial Distributed SCM
430 436
431 437 list of commands:
432 438
433 439 Repository creation:
434 440
435 441 clone make a copy of an existing repository
436 442 init create a new repository in the given directory
437 443
438 444 Remote repository management:
439 445
440 446 incoming show new changesets found in source
441 447 outgoing show changesets not found in the destination
442 448 paths show aliases for remote repositories
443 449 pull pull changes from the specified source
444 450 push push changes to the specified destination
445 451 serve start stand-alone webserver
446 452
447 453 Change creation:
448 454
449 455 commit commit the specified files or all outstanding changes
450 456
451 457 Change manipulation:
452 458
453 459 backout reverse effect of earlier changeset
454 460 graft copy changes from other branches onto the current branch
455 461 merge merge another revision into working directory
456 462
457 463 Change organization:
458 464
459 465 bookmarks create a new bookmark or list existing bookmarks
460 466 branch set or show the current branch name
461 467 branches list repository named branches
462 468 phase set or show the current phase name
463 469 tag add one or more tags for the current or given revision
464 470 tags list repository tags
465 471
466 472 File content management:
467 473
468 474 annotate show changeset information by line for each file
469 475 cat output the current or given revision of files
470 476 copy mark files as copied for the next commit
471 477 diff diff repository (or selected files)
472 478 grep search for a pattern in specified files
473 479
474 480 Change navigation:
475 481
476 482 bisect subdivision search of changesets
477 483 heads show branch heads
478 484 identify identify the working directory or specified revision
479 485 log show revision history of entire repository or files
480 486
481 487 Working directory management:
482 488
483 489 add add the specified files on the next commit
484 490 addremove add all new files, delete all missing files
485 491 files list tracked files
486 492 forget forget the specified files on the next commit
487 493 purge removes files not tracked by Mercurial
488 494 remove remove the specified files on the next commit
489 495 rename rename files; equivalent of copy + remove
490 496 resolve redo merges or set/view the merge status of files
491 497 revert restore files to their checkout state
492 498 root print the root (top) of the current working directory
493 499 shelve save and set aside changes from the working directory
494 500 status show changed files in the working directory
495 501 summary summarize working directory state
496 502 unshelve restore a shelved change to the working directory
497 503 update update working directory (or switch revisions)
498 504
499 505 Change import/export:
500 506
501 507 archive create an unversioned archive of a repository revision
502 508 bundle create a bundle file
503 509 export dump the header and diffs for one or more changesets
504 510 import import an ordered set of patches
505 511 unbundle apply one or more bundle files
506 512
507 513 Repository maintenance:
508 514
509 515 manifest output the current or given revision of the project manifest
510 516 recover roll back an interrupted transaction
511 517 verify verify the integrity of the repository
512 518
513 519 Help:
514 520
515 521 config show combined config settings from all hgrc files
516 522 help show help for a given topic or a help overview
517 523 version output version and copyright information
518 524
519 525 additional help topics:
520 526
521 527 Mercurial identifiers:
522 528
523 529 filesets Specifying File Sets
524 530 hgignore Syntax for Mercurial Ignore Files
525 531 patterns File Name Patterns
526 532 revisions Specifying Revisions
527 533 urls URL Paths
528 534
529 535 Mercurial output:
530 536
531 537 color Colorizing Outputs
532 538 dates Date Formats
533 539 diffs Diff Formats
534 540 templating Template Usage
535 541
536 542 Mercurial configuration:
537 543
538 544 config Configuration Files
539 545 environment Environment Variables
540 546 extensions Using Additional Features
541 547 flags Command-line flags
542 548 hgweb Configuring hgweb
543 549 merge-tools Merge Tools
544 550 pager Pager Support
545 551
546 552 Concepts:
547 553
548 554 bundlespec Bundle File Formats
549 555 glossary Glossary
550 556 phases Working with Phases
551 557 subrepos Subrepositories
552 558
553 559 Miscellaneous:
554 560
555 561 deprecated Deprecated Features
556 562 internals Technical implementation topics
557 563 scripting Using Mercurial from scripts and automation
558 564
559 565 (use 'hg help -v' to show built-in aliases and global options)
560 566
561 567 #endif
562 568
563 569 Not tested: --debugger
564 570
General Comments 0
You need to be logged in to leave comments. Login now