comparison tests/test-commit-interactive.t @ 42071:db72f9f6580e

interactive: do not prompt about files given in command line For commit and revert commands with --interactive and explicit files given in the command line, we now skip the invite to "examine changes to <file> ? [Ynesfdaq?]". The reason for this is that, if <file> is specified by the user, asking for confirmation is redundant. In patch.filterpatch(), we now use an optional "match" argument to conditionally call the prompt() function when entering a new "header" item. We use .exact() method to compare with files from the "header" in order to only consider (rel)path patterns. Add tests with glob patterns for commit and revert, to make sure we still ask to examine files in these cases.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Thu, 04 Apr 2019 11:35:18 +0200
parents 66399f2e92aa
children e45c6b153e51
comparison
equal deleted inserted replaced
42070:675775c33ab6 42071:db72f9f6580e
24 $ hg commit -i empty-rw<<EOF 24 $ hg commit -i empty-rw<<EOF
25 > n 25 > n
26 > EOF 26 > EOF
27 diff --git a/empty-rw b/empty-rw 27 diff --git a/empty-rw b/empty-rw
28 new file mode 100644 28 new file mode 100644
29 examine changes to 'empty-rw'? [Ynesfdaq?] n 29 abort: empty commit message
30 30 [255]
31 no changes to record
32 [1]
33 31
34 $ hg tip -p 32 $ hg tip -p
35 changeset: -1:000000000000 33 changeset: -1:000000000000
36 tag: tip 34 tag: tip
37 user: 35 user:
45 > y 43 > y
46 > n 44 > n
47 > EOF 45 > EOF
48 diff --git a/empty-rw b/empty-rw 46 diff --git a/empty-rw b/empty-rw
49 new file mode 100644 47 new file mode 100644
50 examine changes to 'empty-rw'? [Ynesfdaq?] y
51
52 abort: empty commit message 48 abort: empty commit message
53 [255] 49 [255]
54 50
55 $ hg tip -p 51 $ hg tip -p
56 changeset: -1:000000000000 52 changeset: -1:000000000000
70 66
71 Record empty file 67 Record empty file
72 68
73 $ hg commit -i -d '0 0' -m empty empty-rw<<EOF 69 $ hg commit -i -d '0 0' -m empty empty-rw<<EOF
74 > y 70 > y
75 > y
76 > EOF 71 > EOF
77 diff --git a/empty-rw b/empty-rw 72 diff --git a/empty-rw b/empty-rw
78 new file mode 100644 73 new file mode 100644
79 examine changes to 'empty-rw'? [Ynesfdaq?] y
80
81 74
82 $ hg tip -p 75 $ hg tip -p
83 changeset: 0:c0708cf4e46e 76 changeset: 0:c0708cf4e46e
84 tag: tip 77 tag: tip
85 user: test 78 user: test
247 > y 240 > y
248 > y 241 > y
249 > EOF 242 > EOF
250 diff --git a/plain b/plain 243 diff --git a/plain b/plain
251 new file mode 100644 244 new file mode 100644
252 examine changes to 'plain'? [Ynesfdaq?] y
253
254 @@ -0,0 +1,10 @@ 245 @@ -0,0 +1,10 @@
255 +1 246 +1
256 +2 247 +2
257 +3 248 +3
258 +4 249 +4
304 > y 295 > y
305 > y 296 > y
306 > EOF 297 > EOF
307 diff --git a/plain b/plain 298 diff --git a/plain b/plain
308 1 hunks, 1 lines changed 299 1 hunks, 1 lines changed
309 examine changes to 'plain'? [Ynesfdaq?] y
310
311 @@ -8,3 +8,4 @@ 7 300 @@ -8,3 +8,4 @@ 7
312 8 301 8
313 9 302 9
314 10 303 10
315 +11 304 +11
323 > y 312 > y
324 > y 313 > y
325 > EOF 314 > EOF
326 diff --git a/plain b/plain 315 diff --git a/plain b/plain
327 1 hunks, 1 lines changed 316 1 hunks, 1 lines changed
328 examine changes to 'plain'? [Ynesfdaq?] y
329
330 @@ -9,3 +9,4 @@ 8 317 @@ -9,3 +9,4 @@ 8
331 9 318 9
332 10 319 10
333 11 320 11
334 +7264f99c5f5ff3261504828afa4fb4d406c3af54 321 +7264f99c5f5ff3261504828afa4fb4d406c3af54
465 > y 452 > y
466 > y 453 > y
467 > EOF 454 > EOF
468 diff --git a/plain b/plain 455 diff --git a/plain b/plain
469 1 hunks, 1 lines changed 456 1 hunks, 1 lines changed
470 examine changes to 'plain'? [Ynesfdaq?] y
471
472 @@ -9,4 +9,4 @@ 8 457 @@ -9,4 +9,4 @@ 8
473 9 458 9
474 10 459 10
475 11 460 11
476 -7264f99c5f5ff3261504828afa4fb4d406c3af54 461 -7264f99c5f5ff3261504828afa4fb4d406c3af54
478 +7264f99c5f5ff3261504828afa4fb4d406c3af54 463 +7264f99c5f5ff3261504828afa4fb4d406c3af54
479 record change 1/2 to 'plain'? [Ynesfdaq?] y 464 record change 1/2 to 'plain'? [Ynesfdaq?] y
480 465
481 diff --git a/plain2 b/plain2 466 diff --git a/plain2 b/plain2
482 new file mode 100644 467 new file mode 100644
483 examine changes to 'plain2'? [Ynesfdaq?] y
484
485 @@ -0,0 +1,1 @@ 468 @@ -0,0 +1,1 @@
486 +1 469 +1
487 record change 2/2 to 'plain2'? [Ynesfdaq?] y 470 record change 2/2 to 'plain2'? [Ynesfdaq?] y
488 471
489 Modify beginning, trim end, record both, add another file to test 472 Modify beginning, trim end, record both, add another file to test
502 > y 485 > y
503 > y 486 > y
504 > EOF 487 > EOF
505 diff --git a/plain b/plain 488 diff --git a/plain b/plain
506 2 hunks, 3 lines changed 489 2 hunks, 3 lines changed
507 examine changes to 'plain'? [Ynesfdaq?] y
508
509 @@ -1,4 +1,4 @@ 490 @@ -1,4 +1,4 @@
510 -1 491 -1
511 +2 492 +2
512 2 493 2
513 3 494 3
522 -7264f99c5f5ff3261504828afa4fb4d406c3af54 503 -7264f99c5f5ff3261504828afa4fb4d406c3af54
523 record change 2/3 to 'plain'? [Ynesfdaq?] y 504 record change 2/3 to 'plain'? [Ynesfdaq?] y
524 505
525 diff --git a/plain2 b/plain2 506 diff --git a/plain2 b/plain2
526 1 hunks, 1 lines changed 507 1 hunks, 1 lines changed
527 examine changes to 'plain2'? [Ynesfdaq?] y
528
529 @@ -1,1 +1,2 @@ 508 @@ -1,1 +1,2 @@
530 1 509 1
531 +2 510 +2
532 record change 3/3 to 'plain2'? [Ynesfdaq?] y 511 record change 3/3 to 'plain2'? [Ynesfdaq?] y
533 512
570 > done 549 > done
571 550
572 Record end 551 Record end
573 552
574 $ hg commit -i -d '11 0' -m end-only plain <<EOF 553 $ hg commit -i -d '11 0' -m end-only plain <<EOF
575 > y
576 > n 554 > n
577 > y 555 > y
578 > EOF 556 > EOF
579 diff --git a/plain b/plain 557 diff --git a/plain b/plain
580 2 hunks, 4 lines changed 558 2 hunks, 4 lines changed
581 examine changes to 'plain'? [Ynesfdaq?] y
582
583 @@ -1,9 +1,6 @@ 559 @@ -1,9 +1,6 @@
584 -2 560 -2
585 -2 561 -2
586 -3 562 -3
587 4 563 4
628 > y 604 > y
629 > y 605 > y
630 > EOF 606 > EOF
631 diff --git a/plain b/plain 607 diff --git a/plain b/plain
632 1 hunks, 3 lines changed 608 1 hunks, 3 lines changed
633 examine changes to 'plain'? [Ynesfdaq?] y
634
635 @@ -1,6 +1,3 @@ 609 @@ -1,6 +1,3 @@
636 -2 610 -2
637 -2 611 -2
638 -3 612 -3
639 4 613 4
669 > done 643 > done
670 644
671 Record end 645 Record end
672 646
673 $ hg commit -i --traceback -d '13 0' -m end-again plain<<EOF 647 $ hg commit -i --traceback -d '13 0' -m end-again plain<<EOF
674 > y
675 > n 648 > n
676 > y 649 > y
677 > EOF 650 > EOF
678 diff --git a/plain b/plain 651 diff --git a/plain b/plain
679 2 hunks, 4 lines changed 652 2 hunks, 4 lines changed
680 examine changes to 'plain'? [Ynesfdaq?] y
681
682 @@ -1,6 +1,9 @@ 653 @@ -1,6 +1,9 @@
683 +1 654 +1
684 +2 655 +2
685 +3 656 +3
686 4 657 4
712 Record beginning, middle, and test that format-breaking diffopts are ignored 683 Record beginning, middle, and test that format-breaking diffopts are ignored
713 684
714 $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF 685 $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
715 > y 686 > y
716 > y 687 > y
717 > y
718 > n 688 > n
719 > EOF 689 > EOF
720 diff --git a/plain b/plain 690 diff --git a/plain b/plain
721 3 hunks, 7 lines changed 691 3 hunks, 7 lines changed
722 examine changes to 'plain'? [Ynesfdaq?] y
723
724 @@ -1,2 +1,5 @@ 692 @@ -1,2 +1,5 @@
725 +1 693 +1
726 +2 694 +2
727 +3 695 +3
728 4 696 4
779 > y 747 > y
780 > y 748 > y
781 > EOF 749 > EOF
782 diff --git a/plain b/plain 750 diff --git a/plain b/plain
783 1 hunks, 2 lines changed 751 1 hunks, 2 lines changed
784 examine changes to 'plain'? [Ynesfdaq?] y
785
786 @@ -9,3 +9,5 @@ 6 752 @@ -9,3 +9,5 @@ 6
787 7 753 7
788 8 754 8
789 9 755 9
790 +10 756 +10
821 > y 787 > y
822 > y 788 > y
823 > EOF 789 > EOF
824 diff --git a/subdir/a b/subdir/a 790 diff --git a/subdir/a b/subdir/a
825 1 hunks, 1 lines changed 791 1 hunks, 1 lines changed
826 examine changes to 'subdir/a'? [Ynesfdaq?] y
827
828 @@ -1,1 +1,2 @@ 792 @@ -1,1 +1,2 @@
829 a 793 a
830 +a 794 +a
831 record this change to 'subdir/a'? [Ynesfdaq?] y 795 record this change to 'subdir/a'? [Ynesfdaq?] y
832 796
876 ? - ? (display help) 840 ? - ? (display help)
877 examine changes to 'subdir/f1'? [Ynesfdaq?] q 841 examine changes to 'subdir/f1'? [Ynesfdaq?] q
878 842
879 abort: user quit 843 abort: user quit
880 [255] 844 [255]
845
846 Patterns
847
848 $ hg commit -i 'glob:f*' << EOF
849 > y
850 > n
851 > y
852 > n
853 > EOF
854 diff --git a/subdir/f1 b/subdir/f1
855 1 hunks, 1 lines changed
856 examine changes to 'subdir/f1'? [Ynesfdaq?] y
857
858 @@ -1,1 +1,2 @@
859 a
860 +a
861 record change 1/2 to 'subdir/f1'? [Ynesfdaq?] n
862
863 diff --git a/subdir/f2 b/subdir/f2
864 1 hunks, 1 lines changed
865 examine changes to 'subdir/f2'? [Ynesfdaq?] y
866
867 @@ -1,1 +1,2 @@
868 b
869 +b
870 record change 2/2 to 'subdir/f2'? [Ynesfdaq?] n
871
872 no changes to record
873 [1]
881 874
882 #if gettext 875 #if gettext
883 876
884 Test translated help message 877 Test translated help message
885 878