Debian Codegraph @

tests/test-commit-interactive.t

raw
1 Set up a repo
2
3 $ cat <<EOF >> $HGRCPATH
4 > [ui]
5 > interactive = true
6 > [extensions]
7 > record =
8 > EOF
9
10 $ hg init a
11 $ cd a
12
13 Select no files
14
15 $ touch empty-rw
16 $ hg add empty-rw
17
18 $ hg record --config ui.interactive=false
19 abort: running non-interactively, use commit instead
20 [255]
21 $ hg commit -i --config ui.interactive=false
22 abort: running non-interactively
23 [10]
24 $ hg commit -i empty-rw<<EOF
25 > n
26 > EOF
27 diff --git a/empty-rw b/empty-rw
28 new file mode 100644
29 abort: empty commit message
30 [10]
31
32 $ hg tip -p
33 changeset: -1:000000000000
34 tag: tip
35 user:
36 date: Thu Jan 01 00:00:00 1970 +0000
37
38
39
40 Select files but no hunks
41
42 $ hg commit -i empty-rw<<EOF
43 > y
44 > n
45 > EOF
46 diff --git a/empty-rw b/empty-rw
47 new file mode 100644
48 abort: empty commit message
49 [10]
50
51 $ hg tip -p
52 changeset: -1:000000000000
53 tag: tip
54 user:
55 date: Thu Jan 01 00:00:00 1970 +0000
56
57
58
59 Abort for untracked
60
61 $ touch untracked
62 $ hg commit -i -m should-fail empty-rw untracked
63 abort: untracked: file not tracked!
64 [10]
65 $ rm untracked
66
67 Record empty file
68
69 $ hg commit -i -d '0 0' -m empty empty-rw<<EOF
70 > y
71 > EOF
72 diff --git a/empty-rw b/empty-rw
73 new file mode 100644
74
75 $ hg tip -p
76 changeset: 0:c0708cf4e46e
77 tag: tip
78 user: test
79 date: Thu Jan 01 00:00:00 1970 +0000
80 summary: empty
81
82
83
84 Summary shows we updated to the new cset
85
86 $ hg summary
87 parent: 0:c0708cf4e46e tip
88 empty
89 branch: default
90 commit: (clean)
91 update: (current)
92 phases: 1 draft
93
94 Rename empty file
95
96 $ hg mv empty-rw empty-rename
97 $ hg commit -i -d '1 0' -m rename<<EOF
98 > y
99 > EOF
100 diff --git a/empty-rw b/empty-rename
101 rename from empty-rw
102 rename to empty-rename
103 examine changes to 'empty-rw' and 'empty-rename'?
104 (enter ? for help) [Ynesfdaq?] y
105
106
107 $ hg tip -p
108 changeset: 1:d695e8dcb197
109 tag: tip
110 user: test
111 date: Thu Jan 01 00:00:01 1970 +0000
112 summary: rename
113
114
115
116 Copy empty file
117
118 $ hg cp empty-rename empty-copy
119 $ hg commit -i -d '2 0' -m copy<<EOF
120 > y
121 > EOF
122 diff --git a/empty-rename b/empty-copy
123 copy from empty-rename
124 copy to empty-copy
125 examine changes to 'empty-rename' and 'empty-copy'?
126 (enter ? for help) [Ynesfdaq?] y
127
128
129 $ hg tip -p
130 changeset: 2:1d4b90bea524
131 tag: tip
132 user: test
133 date: Thu Jan 01 00:00:02 1970 +0000
134 summary: copy
135
136
137
138 Delete empty file
139
140 $ hg rm empty-copy
141 $ hg commit -i -d '3 0' -m delete<<EOF
142 > y
143 > EOF
144 diff --git a/empty-copy b/empty-copy
145 deleted file mode 100644
146 examine changes to 'empty-copy'?
147 (enter ? for help) [Ynesfdaq?] y
148
149
150 $ hg tip -p
151 changeset: 3:b39a238f01a1
152 tag: tip
153 user: test
154 date: Thu Jan 01 00:00:03 1970 +0000
155 summary: delete
156
157
158
159 Add binary file
160
161 $ hg bundle --type v1 --base -2 tip.bundle
162 1 changesets found
163 $ hg add tip.bundle
164 $ hg commit -i -d '4 0' -m binary<<EOF
165 > y
166 > EOF
167 diff --git a/tip.bundle b/tip.bundle
168 new file mode 100644
169 this is a binary file
170 examine changes to 'tip.bundle'?
171 (enter ? for help) [Ynesfdaq?] y
172
173
174 $ hg tip -p
175 changeset: 4:ad816da3711e
176 tag: tip
177 user: test
178 date: Thu Jan 01 00:00:04 1970 +0000
179 summary: binary
180
181 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
182 Binary file tip.bundle has changed
183
184
185 Change binary file
186
187 $ hg bundle --base -2 --type v1 tip.bundle
188 1 changesets found
189 $ hg commit -i -d '5 0' -m binary-change<<EOF
190 > y
191 > EOF
192 diff --git a/tip.bundle b/tip.bundle
193 this modifies a binary file (all or nothing)
194 examine changes to 'tip.bundle'?
195 (enter ? for help) [Ynesfdaq?] y
196
197
198 $ hg tip -p
199 changeset: 5:dccd6f3eb485
200 tag: tip
201 user: test
202 date: Thu Jan 01 00:00:05 1970 +0000
203 summary: binary-change
204
205 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
206 Binary file tip.bundle has changed
207
208
209 Rename and change binary file
210
211 $ hg mv tip.bundle top.bundle
212 $ hg bundle --base -2 --type v1 top.bundle
213 1 changesets found
214 $ hg commit -i -d '6 0' -m binary-change-rename<<EOF
215 > y
216 > EOF
217 diff --git a/tip.bundle b/top.bundle
218 rename from tip.bundle
219 rename to top.bundle
220 this modifies a binary file (all or nothing)
221 examine changes to 'tip.bundle' and 'top.bundle'?
222 (enter ? for help) [Ynesfdaq?] y
223
224
225 $ hg tip -p
226 changeset: 6:7fa44105f5b3
227 tag: tip
228 user: test
229 date: Thu Jan 01 00:00:06 1970 +0000
230 summary: binary-change-rename
231
232 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
233 Binary file tip.bundle has changed
234 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
235 Binary file top.bundle has changed
236
237
238 Add plain file
239
240 $ for i in 1 2 3 4 5 6 7 8 9 10; do
241 > echo $i >> plain
242 > done
243
244 $ hg add plain
245 $ hg commit -i -d '7 0' -m plain plain<<EOF
246 > y
247 > y
248 > EOF
249 diff --git a/plain b/plain
250 new file mode 100644
251 @@ -0,0 +1,10 @@
252 +1
253 +2
254 +3
255 +4
256 +5
257 +6
258 +7
259 +8
260 +9
261 +10
262 record this change to 'plain'?
263 (enter ? for help) [Ynesfdaq?] y
264
265 $ hg tip -p
266 changeset: 7:11fb457c1be4
267 tag: tip
268 user: test
269 date: Thu Jan 01 00:00:07 1970 +0000
270 summary: plain
271
272 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
273 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
274 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
275 @@ -0,0 +1,10 @@
276 +1
277 +2
278 +3
279 +4
280 +5
281 +6
282 +7
283 +8
284 +9
285 +10
286
287 Modify end of plain file with username unset
288
289 $ echo 11 >> plain
290 $ unset HGUSER
291 $ hg commit -i --config ui.username= -d '8 0' -m end plain
292 abort: no username supplied
293 (use 'hg config --edit' to set your username)
294 [255]
295
296
297 Modify end of plain file, also test that diffopts are accounted for
298
299 $ HGUSER="test"
300 $ export HGUSER
301 $ hg commit -i --config diff.showfunc=true -d '8 0' -m end plain <<EOF
302 > y
303 > y
304 > EOF
305 diff --git a/plain b/plain
306 1 hunks, 1 lines changed
307 @@ -8,3 +8,4 @@
308 8
309 9
310 10
311 +11
312 record this change to 'plain'?
313 (enter ? for help) [Ynesfdaq?] y
314
315
316 Modify end of plain file, no EOL
317
318 $ hg tip --template '{node}' >> plain
319 $ hg commit -i -d '9 0' -m noeol plain <<EOF
320 > y
321 > y
322 > EOF
323 diff --git a/plain b/plain
324 1 hunks, 1 lines changed
325 @@ -9,3 +9,4 @@
326 9
327 10
328 11
329 +7264f99c5f5ff3261504828afa4fb4d406c3af54
330 \ No newline at end of file
331 record this change to 'plain'?
332 (enter ? for help) [Ynesfdaq?] y
333
334
335 Record showfunc should preserve function across sections
336
337 $ cat > f1.py <<NO_CHECK_EOF
338 > def annotate(ui, repo, *pats, **opts):
339 > """show changeset information by line for each file
340 >
341 > List changes in files, showing the revision id responsible for
342 > each line.
343 >
344 > This command is useful for discovering when a change was made and
345 > by whom.
346 >
347 > If you include -f/-u/-d, the revision number is suppressed unless
348 > you also include -the revision number is suppressed unless
349 > you also include -n.
350 >
351 > Without the -a/--text option, annotate will avoid processing files
352 > it detects as binary. With -a, annotate will annotate the file
353 > anyway, although the results will probably be neither useful
354 > nor desirable.
355 >
356 > Returns 0 on success.
357 > """
358 > return 0
359 > def archive(ui, repo, dest, **opts):
360 > '''create an unversioned archive of a repository revision
361 >
362 > By default, the revision used is the parent of the working
363 > directory; use -r/--rev to specify a different revision.
364 >
365 > The archive type is automatically detected based on file
366 > extension (to override, use -t/--type).
367 >
368 > .. container:: verbose
369 >
370 > Valid types are:
371 > NO_CHECK_EOF
372 $ hg add f1.py
373 $ hg commit -m funcs
374 $ cat > f1.py <<NO_CHECK_EOF
375 > def annotate(ui, repo, *pats, **opts):
376 > """show changeset information by line for each file
377 >
378 > List changes in files, showing the revision id responsible for
379 > each line
380 >
381 > This command is useful for discovering when a change was made and
382 > by whom.
383 >
384 > Without the -a/--text option, annotate will avoid processing files
385 > it detects as binary. With -a, annotate will annotate the file
386 > anyway, although the results will probably be neither useful
387 > nor desirable.
388 >
389 > Returns 0 on success.
390 > """
391 > return 0
392 > def archive(ui, repo, dest, **opts):
393 > '''create an unversioned archive of a repository revision
394 >
395 > By default, the revision used is the parent of the working
396 > directory; use -r/--rev to specify a different revision.
397 >
398 > The archive type is automatically detected based on file
399 > extension (or override using -t/--type).
400 >
401 > .. container:: verbose
402 >
403 > Valid types are:
404 > NO_CHECK_EOF
405 $ hg commit -i -m interactive <<EOF
406 > y
407 > y
408 > y
409 > y
410 > EOF
411 diff --git a/f1.py b/f1.py
412 3 hunks, 6 lines changed
413 examine changes to 'f1.py'?
414 (enter ? for help) [Ynesfdaq?] y
415
416 @@ -2,8 +2,8 @@ def annotate(ui, repo, *pats, **opts):
417 """show changeset information by line for each file
418
419 List changes in files, showing the revision id responsible for
420 - each line.
421 + each line
422
423 This command is useful for discovering when a change was made and
424 by whom.
425
426 record change 1/3 to 'f1.py'?
427 (enter ? for help) [Ynesfdaq?] y
428
429 @@ -6,11 +6,7 @@ def annotate(ui, repo, *pats, **opts):
430
431 This command is useful for discovering when a change was made and
432 by whom.
433
434 - If you include -f/-u/-d, the revision number is suppressed unless
435 - you also include -the revision number is suppressed unless
436 - you also include -n.
437 -
438 Without the -a/--text option, annotate will avoid processing files
439 it detects as binary. With -a, annotate will annotate the file
440 anyway, although the results will probably be neither useful
441 record change 2/3 to 'f1.py'?
442 (enter ? for help) [Ynesfdaq?] y
443
444 @@ -26,7 +22,7 @@ def archive(ui, repo, dest, **opts):
445 directory; use -r/--rev to specify a different revision.
446
447 The archive type is automatically detected based on file
448 - extension (to override, use -t/--type).
449 + extension (or override using -t/--type).
450
451 .. container:: verbose
452
453 record change 3/3 to 'f1.py'?
454 (enter ? for help) [Ynesfdaq?] y
455
456
457 Modify end of plain file, add EOL
458
459 $ echo >> plain
460 $ echo 1 > plain2
461 $ hg add plain2
462 $ hg commit -i -d '10 0' -m eol plain plain2 <<EOF
463 > y
464 > y
465 > y
466 > y
467 > EOF
468 diff --git a/plain b/plain
469 1 hunks, 1 lines changed
470 @@ -9,4 +9,4 @@
471 9
472 10
473 11
474 -7264f99c5f5ff3261504828afa4fb4d406c3af54
475 \ No newline at end of file
476 +7264f99c5f5ff3261504828afa4fb4d406c3af54
477 record change 1/2 to 'plain'?
478 (enter ? for help) [Ynesfdaq?] y
479
480 diff --git a/plain2 b/plain2
481 new file mode 100644
482 @@ -0,0 +1,1 @@
483 +1
484 record change 2/2 to 'plain2'?
485 (enter ? for help) [Ynesfdaq?] y
486
487 Modify beginning, trim end, record both, add another file to test
488 changes numbering
489
490 $ rm plain
491 $ for i in 2 2 3 4 5 6 7 8 9 10; do
492 > echo $i >> plain
493 > done
494 $ echo 2 >> plain2
495
496 $ hg commit -i -d '10 0' -m begin-and-end plain plain2 <<EOF
497 > y
498 > y
499 > y
500 > y
501 > y
502 > EOF
503 diff --git a/plain b/plain
504 2 hunks, 3 lines changed
505 @@ -1,4 +1,4 @@
506 -1
507 +2
508 2
509 3
510 4
511 record change 1/3 to 'plain'?
512 (enter ? for help) [Ynesfdaq?] y
513
514 @@ -8,5 +8,3 @@
515 8
516 9
517 10
518 -11
519 -7264f99c5f5ff3261504828afa4fb4d406c3af54
520 record change 2/3 to 'plain'?
521 (enter ? for help) [Ynesfdaq?] y
522
523 diff --git a/plain2 b/plain2
524 1 hunks, 1 lines changed
525 @@ -1,1 +1,2 @@
526 1
527 +2
528 record change 3/3 to 'plain2'?
529 (enter ? for help) [Ynesfdaq?] y
530
531
532 $ hg tip -p
533 changeset: 13:f941910cff62
534 tag: tip
535 user: test
536 date: Thu Jan 01 00:00:10 1970 +0000
537 summary: begin-and-end
538
539 diff -r 33abe24d946c -r f941910cff62 plain
540 --- a/plain Thu Jan 01 00:00:10 1970 +0000
541 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
542 @@ -1,4 +1,4 @@
543 -1
544 +2
545 2
546 3
547 4
548 @@ -8,5 +8,3 @@
549 8
550 9
551 10
552 -11
553 -7264f99c5f5ff3261504828afa4fb4d406c3af54
554 diff -r 33abe24d946c -r f941910cff62 plain2
555 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
556 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
557 @@ -1,1 +1,2 @@
558 1
559 +2
560
561
562 Trim beginning, modify end
563
564 $ rm plain
565 > for i in 4 5 6 7 8 9 10.new; do
566 > echo $i >> plain
567 > done
568
569 Record end
570
571 $ hg commit -i -d '11 0' -m end-only plain <<EOF
572 > n
573 > y
574 > EOF
575 diff --git a/plain b/plain
576 2 hunks, 4 lines changed
577 @@ -1,9 +1,6 @@
578 -2
579 -2
580 -3
581 4
582 5
583 6
584 7
585 8
586 9
587 record change 1/2 to 'plain'?
588 (enter ? for help) [Ynesfdaq?] n
589
590 @@ -4,7 +1,7 @@
591 4
592 5
593 6
594 7
595 8
596 9
597 -10
598 +10.new
599 record change 2/2 to 'plain'?
600 (enter ? for help) [Ynesfdaq?] y
601
602
603 $ hg tip -p
604 changeset: 14:4915f538659b
605 tag: tip
606 user: test
607 date: Thu Jan 01 00:00:11 1970 +0000
608 summary: end-only
609
610 diff -r f941910cff62 -r 4915f538659b plain
611 --- a/plain Thu Jan 01 00:00:10 1970 +0000
612 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
613 @@ -7,4 +7,4 @@
614 7
615 8
616 9
617 -10
618 +10.new
619
620
621 Record beginning
622
623 $ hg commit -i -d '12 0' -m begin-only plain <<EOF
624 > y
625 > y
626 > EOF
627 diff --git a/plain b/plain
628 1 hunks, 3 lines changed
629 @@ -1,6 +1,3 @@
630 -2
631 -2
632 -3
633 4
634 5
635 6
636 record this change to 'plain'?
637 (enter ? for help) [Ynesfdaq?] y
638
639
640 $ hg tip -p
641 changeset: 15:1b1f93d4b94b
642 tag: tip
643 user: test
644 date: Thu Jan 01 00:00:12 1970 +0000
645 summary: begin-only
646
647 diff -r 4915f538659b -r 1b1f93d4b94b plain
648 --- a/plain Thu Jan 01 00:00:11 1970 +0000
649 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
650 @@ -1,6 +1,3 @@
651 -2
652 -2
653 -3
654 4
655 5
656 6
657
658
659 Add to beginning, trim from end
660
661 $ rm plain
662 $ for i in 1 2 3 4 5 6 7 8 9; do
663 > echo $i >> plain
664 > done
665
666 Record end
667
668 $ hg commit -i --traceback -d '13 0' -m end-again plain<<EOF
669 > n
670 > y
671 > EOF
672 diff --git a/plain b/plain
673 2 hunks, 4 lines changed
674 @@ -1,6 +1,9 @@
675 +1
676 +2
677 +3
678 4
679 5
680 6
681 7
682 8
683 9
684 record change 1/2 to 'plain'?
685 (enter ? for help) [Ynesfdaq?] n
686
687 @@ -1,7 +4,6 @@
688 4
689 5
690 6
691 7
692 8
693 9
694 -10.new
695 record change 2/2 to 'plain'?
696 (enter ? for help) [Ynesfdaq?] y
697
698
699 Add to beginning, middle, end
700
701 $ rm plain
702 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
703 > echo $i >> plain
704 > done
705
706 Record beginning, middle, and test that format-breaking diffopts are ignored
707
708 $ hg commit -i --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
709 > y
710 > y
711 > n
712 > EOF
713 diff --git a/plain b/plain
714 3 hunks, 7 lines changed
715 @@ -1,2 +1,5 @@
716 +1
717 +2
718 +3
719 4
720 5
721 record change 1/3 to 'plain'?
722 (enter ? for help) [Ynesfdaq?] y
723
724 @@ -1,6 +4,8 @@
725 4
726 5
727 +5.new
728 +5.reallynew
729 6
730 7
731 8
732 9
733 record change 2/3 to 'plain'?
734 (enter ? for help) [Ynesfdaq?] y
735
736 @@ -3,4 +8,6 @@
737 6
738 7
739 8
740 9
741 +10
742 +11
743 record change 3/3 to 'plain'?
744 (enter ? for help) [Ynesfdaq?] n
745
746
747 $ hg tip -p
748 changeset: 17:41cf3f5c55ae
749 tag: tip
750 user: test
751 date: Thu Jan 01 00:00:14 1970 +0000
752 summary: middle-only
753
754 diff -r a69d252246e1 -r 41cf3f5c55ae plain
755 --- a/plain Thu Jan 01 00:00:13 1970 +0000
756 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
757 @@ -1,5 +1,10 @@
758 +1
759 +2
760 +3
761 4
762 5
763 +5.new
764 +5.reallynew
765 6
766 7
767 8
768
769
770 Record end
771
772 $ hg commit -i -d '15 0' -m end-only plain <<EOF
773 > y
774 > y
775 > EOF
776 diff --git a/plain b/plain
777 1 hunks, 2 lines changed
778 @@ -9,3 +9,5 @@
779 7
780 8
781 9
782 +10
783 +11
784 record this change to 'plain'?
785 (enter ? for help) [Ynesfdaq?] y
786
787
788 $ hg tip -p
789 changeset: 18:58a72f46bc24
790 tag: tip
791 user: test
792 date: Thu Jan 01 00:00:15 1970 +0000
793 summary: end-only
794
795 diff -r 41cf3f5c55ae -r 58a72f46bc24 plain
796 --- a/plain Thu Jan 01 00:00:14 1970 +0000
797 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
798 @@ -9,3 +9,5 @@
799 7
800 8
801 9
802 +10
803 +11
804
805 Interactive commit can name a directory instead of files (issue6131)
806
807 $ mkdir subdir
808 $ echo a > subdir/a
809 $ hg ci -d '16 0' -i subdir -Amsubdir <<EOF
810 > y
811 > y
812 > EOF
813 adding subdir/a
814 diff --git a/subdir/a b/subdir/a
815 new file mode 100644
816 examine changes to 'subdir/a'?
817 (enter ? for help) [Ynesfdaq?] y
818
819 @@ -0,0 +1,1 @@
820 +a
821 record this change to 'subdir/a'?
822 (enter ? for help) [Ynesfdaq?] y
823
824 $ cd subdir
825
826 $ echo a >> a
827 $ hg commit -i -d '16 0' -m subdir-change a <<EOF
828 > y
829 > y
830 > EOF
831 diff --git a/subdir/a b/subdir/a
832 1 hunks, 1 lines changed
833 @@ -1,1 +1,2 @@
834 a
835 +a
836 record this change to 'subdir/a'?
837 (enter ? for help) [Ynesfdaq?] y
838
839
840 $ hg tip -p
841 changeset: 20:e0f6b99f6c49
842 tag: tip
843 user: test
844 date: Thu Jan 01 00:00:16 1970 +0000
845 summary: subdir-change
846
847 diff -r abd26b51de37 -r e0f6b99f6c49 subdir/a
848 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
849 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
850 @@ -1,1 +1,2 @@
851 a
852 +a
853
854
855 $ echo a > f1
856 $ echo b > f2
857 $ hg add f1 f2
858
859 $ hg ci -mz -d '17 0'
860
861 $ echo a >> f1
862 $ echo b >> f2
863
864 Help, quit
865
866 $ hg commit -i <<EOF
867 > ?
868 > q
869 > EOF
870 diff --git a/subdir/f1 b/subdir/f1
871 1 hunks, 1 lines changed
872 examine changes to 'subdir/f1'?
873 (enter ? for help) [Ynesfdaq?] ?
874
875 y - yes, record this change
876 n - no, skip this change
877 e - edit this change manually
878 s - skip remaining changes to this file
879 f - record remaining changes to this file
880 d - done, skip remaining changes and files
881 a - record all changes to all remaining files
882 q - quit, recording no changes
883 ? - ? (display help)
884 examine changes to 'subdir/f1'?
885 (enter ? for help) [Ynesfdaq?] q
886
887 abort: user quit
888 [250]
889
890 Patterns
891
892 $ hg commit -i 'glob:f*' << EOF
893 > y
894 > n
895 > y
896 > n
897 > EOF
898 diff --git a/subdir/f1 b/subdir/f1
899 1 hunks, 1 lines changed
900 examine changes to 'subdir/f1'?
901 (enter ? for help) [Ynesfdaq?] y
902
903 @@ -1,1 +1,2 @@
904 a
905 +a
906 record change 1/2 to 'subdir/f1'?
907 (enter ? for help) [Ynesfdaq?] n
908
909 diff --git a/subdir/f2 b/subdir/f2
910 1 hunks, 1 lines changed
911 examine changes to 'subdir/f2'?
912 (enter ? for help) [Ynesfdaq?] y
913
914 @@ -1,1 +1,2 @@
915 b
916 +b
917 record change 2/2 to 'subdir/f2'?
918 (enter ? for help) [Ynesfdaq?] n
919
920 no changes to record
921 [1]
922
923 #if gettext
924
925 Test translated help message
926
927 str.lower() instead of encoding.lower(str) on translated message might
928 make message meaningless, because some encoding uses 0x41(A) - 0x5a(Z)
929 as the second or later byte of multi-byte character.
930
931 For example, "\x8bL\x98^" (translation of "record" in ja_JP.cp932)
932 contains 0x4c (L). str.lower() replaces 0x4c(L) by 0x6c(l) and this
933 replacement makes message meaningless.
934
935 This tests that translated help message is lower()-ed correctly.
936
937 $ LANGUAGE=ja
938 $ export LANGUAGE
939
940 $ cat > $TESTTMP/escape.py <<EOF
941 > from mercurial import (
942 > pycompat,
943 > )
944 > from mercurial.utils import (
945 > procutil,
946 > )
947 > def escape(c):
948 > o = ord(c)
949 > if o < 0x80:
950 > return c
951 > else:
952 > return br'\x%02x' % o # escape char setting MSB
953 > for l in procutil.stdin:
954 > procutil.stdout.write(
955 > b''.join(escape(c) for c in pycompat.iterbytestr(l)))
956 > EOF
957
958 $ hg commit -i --encoding cp932 2>&1 <<EOF | "$PYTHON" $TESTTMP/escape.py | grep '^y - '
959 > ?
960 > q
961 > EOF
962 y - \x82\xb1\x82\xcc\x95\xcf\x8dX\x82\xf0\x8bL\x98^(yes)
963
964 $ LANGUAGE=
965 #endif
966
967 Skip
968
969 $ hg commit -i <<EOF
970 > s
971 > EOF
972 diff --git a/subdir/f1 b/subdir/f1
973 1 hunks, 1 lines changed
974 examine changes to 'subdir/f1'?
975 (enter ? for help) [Ynesfdaq?] s
976
977 diff --git a/subdir/f2 b/subdir/f2
978 1 hunks, 1 lines changed
979 examine changes to 'subdir/f2'?
980 (enter ? for help) [Ynesfdaq?] abort: response expected
981 [255]
982
983 No
984
985 $ hg commit -i <<EOF
986 > n
987 > EOF
988 diff --git a/subdir/f1 b/subdir/f1
989 1 hunks, 1 lines changed
990 examine changes to 'subdir/f1'?
991 (enter ? for help) [Ynesfdaq?] n
992
993 diff --git a/subdir/f2 b/subdir/f2
994 1 hunks, 1 lines changed
995 examine changes to 'subdir/f2'?
996 (enter ? for help) [Ynesfdaq?] abort: response expected
997 [255]
998
999 f, quit
1000
1001 $ hg commit -i <<EOF
1002 > f
1003 > q
1004 > EOF
1005 diff --git a/subdir/f1 b/subdir/f1
1006 1 hunks, 1 lines changed
1007 examine changes to 'subdir/f1'?
1008 (enter ? for help) [Ynesfdaq?] f
1009
1010 diff --git a/subdir/f2 b/subdir/f2
1011 1 hunks, 1 lines changed
1012 examine changes to 'subdir/f2'?
1013 (enter ? for help) [Ynesfdaq?] q
1014
1015 abort: user quit
1016 [250]
1017
1018 s, all
1019
1020 $ hg commit -i -d '18 0' -mx <<EOF
1021 > s
1022 > a
1023 > EOF
1024 diff --git a/subdir/f1 b/subdir/f1
1025 1 hunks, 1 lines changed
1026 examine changes to 'subdir/f1'?
1027 (enter ? for help) [Ynesfdaq?] s
1028
1029 diff --git a/subdir/f2 b/subdir/f2
1030 1 hunks, 1 lines changed
1031 examine changes to 'subdir/f2'?
1032 (enter ? for help) [Ynesfdaq?] a
1033
1034
1035 $ hg tip -p
1036 changeset: 22:6afbbefacf35
1037 tag: tip
1038 user: test
1039 date: Thu Jan 01 00:00:18 1970 +0000
1040 summary: x
1041
1042 diff -r b73c401c693c -r 6afbbefacf35 subdir/f2
1043 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
1044 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
1045 @@ -1,1 +1,2 @@
1046 b
1047 +b
1048
1049
1050 f
1051
1052 $ hg commit -i -d '19 0' -my <<EOF
1053 > f
1054 > EOF
1055 diff --git a/subdir/f1 b/subdir/f1
1056 1 hunks, 1 lines changed
1057 examine changes to 'subdir/f1'?
1058 (enter ? for help) [Ynesfdaq?] f
1059
1060
1061 $ hg tip -p
1062 changeset: 23:715028a33949
1063 tag: tip
1064 user: test
1065 date: Thu Jan 01 00:00:19 1970 +0000
1066 summary: y
1067
1068 diff -r 6afbbefacf35 -r 715028a33949 subdir/f1
1069 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
1070 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
1071 @@ -1,1 +1,2 @@
1072 a
1073 +a
1074
1075
1076 #if execbit
1077
1078 Preserve chmod +x
1079
1080 $ chmod +x f1
1081 $ echo a >> f1
1082 $ hg commit -i -d '20 0' -mz <<EOF
1083 > y
1084 > y
1085 > y
1086 > EOF
1087 diff --git a/subdir/f1 b/subdir/f1
1088 old mode 100644
1089 new mode 100755
1090 1 hunks, 1 lines changed
1091 examine changes to 'subdir/f1'?
1092 (enter ? for help) [Ynesfdaq?] y
1093
1094 @@ -1,2 +1,3 @@
1095 a
1096 a
1097 +a
1098 record this change to 'subdir/f1'?
1099 (enter ? for help) [Ynesfdaq?] y
1100
1101
1102 $ hg tip --config diff.git=True -p
1103 changeset: 24:db967c1e5884
1104 tag: tip
1105 user: test
1106 date: Thu Jan 01 00:00:20 1970 +0000
1107 summary: z
1108
1109 diff --git a/subdir/f1 b/subdir/f1
1110 old mode 100644
1111 new mode 100755
1112 --- a/subdir/f1
1113 +++ b/subdir/f1
1114 @@ -1,2 +1,3 @@
1115 a
1116 a
1117 +a
1118
1119
1120 Preserve execute permission on original
1121
1122 $ echo b >> f1
1123 $ hg commit -i -d '21 0' -maa <<EOF
1124 > y
1125 > y
1126 > y
1127 > EOF
1128 diff --git a/subdir/f1 b/subdir/f1
1129 1 hunks, 1 lines changed
1130 examine changes to 'subdir/f1'?
1131 (enter ? for help) [Ynesfdaq?] y
1132
1133 @@ -1,3 +1,4 @@
1134 a
1135 a
1136 a
1137 +b
1138 record this change to 'subdir/f1'?
1139 (enter ? for help) [Ynesfdaq?] y
1140
1141
1142 $ hg tip --config diff.git=True -p
1143 changeset: 25:88903aef81c3
1144 tag: tip
1145 user: test
1146 date: Thu Jan 01 00:00:21 1970 +0000
1147 summary: aa
1148
1149 diff --git a/subdir/f1 b/subdir/f1
1150 --- a/subdir/f1
1151 +++ b/subdir/f1
1152 @@ -1,3 +1,4 @@
1153 a
1154 a
1155 a
1156 +b
1157
1158
1159 Preserve chmod -x
1160
1161 $ chmod -x f1
1162 $ echo c >> f1
1163 $ hg commit -i -d '22 0' -mab <<EOF
1164 > y
1165 > y
1166 > y
1167 > EOF
1168 diff --git a/subdir/f1 b/subdir/f1
1169 old mode 100755
1170 new mode 100644
1171 1 hunks, 1 lines changed
1172 examine changes to 'subdir/f1'?
1173 (enter ? for help) [Ynesfdaq?] y
1174
1175 @@ -2,3 +2,4 @@ a
1176 a
1177 a
1178 b
1179 +c
1180 record this change to 'subdir/f1'?
1181 (enter ? for help) [Ynesfdaq?] y
1182
1183
1184 $ hg tip --config diff.git=True -p
1185 changeset: 26:7af84b6cf560
1186 tag: tip
1187 user: test
1188 date: Thu Jan 01 00:00:22 1970 +0000
1189 summary: ab
1190
1191 diff --git a/subdir/f1 b/subdir/f1
1192 old mode 100755
1193 new mode 100644
1194 --- a/subdir/f1
1195 +++ b/subdir/f1
1196 @@ -2,3 +2,4 @@
1197 a
1198 a
1199 b
1200 +c
1201
1202
1203 #else
1204
1205 Slightly bogus tests to get almost same repo structure as when x bit is used
1206 - but with different hashes.
1207
1208 Mock "Preserve chmod +x"
1209
1210 $ echo a >> f1
1211 $ hg commit -i -d '20 0' -mz <<EOF
1212 > y
1213 > y
1214 > y
1215 > EOF
1216 diff --git a/subdir/f1 b/subdir/f1
1217 1 hunks, 1 lines changed
1218 examine changes to 'subdir/f1'?
1219 (enter ? for help) [Ynesfdaq?] y
1220
1221 @@ -1,2 +1,3 @@
1222 a
1223 a
1224 +a
1225 record this change to 'subdir/f1'?
1226 (enter ? for help) [Ynesfdaq?] y
1227
1228
1229 $ hg tip --config diff.git=True -p
1230 changeset: 24:c26cfe2c4eb0
1231 tag: tip
1232 user: test
1233 date: Thu Jan 01 00:00:20 1970 +0000
1234 summary: z
1235
1236 diff --git a/subdir/f1 b/subdir/f1
1237 --- a/subdir/f1
1238 +++ b/subdir/f1
1239 @@ -1,2 +1,3 @@
1240 a
1241 a
1242 +a
1243
1244
1245 Mock "Preserve execute permission on original"
1246
1247 $ echo b >> f1
1248 $ hg commit -i -d '21 0' -maa <<EOF
1249 > y
1250 > y
1251 > y
1252 > EOF
1253 diff --git a/subdir/f1 b/subdir/f1
1254 1 hunks, 1 lines changed
1255 examine changes to 'subdir/f1'?
1256 (enter ? for help) [Ynesfdaq?] y
1257
1258 @@ -1,3 +1,4 @@
1259 a
1260 a
1261 a
1262 +b
1263 record this change to 'subdir/f1'?
1264 (enter ? for help) [Ynesfdaq?] y
1265
1266
1267 $ hg tip --config diff.git=True -p
1268 changeset: 25:a48d2d60adde
1269 tag: tip
1270 user: test
1271 date: Thu Jan 01 00:00:21 1970 +0000
1272 summary: aa
1273
1274 diff --git a/subdir/f1 b/subdir/f1
1275 --- a/subdir/f1
1276 +++ b/subdir/f1
1277 @@ -1,3 +1,4 @@
1278 a
1279 a
1280 a
1281 +b
1282
1283
1284 Mock "Preserve chmod -x"
1285
1286 $ chmod -x f1
1287 $ echo c >> f1
1288 $ hg commit -i -d '22 0' -mab <<EOF
1289 > y
1290 > y
1291 > y
1292 > EOF
1293 diff --git a/subdir/f1 b/subdir/f1
1294 1 hunks, 1 lines changed
1295 examine changes to 'subdir/f1'?
1296 (enter ? for help) [Ynesfdaq?] y
1297
1298 @@ -2,3 +2,4 @@ a
1299 a
1300 a
1301 b
1302 +c
1303 record this change to 'subdir/f1'?
1304 (enter ? for help) [Ynesfdaq?] y
1305
1306
1307 $ hg tip --config diff.git=True -p
1308 changeset: 26:5cc89ae210fa
1309 tag: tip
1310 user: test
1311 date: Thu Jan 01 00:00:22 1970 +0000
1312 summary: ab
1313
1314 diff --git a/subdir/f1 b/subdir/f1
1315 --- a/subdir/f1
1316 +++ b/subdir/f1
1317 @@ -2,3 +2,4 @@
1318 a
1319 a
1320 b
1321 +c
1322
1323
1324 #endif
1325
1326 $ cd ..
1327
1328
1329 Abort early when a merge is in progress
1330
1331 $ hg up 4
1332 1 files updated, 0 files merged, 7 files removed, 0 files unresolved
1333
1334 $ touch iwillmergethat
1335 $ hg add iwillmergethat
1336
1337 $ hg branch thatbranch
1338 marked working directory as branch thatbranch
1339 (branches are permanent and global, did you want a bookmark?)
1340
1341 $ hg ci -m'new head'
1342
1343 $ hg up default
1344 7 files updated, 0 files merged, 2 files removed, 0 files unresolved
1345
1346 $ hg merge thatbranch
1347 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1348 (branch merge, don't forget to commit)
1349
1350 $ hg commit -i -m'will abort'
1351 abort: cannot partially commit a merge (use "hg commit" instead)
1352 [10]
1353
1354 $ hg up -C
1355 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1356
1357 Editing patch (and ignoring trailing text)
1358
1359 $ cat > editor.sh << '__EOF__'
1360 > sed -e 7d -e '5s/^-/ /' -e '/^# ---/i\
1361 > trailing\nditto' "$1" > tmp
1362 > mv tmp "$1"
1363 > __EOF__
1364 $ cat > editedfile << '__EOF__'
1365 > This is the first line
1366 > This is the second line
1367 > This is the third line
1368 > __EOF__
1369 $ hg add editedfile
1370 $ hg commit -medit-patch-1
1371 $ cat > editedfile << '__EOF__'
1372 > This line has changed
1373 > This change will be committed
1374 > This is the third line
1375 > __EOF__
1376 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '23 0' -medit-patch-2 <<EOF
1377 > y
1378 > e
1379 > EOF
1380 diff --git a/editedfile b/editedfile
1381 1 hunks, 2 lines changed
1382 examine changes to 'editedfile'?
1383 (enter ? for help) [Ynesfdaq?] y
1384
1385 @@ -1,3 +1,3 @@
1386 -This is the first line
1387 -This is the second line
1388 +This line has changed
1389 +This change will be committed
1390 This is the third line
1391 record this change to 'editedfile'?
1392 (enter ? for help) [Ynesfdaq?] e
1393
1394 $ cat editedfile
1395 This line has changed
1396 This change will be committed
1397 This is the third line
1398 $ hg cat -r tip editedfile
1399 This is the first line
1400 This change will be committed
1401 This is the third line
1402 $ hg revert editedfile
1403
1404 Trying to edit patch for whole file
1405
1406 $ echo "This is the fourth line" >> editedfile
1407 $ hg commit -i <<EOF
1408 > e
1409 > q
1410 > EOF
1411 diff --git a/editedfile b/editedfile
1412 1 hunks, 1 lines changed
1413 examine changes to 'editedfile'?
1414 (enter ? for help) [Ynesfdaq?] e
1415
1416 cannot edit patch for whole file
1417 examine changes to 'editedfile'?
1418 (enter ? for help) [Ynesfdaq?] q
1419
1420 abort: user quit
1421 [250]
1422 $ hg revert editedfile
1423
1424 Removing changes from patch
1425
1426 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1427 $ mv tmp editedfile
1428 $ echo "This line has been added" >> editedfile
1429 $ cat > editor.sh << '__EOF__'
1430 > sed -e 's/^[-+]/ /' "$1" > tmp
1431 > mv tmp "$1"
1432 > __EOF__
1433 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF
1434 > y
1435 > e
1436 > EOF
1437 diff --git a/editedfile b/editedfile
1438 1 hunks, 3 lines changed
1439 examine changes to 'editedfile'?
1440 (enter ? for help) [Ynesfdaq?] y
1441
1442 @@ -1,3 +1,3 @@
1443 -This is the first line
1444 -This change will be committed
1445 -This is the third line
1446 +This change will not be committed
1447 +This is the second line
1448 +This line has been added
1449 record this change to 'editedfile'?
1450 (enter ? for help) [Ynesfdaq?] e
1451
1452 no changes to record
1453 [1]
1454 $ cat editedfile
1455 This change will not be committed
1456 This is the second line
1457 This line has been added
1458 $ hg cat -r tip editedfile
1459 This is the first line
1460 This change will be committed
1461 This is the third line
1462 $ hg revert editedfile
1463
1464 Invalid patch
1465
1466 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1467 $ mv tmp editedfile
1468 $ echo "This line has been added" >> editedfile
1469 $ cat > editor.sh << '__EOF__'
1470 > sed s/This/That/ "$1" > tmp
1471 > mv tmp "$1"
1472 > __EOF__
1473 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF
1474 > y
1475 > e
1476 > EOF
1477 diff --git a/editedfile b/editedfile
1478 1 hunks, 3 lines changed
1479 examine changes to 'editedfile'?
1480 (enter ? for help) [Ynesfdaq?] y
1481
1482 @@ -1,3 +1,3 @@
1483 -This is the first line
1484 -This change will be committed
1485 -This is the third line
1486 +This change will not be committed
1487 +This is the second line
1488 +This line has been added
1489 record this change to 'editedfile'?
1490 (enter ? for help) [Ynesfdaq?] e
1491
1492 patching file editedfile
1493 Hunk #1 FAILED at 0
1494 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej
1495 abort: patch failed to apply
1496 [20]
1497 $ cat editedfile
1498 This change will not be committed
1499 This is the second line
1500 This line has been added
1501 $ hg cat -r tip editedfile
1502 This is the first line
1503 This change will be committed
1504 This is the third line
1505 $ cat editedfile.rej
1506 --- editedfile
1507 +++ editedfile
1508 @@ -1,3 +1,3 @@
1509 -That is the first line
1510 -That change will be committed
1511 -That is the third line
1512 +That change will not be committed
1513 +That is the second line
1514 +That line has been added
1515
1516 Malformed patch - error handling
1517
1518 $ cat > editor.sh << '__EOF__'
1519 > sed -e '/^@/p' "$1" > tmp
1520 > mv tmp "$1"
1521 > __EOF__
1522 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF
1523 > y
1524 > e
1525 > EOF
1526 diff --git a/editedfile b/editedfile
1527 1 hunks, 3 lines changed
1528 examine changes to 'editedfile'?
1529 (enter ? for help) [Ynesfdaq?] y
1530
1531 @@ -1,3 +1,3 @@
1532 -This is the first line
1533 -This change will be committed
1534 -This is the third line
1535 +This change will not be committed
1536 +This is the second line
1537 +This line has been added
1538 record this change to 'editedfile'?
1539 (enter ? for help) [Ynesfdaq?] e
1540
1541 abort: error parsing patch: unhandled transition: range -> range
1542 [10]
1543
1544 Exiting editor with status 1, ignores the edit but does not stop the recording
1545 session
1546
1547 $ HGEDITOR=false hg commit -i <<EOF
1548 > y
1549 > e
1550 > n
1551 > EOF
1552 diff --git a/editedfile b/editedfile
1553 1 hunks, 3 lines changed
1554 examine changes to 'editedfile'?
1555 (enter ? for help) [Ynesfdaq?] y
1556
1557 @@ -1,3 +1,3 @@
1558 -This is the first line
1559 -This change will be committed
1560 -This is the third line
1561 +This change will not be committed
1562 +This is the second line
1563 +This line has been added
1564 record this change to 'editedfile'?
1565 (enter ? for help) [Ynesfdaq?] e
1566
1567 editor exited with exit code 1
1568 record this change to 'editedfile'?
1569 (enter ? for help) [Ynesfdaq?] n
1570
1571 no changes to record
1572 [1]
1573
1574
1575 random text in random positions is still an error
1576
1577 $ cat > editor.sh << '__EOF__'
1578 > sed -e '/^@/i\
1579 > other' "$1" > tmp
1580 > mv tmp "$1"
1581 > __EOF__
1582 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i <<EOF
1583 > y
1584 > e
1585 > EOF
1586 diff --git a/editedfile b/editedfile
1587 1 hunks, 3 lines changed
1588 examine changes to 'editedfile'?
1589 (enter ? for help) [Ynesfdaq?] y
1590
1591 @@ -1,3 +1,3 @@
1592 -This is the first line
1593 -This change will be committed
1594 -This is the third line
1595 +This change will not be committed
1596 +This is the second line
1597 +This line has been added
1598 record this change to 'editedfile'?
1599 (enter ? for help) [Ynesfdaq?] e
1600
1601 abort: error parsing patch: unhandled transition: file -> other
1602 [10]
1603
1604 $ hg up -C
1605 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1606
1607 With win32text
1608
1609 $ echo '[extensions]' >> .hg/hgrc
1610 $ echo 'win32text = ' >> .hg/hgrc
1611 $ echo '[decode]' >> .hg/hgrc
1612 $ echo '** = cleverdecode:' >> .hg/hgrc
1613 $ echo '[encode]' >> .hg/hgrc
1614 $ echo '** = cleverencode:' >> .hg/hgrc
1615 $ echo '[patch]' >> .hg/hgrc
1616 $ echo 'eol = crlf' >> .hg/hgrc
1617
1618 Ignore win32text deprecation warning for now:
1619
1620 $ echo '[win32text]' >> .hg/hgrc
1621 $ echo 'warn = no' >> .hg/hgrc
1622
1623 $ echo d >> subdir/f1
1624 $ hg commit -i -d '24 0' -mw1 <<EOF
1625 > y
1626 > y
1627 > EOF
1628 diff --git a/subdir/f1 b/subdir/f1
1629 1 hunks, 1 lines changed
1630 examine changes to 'subdir/f1'?
1631 (enter ? for help) [Ynesfdaq?] y
1632
1633 @@ -3,3 +3,4 @@ a
1634 a
1635 b
1636 c
1637 +d
1638 record this change to 'subdir/f1'?
1639 (enter ? for help) [Ynesfdaq?] y
1640
1641
1642 $ hg status -A subdir/f1
1643 C subdir/f1
1644 $ hg tip -p
1645 changeset: 30:* (glob)
1646 tag: tip
1647 user: test
1648 date: Thu Jan 01 00:00:24 1970 +0000
1649 summary: w1
1650
1651 diff -r ???????????? -r ???????????? subdir/f1 (glob)
1652 --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
1653 +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000
1654 @@ -3,3 +3,4 @@
1655 a
1656 b
1657 c
1658 +d
1659
1660
1661
1662 Test --user when ui.username not set
1663 $ unset HGUSER
1664 $ echo e >> subdir/f1
1665 $ hg commit -i --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF
1666 > y
1667 > y
1668 > EOF
1669 diff --git a/subdir/f1 b/subdir/f1
1670 1 hunks, 1 lines changed
1671 examine changes to 'subdir/f1'?
1672 (enter ? for help) [Ynesfdaq?] y
1673
1674 @@ -4,3 +4,4 @@ a
1675 b
1676 c
1677 d
1678 +e
1679 record this change to 'subdir/f1'?
1680 (enter ? for help) [Ynesfdaq?] y
1681
1682 $ hg status -A subdir/f1
1683 C subdir/f1
1684 $ hg log --template '{author}\n' -l 1
1685 xyz
1686 $ HGUSER="test"
1687 $ export HGUSER
1688
1689
1690 Moving files
1691
1692 $ hg update -C .
1693 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1694 $ hg mv plain plain3
1695 $ echo somechange >> plain3
1696 $ hg commit -i -d '23 0' -mmoving_files << EOF
1697 > y
1698 > y
1699 > EOF
1700 diff --git a/plain b/plain3
1701 rename from plain
1702 rename to plain3
1703 1 hunks, 1 lines changed
1704 examine changes to 'plain' and 'plain3'?
1705 (enter ? for help) [Ynesfdaq?] y
1706
1707 @@ -11,3 +11,4 @@
1708 9
1709 10
1710 11
1711 +somechange
1712 record this change to 'plain3'?
1713 (enter ? for help) [Ynesfdaq?] y
1714
1715
1716 Rename file but discard edits
1717
1718 $ echo content > new-file
1719 $ hg add -q new-file
1720 $ hg commit -qm 'new file'
1721 $ hg mv new-file renamed-file
1722 $ echo new-content >> renamed-file
1723 $ hg commit -i -d '24 0' -m content-rename<<EOF
1724 > y
1725 > n
1726 > EOF
1727 diff --git a/new-file b/renamed-file
1728 rename from new-file
1729 rename to renamed-file
1730 1 hunks, 1 lines changed
1731 examine changes to 'new-file' and 'renamed-file'?
1732 (enter ? for help) [Ynesfdaq?] y
1733
1734 @@ -1,1 +1,2 @@
1735 content
1736 +new-content
1737 record this change to 'renamed-file'?
1738 (enter ? for help) [Ynesfdaq?] n
1739
1740 $ hg status
1741 M renamed-file
1742 ? editedfile.orig
1743 ? editedfile.rej
1744 ? editor.sh
1745 $ hg diff
1746 diff -r * renamed-file (glob)
1747 --- a/renamed-file Thu Jan 01 00:00:24 1970 +0000
1748 +++ b/renamed-file Thu Jan 01 00:00:00 1970 +0000
1749 @@ -1,1 +1,2 @@
1750 content
1751 +new-content
1752
1753 The #if execbit block above changes the hash here on some systems
1754 $ hg status -A plain3
1755 C plain3
1756 $ hg tip
1757 changeset: 34:* (glob)
1758 tag: tip
1759 user: test
1760 date: Thu Jan 01 00:00:24 1970 +0000
1761 summary: content-rename
1762
1763 Editing patch of newly added file
1764
1765 $ hg update -C .
1766 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1767 $ cat > editor.sh << '__EOF__'
1768 > cat "$1" | sed "s/first/very/g" > tt
1769 > mv tt "$1"
1770 > __EOF__
1771 $ cat > newfile << '__EOF__'
1772 > This is the first line
1773 > This is the second line
1774 > This is the third line
1775 > __EOF__
1776 $ hg add newfile
1777 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit -i -d '25 0' -medit-patch-new <<EOF
1778 > y
1779 > e
1780 > EOF
1781 diff --git a/newfile b/newfile
1782 new file mode 100644
1783 examine changes to 'newfile'?
1784 (enter ? for help) [Ynesfdaq?] y
1785
1786 @@ -0,0 +1,3 @@
1787 +This is the first line
1788 +This is the second line
1789 +This is the third line
1790 record this change to 'newfile'?
1791 (enter ? for help) [Ynesfdaq?] e
1792
1793 $ hg cat -r tip newfile
1794 This is the very line
1795 This is the second line
1796 This is the third line
1797
1798 $ cat newfile
1799 This is the first line
1800 This is the second line
1801 This is the third line
1802
1803 Add new file from within a subdirectory
1804 $ hg update -C .
1805 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1806 $ mkdir folder
1807 $ cd folder
1808 $ echo "foo" > bar
1809 $ hg add bar
1810 $ hg commit -i -d '26 0' -mnewfilesubdir <<EOF
1811 > y
1812 > y
1813 > EOF
1814 diff --git a/folder/bar b/folder/bar
1815 new file mode 100644
1816 examine changes to 'folder/bar'?
1817 (enter ? for help) [Ynesfdaq?] y
1818
1819 @@ -0,0 +1,1 @@
1820 +foo
1821 record this change to 'folder/bar'?
1822 (enter ? for help) [Ynesfdaq?] y
1823
1824 The #if execbit block above changes the hashes here on some systems
1825 $ hg tip -p
1826 changeset: 36:* (glob)
1827 tag: tip
1828 user: test
1829 date: Thu Jan 01 00:00:26 1970 +0000
1830 summary: newfilesubdir
1831
1832 diff -r * -r * folder/bar (glob)
1833 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1834 +++ b/folder/bar Thu Jan 01 00:00:26 1970 +0000
1835 @@ -0,0 +1,1 @@
1836 +foo
1837
1838 $ cd ..
1839
1840 $ hg status -A folder/bar
1841 C folder/bar
1842
1843 Clear win32text configuration before size/timestamp sensitive test
1844
1845 $ cat >> .hg/hgrc <<EOF
1846 > [extensions]
1847 > win32text = !
1848 > [decode]
1849 > ** = !
1850 > [encode]
1851 > ** = !
1852 > [patch]
1853 > eol = strict
1854 > EOF
1855 $ hg update -q -C null
1856 $ hg update -q -C tip
1857
1858 Test that partially committed file is still treated as "modified",
1859 even if none of mode, size and timestamp is changed on the filesystem
1860 (see also issue4583).
1861
1862 $ cat > subdir/f1 <<EOF
1863 > A
1864 > a
1865 > a
1866 > b
1867 > c
1868 > d
1869 > E
1870 > EOF
1871 $ hg diff --git subdir/f1
1872 diff --git a/subdir/f1 b/subdir/f1
1873 --- a/subdir/f1
1874 +++ b/subdir/f1
1875 @@ -1,7 +1,7 @@
1876 -a
1877 +A
1878 a
1879 a
1880 b
1881 c
1882 d
1883 -e
1884 +E
1885
1886 $ touch -t 200001010000 subdir/f1
1887
1888 $ cat >> .hg/hgrc <<EOF
1889 > # emulate invoking patch.internalpatch() at 2000-01-01 00:00
1890 > [fakepatchtime]
1891 > fakenow = 200001010000
1892 >
1893 > [extensions]
1894 > fakepatchtime = $TESTDIR/fakepatchtime.py
1895 > EOF
1896 $ hg commit -i -m 'commit subdir/f1 partially' <<EOF
1897 > y
1898 > y
1899 > n
1900 > EOF
1901 diff --git a/subdir/f1 b/subdir/f1
1902 2 hunks, 2 lines changed
1903 examine changes to 'subdir/f1'?
1904 (enter ? for help) [Ynesfdaq?] y
1905
1906 @@ -1,6 +1,6 @@
1907 -a
1908 +A
1909 a
1910 a
1911 b
1912 c
1913 d
1914 record change 1/2 to 'subdir/f1'?
1915 (enter ? for help) [Ynesfdaq?] y
1916
1917 @@ -2,6 +2,6 @@
1918 a
1919 a
1920 b
1921 c
1922 d
1923 -e
1924 +E
1925 record change 2/2 to 'subdir/f1'?
1926 (enter ? for help) [Ynesfdaq?] n
1927
1928 $ cat >> .hg/hgrc <<EOF
1929 > [extensions]
1930 > fakepatchtime = !
1931 > EOF
1932
1933 $ hg debugstate | grep ' subdir/f1$'
1934 n 0 -1 unset subdir/f1
1935 $ hg status -A subdir/f1
1936 M subdir/f1
1937
1938 Test commands.commit.interactive.unified=0
1939
1940 $ hg init $TESTTMP/b
1941 $ cd $TESTTMP/b
1942 $ cat > foo <<EOF
1943 > 1
1944 > 2
1945 > 3
1946 > 4
1947 > 5
1948 > EOF
1949 $ hg ci -qAm initial
1950 $ cat > foo <<EOF
1951 > 1
1952 > change1
1953 > 2
1954 > 3
1955 > change2
1956 > 4
1957 > 5
1958 > EOF
1959 $ printf 'y\ny\ny\n' | hg ci -im initial --config commands.commit.interactive.unified=0
1960 diff --git a/foo b/foo
1961 2 hunks, 2 lines changed
1962 examine changes to 'foo'?
1963 (enter ? for help) [Ynesfdaq?] y
1964
1965 @@ -1,0 +2,1 @@
1966 +change1
1967 record change 1/2 to 'foo'?
1968 (enter ? for help) [Ynesfdaq?] y
1969
1970 @@ -3,0 +5,1 @@
1971 +change2
1972 record change 2/2 to 'foo'?
1973 (enter ? for help) [Ynesfdaq?] y
1974
1975 $ cd $TESTTMP
1976
1977 Test diff.ignoreblanklines=1
1978
1979 $ hg init c
1980 $ cd c
1981 $ cat > foo <<EOF
1982 > 1
1983 > 2
1984 > 3
1985 > 4
1986 > 5
1987 > EOF
1988 $ hg ci -qAm initial
1989 $ cat > foo <<EOF
1990 > 1
1991 >
1992 > 2
1993 > 3
1994 > change2
1995 > 4
1996 > 5
1997 > EOF
1998 $ printf 'y\ny\ny\n' | hg ci -im initial --config diff.ignoreblanklines=1
1999 diff --git a/foo b/foo
2000 2 hunks, 2 lines changed
2001 examine changes to 'foo'?
2002 (enter ? for help) [Ynesfdaq?] y
2003
2004 @@ -1,3 +1,4 @@
2005 1
2006 +
2007 2
2008 3
2009 record change 1/2 to 'foo'?
2010 (enter ? for help) [Ynesfdaq?] y
2011
2012 @@ -2,4 +3,5 @@
2013 2
2014 3
2015 +change2
2016 4
2017 5
2018 record change 2/2 to 'foo'?
2019 (enter ? for help) [Ynesfdaq?] y
2020
2021