##// END OF EJS Templates
tests: add an end-to-end test to show a bug in `visit_children_set`...
Arseniy Alekseyev -
r52458:95c083d2 stable
parent child Browse files
Show More
@@ -1,1039 +1,1053 b''
1 1 #testcases dirstate-v1 dirstate-v2
2 2
3 3 #if dirstate-v2
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [format]
6 6 > use-dirstate-v2=1
7 7 > [storage]
8 8 > dirstate-v2.slow-path=allow
9 9 > EOF
10 10 #endif
11 11
12 12 $ hg init repo1
13 13 $ cd repo1
14 14 $ mkdir a b a/1 b/1 b/2
15 15 $ touch in_root a/in_a b/in_b a/1/in_a_1 b/1/in_b_1 b/2/in_b_2
16 16
17 17 hg status in repo root:
18 18
19 19 $ hg status
20 20 ? a/1/in_a_1
21 21 ? a/in_a
22 22 ? b/1/in_b_1
23 23 ? b/2/in_b_2
24 24 ? b/in_b
25 25 ? in_root
26 26
27 27 hg status . in repo root:
28 28
29 29 $ hg status .
30 30 ? a/1/in_a_1
31 31 ? a/in_a
32 32 ? b/1/in_b_1
33 33 ? b/2/in_b_2
34 34 ? b/in_b
35 35 ? in_root
36 36
37 37 $ hg status --cwd a
38 38 ? a/1/in_a_1
39 39 ? a/in_a
40 40 ? b/1/in_b_1
41 41 ? b/2/in_b_2
42 42 ? b/in_b
43 43 ? in_root
44 44 $ hg status --cwd a .
45 45 ? 1/in_a_1
46 46 ? in_a
47 47 $ hg status --cwd a ..
48 48 ? 1/in_a_1
49 49 ? in_a
50 50 ? ../b/1/in_b_1
51 51 ? ../b/2/in_b_2
52 52 ? ../b/in_b
53 53 ? ../in_root
54 54
55 55 $ hg status --cwd b
56 56 ? a/1/in_a_1
57 57 ? a/in_a
58 58 ? b/1/in_b_1
59 59 ? b/2/in_b_2
60 60 ? b/in_b
61 61 ? in_root
62 62 $ hg status --cwd b .
63 63 ? 1/in_b_1
64 64 ? 2/in_b_2
65 65 ? in_b
66 66 $ hg status --cwd b ..
67 67 ? ../a/1/in_a_1
68 68 ? ../a/in_a
69 69 ? 1/in_b_1
70 70 ? 2/in_b_2
71 71 ? in_b
72 72 ? ../in_root
73 73
74 74 $ hg status --cwd a/1
75 75 ? a/1/in_a_1
76 76 ? a/in_a
77 77 ? b/1/in_b_1
78 78 ? b/2/in_b_2
79 79 ? b/in_b
80 80 ? in_root
81 81 $ hg status --cwd a/1 .
82 82 ? in_a_1
83 83 $ hg status --cwd a/1 ..
84 84 ? in_a_1
85 85 ? ../in_a
86 86
87 87 $ hg status --cwd b/1
88 88 ? a/1/in_a_1
89 89 ? a/in_a
90 90 ? b/1/in_b_1
91 91 ? b/2/in_b_2
92 92 ? b/in_b
93 93 ? in_root
94 94 $ hg status --cwd b/1 .
95 95 ? in_b_1
96 96 $ hg status --cwd b/1 ..
97 97 ? in_b_1
98 98 ? ../2/in_b_2
99 99 ? ../in_b
100 100
101 101 $ hg status --cwd b/2
102 102 ? a/1/in_a_1
103 103 ? a/in_a
104 104 ? b/1/in_b_1
105 105 ? b/2/in_b_2
106 106 ? b/in_b
107 107 ? in_root
108 108 $ hg status --cwd b/2 .
109 109 ? in_b_2
110 110 $ hg status --cwd b/2 ..
111 111 ? ../1/in_b_1
112 112 ? in_b_2
113 113 ? ../in_b
114 114
115 115 combining patterns with root and patterns without a root works
116 116
117 117 $ hg st a/in_a re:.*b$
118 118 ? a/in_a
119 119 ? b/in_b
120 120
121 121 tweaking defaults works
122 122 $ hg status --cwd a --config ui.tweakdefaults=yes
123 123 ? 1/in_a_1
124 124 ? in_a
125 125 ? ../b/1/in_b_1
126 126 ? ../b/2/in_b_2
127 127 ? ../b/in_b
128 128 ? ../in_root
129 129 $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes
130 130 ? a/1/in_a_1 (glob)
131 131 ? a/in_a (glob)
132 132 ? b/1/in_b_1 (glob)
133 133 ? b/2/in_b_2 (glob)
134 134 ? b/in_b (glob)
135 135 ? in_root
136 136 $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config ui.tweakdefaults=yes
137 137 ? 1/in_a_1
138 138 ? in_a
139 139 ? ../b/1/in_b_1
140 140 ? ../b/2/in_b_2
141 141 ? ../b/in_b
142 142 ? ../in_root (glob)
143 143
144 144 relative paths can be requested
145 145
146 146 $ hg status --cwd a --config ui.relative-paths=yes
147 147 ? 1/in_a_1
148 148 ? in_a
149 149 ? ../b/1/in_b_1
150 150 ? ../b/2/in_b_2
151 151 ? ../b/in_b
152 152 ? ../in_root
153 153
154 154 $ hg status --cwd a . --config ui.relative-paths=legacy
155 155 ? 1/in_a_1
156 156 ? in_a
157 157 $ hg status --cwd a . --config ui.relative-paths=no
158 158 ? a/1/in_a_1
159 159 ? a/in_a
160 160
161 161 commands.status.relative overrides ui.relative-paths
162 162
163 163 $ cat >> $HGRCPATH <<EOF
164 164 > [ui]
165 165 > relative-paths = False
166 166 > [commands]
167 167 > status.relative = True
168 168 > EOF
169 169 $ hg status --cwd a
170 170 ? 1/in_a_1
171 171 ? in_a
172 172 ? ../b/1/in_b_1
173 173 ? ../b/2/in_b_2
174 174 ? ../b/in_b
175 175 ? ../in_root
176 176 $ HGPLAIN=1 hg status --cwd a
177 177 ? a/1/in_a_1 (glob)
178 178 ? a/in_a (glob)
179 179 ? b/1/in_b_1 (glob)
180 180 ? b/2/in_b_2 (glob)
181 181 ? b/in_b (glob)
182 182 ? in_root
183 183
184 184 if relative paths are explicitly off, tweakdefaults doesn't change it
185 185 $ cat >> $HGRCPATH <<EOF
186 186 > [commands]
187 187 > status.relative = False
188 188 > EOF
189 189 $ hg status --cwd a --config ui.tweakdefaults=yes
190 190 ? a/1/in_a_1
191 191 ? a/in_a
192 192 ? b/1/in_b_1
193 193 ? b/2/in_b_2
194 194 ? b/in_b
195 195 ? in_root
196 196
197 197 $ cd ..
198 198
199 199 $ hg init repo2
200 200 $ cd repo2
201 201 $ touch modified removed deleted ignored
202 202 $ echo "^ignored$" > .hgignore
203 203 $ hg ci -A -m 'initial checkin'
204 204 adding .hgignore
205 205 adding deleted
206 206 adding modified
207 207 adding removed
208 208 $ touch modified added unknown ignored
209 209 $ hg add added
210 210 $ hg remove removed
211 211 $ rm deleted
212 212
213 213 hg status:
214 214
215 215 $ hg status
216 216 A added
217 217 R removed
218 218 ! deleted
219 219 ? unknown
220 220
221 221 hg status -n:
222 222 $ env RHG_ON_UNSUPPORTED=abort hg status -n
223 223 added
224 224 removed
225 225 deleted
226 226 unknown
227 227
228 228 hg status modified added removed deleted unknown never-existed ignored:
229 229
230 230 $ hg status modified added removed deleted unknown never-existed ignored
231 231 never-existed: * (glob)
232 232 A added
233 233 R removed
234 234 ! deleted
235 235 ? unknown
236 236
237 237 $ hg copy modified copied
238 238
239 239 hg status -C:
240 240
241 241 $ hg status -C
242 242 A added
243 243 A copied
244 244 modified
245 245 R removed
246 246 ! deleted
247 247 ? unknown
248 248
249 249 hg status -0:
250 250
251 251 $ hg status -0 --config rhg.on-unsupported=abort
252 252 A added\x00A copied\x00R removed\x00! deleted\x00? unknown\x00 (no-eol) (esc)
253 253
254 254 hg status -A:
255 255
256 256 $ hg status -A
257 257 A added
258 258 A copied
259 259 modified
260 260 R removed
261 261 ! deleted
262 262 ? unknown
263 263 I ignored
264 264 C .hgignore
265 265 C modified
266 266
267 267 $ hg status -A -T '{status} {path} {node|shortest}\n'
268 268 A added ffff
269 269 A copied ffff
270 270 R removed ffff
271 271 ! deleted ffff
272 272 ? unknown ffff
273 273 I ignored ffff
274 274 C .hgignore ffff
275 275 C modified ffff
276 276
277 277 $ hg status -A -Tjson
278 278 [
279 279 {
280 280 "itemtype": "file",
281 281 "path": "added",
282 282 "status": "A"
283 283 },
284 284 {
285 285 "itemtype": "file",
286 286 "path": "copied",
287 287 "source": "modified",
288 288 "status": "A"
289 289 },
290 290 {
291 291 "itemtype": "file",
292 292 "path": "removed",
293 293 "status": "R"
294 294 },
295 295 {
296 296 "itemtype": "file",
297 297 "path": "deleted",
298 298 "status": "!"
299 299 },
300 300 {
301 301 "itemtype": "file",
302 302 "path": "unknown",
303 303 "status": "?"
304 304 },
305 305 {
306 306 "itemtype": "file",
307 307 "path": "ignored",
308 308 "status": "I"
309 309 },
310 310 {
311 311 "itemtype": "file",
312 312 "path": ".hgignore",
313 313 "status": "C"
314 314 },
315 315 {
316 316 "itemtype": "file",
317 317 "path": "modified",
318 318 "status": "C"
319 319 }
320 320 ]
321 321
322 322 $ hg status -A -Tpickle > pickle
323 323 >>> import pickle
324 324 >>> from mercurial import util
325 325 >>> data = sorted((x[b'status'].decode(), x[b'path'].decode()) for x in pickle.load(open("pickle", r"rb")))
326 326 >>> for s, p in data: print("%s %s" % (s, p))
327 327 ! deleted
328 328 ? pickle
329 329 ? unknown
330 330 A added
331 331 A copied
332 332 C .hgignore
333 333 C modified
334 334 I ignored
335 335 R removed
336 336 $ rm pickle
337 337
338 338 $ echo "^ignoreddir$" > .hgignore
339 339 $ mkdir ignoreddir
340 340 $ touch ignoreddir/file
341 341
342 342 Test templater support:
343 343
344 344 $ hg status -AT "[{status}]\t{if(source, '{source} -> ')}{path}\n"
345 345 [M] .hgignore
346 346 [A] added
347 347 [A] modified -> copied
348 348 [R] removed
349 349 [!] deleted
350 350 [?] ignored
351 351 [?] unknown
352 352 [I] ignoreddir/file
353 353 [C] modified
354 354 $ hg status -AT default
355 355 M .hgignore
356 356 A added
357 357 A copied
358 358 modified
359 359 R removed
360 360 ! deleted
361 361 ? ignored
362 362 ? unknown
363 363 I ignoreddir/file
364 364 C modified
365 365 $ hg status -T compact
366 366 abort: "status" not in template map
367 367 [255]
368 368
369 369 hg status ignoreddir/file:
370 370
371 371 $ hg status ignoreddir/file
372 372
373 373 hg status -i ignoreddir/file:
374 374
375 375 $ hg status -i ignoreddir/file
376 376 I ignoreddir/file
377 377 $ cd ..
378 378
379 379 Check 'status -q' and some combinations
380 380
381 381 $ hg init repo3
382 382 $ cd repo3
383 383 $ touch modified removed deleted ignored
384 384 $ echo "^ignored$" > .hgignore
385 385 $ hg commit -A -m 'initial checkin'
386 386 adding .hgignore
387 387 adding deleted
388 388 adding modified
389 389 adding removed
390 390 $ touch added unknown ignored
391 391 $ hg add added
392 392 $ echo "test" >> modified
393 393 $ hg remove removed
394 394 $ rm deleted
395 395 $ hg copy modified copied
396 396
397 397 Specify working directory revision explicitly, that should be the same as
398 398 "hg status"
399 399
400 400 $ hg status --change "wdir()"
401 401 M modified
402 402 A added
403 403 A copied
404 404 R removed
405 405 ! deleted
406 406 ? unknown
407 407
408 408 Run status with 2 different flags.
409 409 Check if result is the same or different.
410 410 If result is not as expected, raise error
411 411
412 412 $ assert() {
413 413 > hg status $1 > ../a
414 414 > hg status $2 > ../b
415 415 > if diff ../a ../b > /dev/null; then
416 416 > out=0
417 417 > else
418 418 > out=1
419 419 > fi
420 420 > if [ $3 -eq 0 ]; then
421 421 > df="same"
422 422 > else
423 423 > df="different"
424 424 > fi
425 425 > if [ $out -ne $3 ]; then
426 426 > echo "Error on $1 and $2, should be $df."
427 427 > fi
428 428 > }
429 429
430 430 Assert flag1 flag2 [0-same | 1-different]
431 431
432 432 $ assert "-q" "-mard" 0
433 433 $ assert "-A" "-marduicC" 0
434 434 $ assert "-qA" "-mardcC" 0
435 435 $ assert "-qAui" "-A" 0
436 436 $ assert "-qAu" "-marducC" 0
437 437 $ assert "-qAi" "-mardicC" 0
438 438 $ assert "-qu" "-u" 0
439 439 $ assert "-q" "-u" 1
440 440 $ assert "-m" "-a" 1
441 441 $ assert "-r" "-d" 1
442 442 $ cd ..
443 443
444 444 $ hg init repo4
445 445 $ cd repo4
446 446 $ touch modified removed deleted
447 447 $ hg ci -q -A -m 'initial checkin'
448 448 $ touch added unknown
449 449 $ hg add added
450 450 $ hg remove removed
451 451 $ rm deleted
452 452 $ echo x > modified
453 453 $ hg copy modified copied
454 454 $ hg ci -m 'test checkin' -d "1000001 0"
455 455 $ rm *
456 456 $ touch unrelated
457 457 $ hg ci -q -A -m 'unrelated checkin' -d "1000002 0"
458 458
459 459 hg status --change 1:
460 460
461 461 $ hg status --change 1
462 462 M modified
463 463 A added
464 464 A copied
465 465 R removed
466 466
467 467 hg status --change 1 unrelated:
468 468
469 469 $ hg status --change 1 unrelated
470 470
471 471 hg status -C --change 1 added modified copied removed deleted:
472 472
473 473 $ hg status -C --change 1 added modified copied removed deleted
474 474 M modified
475 475 A added
476 476 A copied
477 477 modified
478 478 R removed
479 479
480 480 hg status -A --change 1 and revset:
481 481
482 482 $ hg status -A --change '1|1'
483 483 M modified
484 484 A added
485 485 A copied
486 486 modified
487 487 R removed
488 488 C deleted
489 489
490 490 $ cd ..
491 491
492 492 hg status with --rev and reverted changes:
493 493
494 494 $ hg init reverted-changes-repo
495 495 $ cd reverted-changes-repo
496 496 $ echo a > file
497 497 $ hg add file
498 498 $ hg ci -m a
499 499 $ echo b > file
500 500 $ hg ci -m b
501 501
502 502 reverted file should appear clean
503 503
504 504 $ hg revert -r 0 .
505 505 reverting file
506 506 $ hg status -A --rev 0
507 507 C file
508 508
509 509 #if execbit
510 510 reverted file with changed flag should appear modified
511 511
512 512 $ chmod +x file
513 513 $ hg status -A --rev 0
514 514 M file
515 515
516 516 $ hg revert -r 0 .
517 517 reverting file
518 518
519 519 reverted and committed file with changed flag should appear modified
520 520
521 521 $ hg co -C .
522 522 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
523 523 $ chmod +x file
524 524 $ hg ci -m 'change flag'
525 525 $ hg status -A --rev 1 --rev 2
526 526 M file
527 527 $ hg diff -r 1 -r 2
528 528
529 529 #endif
530 530
531 531 $ cd ..
532 532
533 533 hg status of binary file starting with '\1\n', a separator for metadata:
534 534
535 535 $ hg init repo5
536 536 $ cd repo5
537 537 >>> open("010a", r"wb").write(b"\1\nfoo") and None
538 538 $ hg ci -q -A -m 'initial checkin'
539 539 $ hg status -A
540 540 C 010a
541 541
542 542 >>> open("010a", r"wb").write(b"\1\nbar") and None
543 543 $ hg status -A
544 544 M 010a
545 545 $ hg ci -q -m 'modify 010a'
546 546 $ hg status -A --rev 0:1
547 547 M 010a
548 548
549 549 $ touch empty
550 550 $ hg ci -q -A -m 'add another file'
551 551 $ hg status -A --rev 1:2 010a
552 552 C 010a
553 553
554 554 $ cd ..
555 555
556 556 test "hg status" with "directory pattern" which matches against files
557 557 only known on target revision.
558 558
559 559 $ hg init repo6
560 560 $ cd repo6
561 561
562 562 $ echo a > a.txt
563 563 $ hg add a.txt
564 564 $ hg commit -m '#0'
565 565 $ mkdir -p 1/2/3/4/5
566 566 $ echo b > 1/2/3/4/5/b.txt
567 567 $ hg add 1/2/3/4/5/b.txt
568 568 $ hg commit -m '#1'
569 569
570 570 $ hg update -C 0 > /dev/null
571 571 $ hg status -A
572 572 C a.txt
573 573
574 574 the directory matching against specified pattern should be removed,
575 575 because directory existence prevents 'dirstate.walk()' from showing
576 576 warning message about such pattern.
577 577
578 578 $ test ! -d 1
579 579 $ hg status -A --rev 1 1/2/3/4/5/b.txt
580 580 R 1/2/3/4/5/b.txt
581 581 $ hg status -A --rev 1 1/2/3/4/5
582 582 R 1/2/3/4/5/b.txt
583 583 $ hg status -A --rev 1 1/2/3
584 584 R 1/2/3/4/5/b.txt
585 585 $ hg status -A --rev 1 1
586 586 R 1/2/3/4/5/b.txt
587 587
588 588 $ hg status --config ui.formatdebug=True --rev 1 1
589 589 status = [
590 590 {
591 591 'itemtype': 'file',
592 592 'path': '1/2/3/4/5/b.txt',
593 593 'status': 'R'
594 594 },
595 595 ]
596 596
597 597 #if windows
598 598 $ hg --config ui.slash=false status -A --rev 1 1
599 599 R 1\2\3\4\5\b.txt
600 600 #endif
601 601
602 602 $ cd ..
603 603
604 604 Status after move overwriting a file (issue4458)
605 605 =================================================
606 606
607 607
608 608 $ hg init issue4458
609 609 $ cd issue4458
610 610 $ echo a > a
611 611 $ echo b > b
612 612 $ hg commit -Am base
613 613 adding a
614 614 adding b
615 615
616 616
617 617 with --force
618 618
619 619 $ hg mv b --force a
620 620 $ hg st --copies
621 621 M a
622 622 b
623 623 R b
624 624 $ hg revert --all
625 625 reverting a
626 626 undeleting b
627 627 $ rm *.orig
628 628
629 629 without force
630 630
631 631 $ hg rm a
632 632 $ hg st --copies
633 633 R a
634 634 $ hg mv b a
635 635 $ hg st --copies
636 636 M a
637 637 b
638 638 R b
639 639
640 640 using ui.statuscopies setting
641 641 $ hg st --config ui.statuscopies=true
642 642 M a
643 643 b
644 644 R b
645 645 $ hg st --config ui.statuscopies=true --no-copies
646 646 M a
647 647 R b
648 648 $ hg st --config ui.statuscopies=false
649 649 M a
650 650 R b
651 651 $ hg st --config ui.statuscopies=false --copies
652 652 M a
653 653 b
654 654 R b
655 655 $ hg st --config ui.tweakdefaults=yes
656 656 M a
657 657 b
658 658 R b
659 659
660 660 using log status template (issue5155)
661 661 $ hg log -Tstatus -r 'wdir()' -C
662 662 changeset: 2147483647:ffffffffffff
663 663 parent: 0:8c55c58b4c0e
664 664 user: test
665 665 date: * (glob)
666 666 files:
667 667 M a
668 668 b
669 669 R b
670 670
671 671 $ hg log -GTstatus -r 'wdir()' -C
672 672 o changeset: 2147483647:ffffffffffff
673 673 | parent: 0:8c55c58b4c0e
674 674 ~ user: test
675 675 date: * (glob)
676 676 files:
677 677 M a
678 678 b
679 679 R b
680 680
681 681
682 682 Other "bug" highlight, the revision status does not report the copy information.
683 683 This is buggy behavior.
684 684
685 685 $ hg commit -m 'blah'
686 686 $ hg st --copies --change .
687 687 M a
688 688 R b
689 689
690 690 using log status template, the copy information is displayed correctly.
691 691 $ hg log -Tstatus -r. -C
692 692 changeset: 1:6685fde43d21
693 693 tag: tip
694 694 user: test
695 695 date: * (glob)
696 696 summary: blah
697 697 files:
698 698 M a
699 699 b
700 700 R b
701 701
702 702
703 703 $ cd ..
704 704
705 705 Make sure .hg doesn't show up even as a symlink
706 706
707 707 $ hg init repo0
708 708 $ mkdir symlink-repo0
709 709 $ cd symlink-repo0
710 710 $ ln -s ../repo0/.hg
711 711 $ hg status
712 712
713 713 If the size hasn’t changed but mtime has, status needs to read the contents
714 714 of the file to check whether it has changed
715 715
716 716 $ echo 1 > a
717 717 $ echo 1 > b
718 718 $ touch -t 200102030000 a b
719 719 $ hg commit -Aqm '#0'
720 720 $ echo 2 > a
721 721 $ touch -t 200102040000 a b
722 722 $ hg status
723 723 M a
724 724
725 725 Asking specifically for the status of a deleted/removed file
726 726
727 727 $ rm a
728 728 $ rm b
729 729 $ hg status a
730 730 ! a
731 731 $ hg rm a
732 732 $ hg rm b
733 733 $ hg status a
734 734 R a
735 735 $ hg commit -qm '#1'
736 736 $ hg status a
737 737 a: $ENOENT$
738 738
739 739 Check using include flag with pattern when status does not need to traverse
740 740 the working directory (issue6483)
741 741
742 742 $ cd ..
743 743 $ hg init issue6483
744 744 $ cd issue6483
745 745 $ touch a.py b.rs
746 746 $ hg add a.py b.rs
747 747 $ hg st -aI "*.py"
748 748 A a.py
749 749
750 750 Also check exclude pattern
751 751
752 752 $ hg st -aX "*.rs"
753 753 A a.py
754 754
755 755 issue6335
756 756 When a directory containing a tracked file gets symlinked, as of 5.8
757 757 `hg st` only gives the correct answer about clean (or deleted) files
758 758 if also listing unknowns.
759 759 The tree-based dirstate and status algorithm fix this:
760 760
761 761 #if symlink no-dirstate-v1 rust
762 762
763 763 $ cd ..
764 764 $ hg init issue6335
765 765 $ cd issue6335
766 766 $ mkdir foo
767 767 $ touch foo/a
768 768 $ hg ci -Ama
769 769 adding foo/a
770 770 $ mv foo bar
771 771 $ ln -s bar foo
772 772 $ hg status
773 773 ! foo/a
774 774 ? bar/a
775 775 ? foo
776 776
777 777 $ hg status -c # incorrect output without the Rust implementation
778 778 $ hg status -cu
779 779 ? bar/a
780 780 ? foo
781 781 $ hg status -d # incorrect output without the Rust implementation
782 782 ! foo/a
783 783 $ hg status -du
784 784 ! foo/a
785 785 ? bar/a
786 786 ? foo
787 787
788 788 #endif
789 789
790 790
791 791 Create a repo with files in each possible status
792 792
793 793 $ cd ..
794 794 $ hg init repo7
795 795 $ cd repo7
796 796 $ mkdir subdir
797 797 $ touch clean modified deleted removed
798 798 $ touch subdir/clean subdir/modified subdir/deleted subdir/removed
799 799 $ echo ignored > .hgignore
800 800 $ hg ci -Aqm '#0'
801 801 $ echo 1 > modified
802 802 $ echo 1 > subdir/modified
803 803 $ rm deleted
804 804 $ rm subdir/deleted
805 805 $ hg rm removed
806 806 $ hg rm subdir/removed
807 807 $ touch unknown ignored
808 808 $ touch subdir/unknown subdir/ignored
809 809
810 810 Check the output
811 811
812 812 $ hg status
813 813 M modified
814 814 M subdir/modified
815 815 R removed
816 816 R subdir/removed
817 817 ! deleted
818 818 ! subdir/deleted
819 819 ? subdir/unknown
820 820 ? unknown
821 821
822 822 $ hg status -mard
823 823 M modified
824 824 M subdir/modified
825 825 R removed
826 826 R subdir/removed
827 827 ! deleted
828 828 ! subdir/deleted
829 829
830 830 $ hg status -A
831 831 M modified
832 832 M subdir/modified
833 833 R removed
834 834 R subdir/removed
835 835 ! deleted
836 836 ! subdir/deleted
837 837 ? subdir/unknown
838 838 ? unknown
839 839 I ignored
840 840 I subdir/ignored
841 841 C .hgignore
842 842 C clean
843 843 C subdir/clean
844 844
845 $ hg status path:subdir
846 M subdir/modified
847 R subdir/removed
848 ! subdir/deleted
849 ? subdir/unknown
850
845 851 FIXME: it's a bug in rhg that the status below is empty:
846 852
847 853 $ hg status 'glob:subdir/*'
848 854 M subdir/modified (no-rhg !)
849 855 R subdir/removed (no-rhg !)
850 856 ! subdir/deleted (no-rhg !)
851 857 ? subdir/unknown (no-rhg !)
852 858
859 FIXME: it's a bug (both in rhg and in Python) that the status below is wrong,
860 in rhg it's empty, in Python it's missing the unknown file:
861
862 $ hg status rootfilesin:subdir
863 M subdir/modified (no-rhg !)
864 R subdir/removed (no-rhg !)
865 ! subdir/deleted (no-rhg !)
866
853 867 Note: `hg status some-name` creates a patternmatcher which is not supported
854 868 yet by the Rust implementation of status, but includematcher is supported.
855 869 --include is used below for that reason
856 870
857 871 #if unix-permissions
858 872
859 873 Not having permission to read a directory that contains tracked files makes
860 874 status emit a warning then behave as if the directory was empty or removed
861 875 entirely:
862 876
863 877 $ chmod 0 subdir
864 878 $ hg status --include subdir
865 879 subdir: $EACCES$
866 880 R subdir/removed
867 881 ! subdir/clean
868 882 ! subdir/deleted
869 883 ! subdir/modified
870 884 $ chmod 755 subdir
871 885
872 886 #endif
873 887
874 888 Remove a directory that contains tracked files
875 889
876 890 $ rm -r subdir
877 891 $ hg status --include subdir
878 892 R subdir/removed
879 893 ! subdir/clean
880 894 ! subdir/deleted
881 895 ! subdir/modified
882 896
883 897 … and replace it by a file
884 898
885 899 $ touch subdir
886 900 $ hg status --include subdir
887 901 R subdir/removed
888 902 ! subdir/clean
889 903 ! subdir/deleted
890 904 ! subdir/modified
891 905 ? subdir
892 906
893 907 Replaced a deleted or removed file with a directory
894 908
895 909 $ mkdir deleted removed
896 910 $ touch deleted/1 removed/1
897 911 $ hg status --include deleted --include removed
898 912 R removed
899 913 ! deleted
900 914 ? deleted/1
901 915 ? removed/1
902 916 $ hg add removed/1
903 917 $ hg status --include deleted --include removed
904 918 A removed/1
905 919 R removed
906 920 ! deleted
907 921 ? deleted/1
908 922
909 923 Deeply nested files in an ignored directory are still listed on request
910 924
911 925 $ echo ignored-dir >> .hgignore
912 926 $ mkdir ignored-dir
913 927 $ mkdir ignored-dir/subdir
914 928 $ touch ignored-dir/subdir/1
915 929 $ hg status --ignored
916 930 I ignored
917 931 I ignored-dir/subdir/1
918 932
919 933 Check using include flag while listing ignored composes correctly (issue6514)
920 934
921 935 $ cd ..
922 936 $ hg init issue6514
923 937 $ cd issue6514
924 938 $ mkdir ignored-folder
925 939 $ touch A.hs B.hs C.hs ignored-folder/other.txt ignored-folder/ctest.hs
926 940 $ cat >.hgignore <<EOF
927 941 > A.hs
928 942 > B.hs
929 943 > ignored-folder/
930 944 > EOF
931 945 $ hg st -i -I 're:.*\.hs$'
932 946 I A.hs
933 947 I B.hs
934 948 I ignored-folder/ctest.hs
935 949
936 950 #if rust dirstate-v2
937 951
938 952 Check read_dir caching
939 953
940 954 $ cd ..
941 955 $ hg init repo8
942 956 $ cd repo8
943 957 $ mkdir subdir
944 958 $ touch subdir/a subdir/b
945 959 $ hg ci -Aqm '#0'
946 960
947 961 The cached mtime is initially unset
948 962
949 963 $ hg debugdirstate --all --no-dates | grep '^ '
950 964 0 -1 unset subdir
951 965
952 966 It is still not set when there are unknown files
953 967
954 968 $ touch subdir/unknown
955 969 $ hg status
956 970 ? subdir/unknown
957 971 $ hg debugdirstate --all --no-dates | grep '^ '
958 972 0 -1 unset subdir
959 973
960 974 Now the directory is eligible for caching, so its mtime is saved in the dirstate
961 975
962 976 $ rm subdir/unknown
963 977 $ sleep 0.1 # ensure the kernel’s internal clock for mtimes has ticked
964 978 $ hg status
965 979 $ hg debugdirstate --all --no-dates | grep '^ '
966 980 0 -1 set subdir
967 981
968 982 This time the command should be ever so slightly faster since it does not need `read_dir("subdir")`
969 983
970 984 $ hg status
971 985
972 986 Creating a new file changes the directory’s mtime, invalidating the cache
973 987
974 988 $ touch subdir/unknown
975 989 $ hg status
976 990 ? subdir/unknown
977 991
978 992 $ rm subdir/unknown
979 993 $ hg status
980 994
981 995 Removing a node from the dirstate resets the cache for its parent directory
982 996
983 997 $ hg forget subdir/a
984 998 $ hg debugdirstate --all --no-dates | grep '^ '
985 999 0 -1 set subdir
986 1000 $ hg ci -qm '#1'
987 1001 $ hg debugdirstate --all --no-dates | grep '^ '
988 1002 0 -1 unset subdir
989 1003 $ hg status
990 1004 ? subdir/a
991 1005
992 1006 Changing the hgignore rules makes us recompute the status (and rewrite the dirstate).
993 1007
994 1008 $ rm subdir/a
995 1009 $ mkdir another-subdir
996 1010 $ touch another-subdir/something-else
997 1011
998 1012 $ cat > "$TESTTMP"/extra-hgignore <<EOF
999 1013 > something-else
1000 1014 > EOF
1001 1015
1002 1016 $ hg status --config ui.ignore.global="$TESTTMP"/extra-hgignore
1003 1017 $ hg debugdirstate --all --no-dates | grep '^ '
1004 1018 0 -1 set subdir
1005 1019
1006 1020 $ hg status
1007 1021 ? another-subdir/something-else
1008 1022
1009 1023 One invocation of status is enough to populate the cache even if it's invalidated
1010 1024 in the same run.
1011 1025
1012 1026 $ hg debugdirstate --all --no-dates | grep '^ '
1013 1027 0 -1 set subdir
1014 1028
1015 1029 #endif
1016 1030
1017 1031
1018 1032 Test copy source formatting.
1019 1033 $ cd ..
1020 1034 $ hg init copy-source-repo
1021 1035 $ cd copy-source-repo
1022 1036 $ mkdir -p foo/bar
1023 1037 $ cd foo/bar
1024 1038 $ touch file
1025 1039 $ hg addremove
1026 1040 adding foo/bar/file
1027 1041 $ hg commit -m 'add file'
1028 1042 $ hg mv file copy
1029 1043
1030 1044 Copy source respects relative path setting.
1031 1045 $ hg st --config ui.statuscopies=true --config commands.status.relative=true
1032 1046 A copy
1033 1047 file
1034 1048 R file
1035 1049
1036 1050 Copy source is not shown when --no-status is passed.
1037 1051 $ hg st --config ui.statuscopies=true --no-status
1038 1052 foo/bar/copy
1039 1053 foo/bar/file
General Comments 0
You need to be logged in to leave comments. Login now