##// END OF EJS Templates
record: remove duplicated tests...
Laurent Charignon -
r24308:1725843a default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (1452 lines changed) Show them Hide them
@@ -10,6 +10,59 b' Set up a repo'
10 $ hg init a
10 $ hg init a
11 $ cd a
11 $ cd a
12
12
13 Record help
14
15 $ hg record -h
16 hg record [OPTION]... [FILE]...
17
18 interactively select changes to commit
19
20 If a list of files is omitted, all changes reported by "hg status" will be
21 candidates for recording.
22
23 See "hg help dates" for a list of formats valid for -d/--date.
24
25 You will be prompted for whether to record changes to each modified file,
26 and for files with multiple changes, for each change to use. For each
27 query, the following responses are possible:
28
29 y - record this change
30 n - skip this change
31 e - edit this change manually
32
33 s - skip remaining changes to this file
34 f - record remaining changes to this file
35
36 d - done, skip remaining changes and files
37 a - record all changes to all remaining files
38 q - quit, recording no changes
39
40 ? - display help
41
42 This command is not available when committing a merge.
43
44 options ([+] can be repeated):
45
46 -A --addremove mark new/missing files as added/removed before
47 committing
48 --close-branch mark a branch as closed, hiding it from the branch
49 list
50 --amend amend the parent of the working dir
51 -s --secret use the secret phase for committing
52 -e --edit invoke editor on commit messages
53 -I --include PATTERN [+] include names matching the given patterns
54 -X --exclude PATTERN [+] exclude names matching the given patterns
55 -m --message TEXT use text as commit message
56 -l --logfile FILE read commit message from file
57 -d --date DATE record the specified date as commit date
58 -u --user USER record the specified user as committer
59 -S --subrepos recurse into subrepositories
60 -w --ignore-all-space ignore white space when comparing lines
61 -b --ignore-space-change ignore changes in the amount of white space
62 -B --ignore-blank-lines ignore changes whose lines are all blank
63
64 (some details hidden, use --verbose to show complete help)
65
13 Select no files
66 Select no files
14
67
15 $ touch empty-rw
68 $ touch empty-rw
@@ -32,1403 +85,4 b' Select no files'
32
85
33
86
34
87
35 Select files but no hunks
36
88
37 $ hg record empty-rw<<EOF
38 > y
39 > n
40 > EOF
41 diff --git a/empty-rw b/empty-rw
42 new file mode 100644
43 examine changes to 'empty-rw'? [Ynesfdaq?] y
44
45 abort: empty commit message
46 [255]
47
48 $ hg tip -p
49 changeset: -1:000000000000
50 tag: tip
51 user:
52 date: Thu Jan 01 00:00:00 1970 +0000
53
54
55
56 Record empty file
57
58 $ hg record -d '0 0' -m empty empty-rw<<EOF
59 > y
60 > y
61 > EOF
62 diff --git a/empty-rw b/empty-rw
63 new file mode 100644
64 examine changes to 'empty-rw'? [Ynesfdaq?] y
65
66
67 $ hg tip -p
68 changeset: 0:c0708cf4e46e
69 tag: tip
70 user: test
71 date: Thu Jan 01 00:00:00 1970 +0000
72 summary: empty
73
74
75
76 Summary shows we updated to the new cset
77
78 $ hg summary
79 parent: 0:c0708cf4e46e tip
80 empty
81 branch: default
82 commit: (clean)
83 update: (current)
84
85 Rename empty file
86
87 $ hg mv empty-rw empty-rename
88 $ hg record -d '1 0' -m rename<<EOF
89 > y
90 > EOF
91 diff --git a/empty-rw b/empty-rename
92 rename from empty-rw
93 rename to empty-rename
94 examine changes to 'empty-rw' and 'empty-rename'? [Ynesfdaq?] y
95
96
97 $ hg tip -p
98 changeset: 1:d695e8dcb197
99 tag: tip
100 user: test
101 date: Thu Jan 01 00:00:01 1970 +0000
102 summary: rename
103
104
105
106 Copy empty file
107
108 $ hg cp empty-rename empty-copy
109 $ hg record -d '2 0' -m copy<<EOF
110 > y
111 > EOF
112 diff --git a/empty-rename b/empty-copy
113 copy from empty-rename
114 copy to empty-copy
115 examine changes to 'empty-rename' and 'empty-copy'? [Ynesfdaq?] y
116
117
118 $ hg tip -p
119 changeset: 2:1d4b90bea524
120 tag: tip
121 user: test
122 date: Thu Jan 01 00:00:02 1970 +0000
123 summary: copy
124
125
126
127 Delete empty file
128
129 $ hg rm empty-copy
130 $ hg record -d '3 0' -m delete<<EOF
131 > y
132 > EOF
133 diff --git a/empty-copy b/empty-copy
134 deleted file mode 100644
135 examine changes to 'empty-copy'? [Ynesfdaq?] y
136
137
138 $ hg tip -p
139 changeset: 3:b39a238f01a1
140 tag: tip
141 user: test
142 date: Thu Jan 01 00:00:03 1970 +0000
143 summary: delete
144
145
146
147 Add binary file
148
149 $ hg bundle --base -2 tip.bundle
150 1 changesets found
151 $ hg add tip.bundle
152 $ hg record -d '4 0' -m binary<<EOF
153 > y
154 > EOF
155 diff --git a/tip.bundle b/tip.bundle
156 new file mode 100644
157 this is a binary file
158 examine changes to 'tip.bundle'? [Ynesfdaq?] y
159
160
161 $ hg tip -p
162 changeset: 4:ad816da3711e
163 tag: tip
164 user: test
165 date: Thu Jan 01 00:00:04 1970 +0000
166 summary: binary
167
168 diff -r b39a238f01a1 -r ad816da3711e tip.bundle
169 Binary file tip.bundle has changed
170
171
172 Change binary file
173
174 $ hg bundle --base -2 tip.bundle
175 1 changesets found
176 $ hg record -d '5 0' -m binary-change<<EOF
177 > y
178 > EOF
179 diff --git a/tip.bundle b/tip.bundle
180 this modifies a binary file (all or nothing)
181 examine changes to 'tip.bundle'? [Ynesfdaq?] y
182
183
184 $ hg tip -p
185 changeset: 5:dccd6f3eb485
186 tag: tip
187 user: test
188 date: Thu Jan 01 00:00:05 1970 +0000
189 summary: binary-change
190
191 diff -r ad816da3711e -r dccd6f3eb485 tip.bundle
192 Binary file tip.bundle has changed
193
194
195 Rename and change binary file
196
197 $ hg mv tip.bundle top.bundle
198 $ hg bundle --base -2 top.bundle
199 1 changesets found
200 $ hg record -d '6 0' -m binary-change-rename<<EOF
201 > y
202 > EOF
203 diff --git a/tip.bundle b/top.bundle
204 rename from tip.bundle
205 rename to top.bundle
206 this modifies a binary file (all or nothing)
207 examine changes to 'tip.bundle' and 'top.bundle'? [Ynesfdaq?] y
208
209
210 $ hg tip -p
211 changeset: 6:7fa44105f5b3
212 tag: tip
213 user: test
214 date: Thu Jan 01 00:00:06 1970 +0000
215 summary: binary-change-rename
216
217 diff -r dccd6f3eb485 -r 7fa44105f5b3 tip.bundle
218 Binary file tip.bundle has changed
219 diff -r dccd6f3eb485 -r 7fa44105f5b3 top.bundle
220 Binary file top.bundle has changed
221
222
223 Add plain file
224
225 $ for i in 1 2 3 4 5 6 7 8 9 10; do
226 > echo $i >> plain
227 > done
228
229 $ hg add plain
230 $ hg record -d '7 0' -m plain plain<<EOF
231 > y
232 > y
233 > EOF
234 diff --git a/plain b/plain
235 new file mode 100644
236 examine changes to 'plain'? [Ynesfdaq?] y
237
238 @@ -0,0 +1,10 @@
239 +1
240 +2
241 +3
242 +4
243 +5
244 +6
245 +7
246 +8
247 +9
248 +10
249 record this change to 'plain'? [Ynesfdaq?] y
250
251 $ hg tip -p
252 changeset: 7:11fb457c1be4
253 tag: tip
254 user: test
255 date: Thu Jan 01 00:00:07 1970 +0000
256 summary: plain
257
258 diff -r 7fa44105f5b3 -r 11fb457c1be4 plain
259 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
260 +++ b/plain Thu Jan 01 00:00:07 1970 +0000
261 @@ -0,0 +1,10 @@
262 +1
263 +2
264 +3
265 +4
266 +5
267 +6
268 +7
269 +8
270 +9
271 +10
272
273 Modify end of plain file with username unset
274
275 $ echo 11 >> plain
276 $ unset HGUSER
277 $ hg record --config ui.username= -d '8 0' -m end plain
278 abort: no username supplied
279 (use "hg config --edit" to set your username)
280 [255]
281
282
283 Modify end of plain file, also test that diffopts are accounted for
284
285 $ HGUSER="test"
286 $ export HGUSER
287 $ hg record --config diff.showfunc=true -d '8 0' -m end plain <<EOF
288 > y
289 > y
290 > EOF
291 diff --git a/plain b/plain
292 1 hunks, 1 lines changed
293 examine changes to 'plain'? [Ynesfdaq?] y
294
295 @@ -8,3 +8,4 @@ 7
296 8
297 9
298 10
299 +11
300 record this change to 'plain'? [Ynesfdaq?] y
301
302
303 Modify end of plain file, no EOL
304
305 $ hg tip --template '{node}' >> plain
306 $ hg record -d '9 0' -m noeol plain <<EOF
307 > y
308 > y
309 > EOF
310 diff --git a/plain b/plain
311 1 hunks, 1 lines changed
312 examine changes to 'plain'? [Ynesfdaq?] y
313
314 @@ -9,3 +9,4 @@
315 9
316 10
317 11
318 +7264f99c5f5ff3261504828afa4fb4d406c3af54
319 \ No newline at end of file
320 record this change to 'plain'? [Ynesfdaq?] y
321
322
323 Modify end of plain file, add EOL
324
325 $ echo >> plain
326 $ echo 1 > plain2
327 $ hg add plain2
328 $ hg record -d '10 0' -m eol plain plain2 <<EOF
329 > y
330 > y
331 > y
332 > y
333 > EOF
334 diff --git a/plain b/plain
335 1 hunks, 1 lines changed
336 examine changes to 'plain'? [Ynesfdaq?] y
337
338 @@ -9,4 +9,4 @@
339 9
340 10
341 11
342 -7264f99c5f5ff3261504828afa4fb4d406c3af54
343 \ No newline at end of file
344 +7264f99c5f5ff3261504828afa4fb4d406c3af54
345 record change 1/2 to 'plain'? [Ynesfdaq?] y
346
347 diff --git a/plain2 b/plain2
348 new file mode 100644
349 examine changes to 'plain2'? [Ynesfdaq?] y
350
351 @@ -0,0 +1,1 @@
352 +1
353 record change 2/2 to 'plain2'? [Ynesfdaq?] y
354
355 Modify beginning, trim end, record both, add another file to test
356 changes numbering
357
358 $ rm plain
359 $ for i in 2 2 3 4 5 6 7 8 9 10; do
360 > echo $i >> plain
361 > done
362 $ echo 2 >> plain2
363
364 $ hg record -d '10 0' -m begin-and-end plain plain2 <<EOF
365 > y
366 > y
367 > y
368 > y
369 > y
370 > EOF
371 diff --git a/plain b/plain
372 2 hunks, 3 lines changed
373 examine changes to 'plain'? [Ynesfdaq?] y
374
375 @@ -1,4 +1,4 @@
376 -1
377 +2
378 2
379 3
380 4
381 record change 1/3 to 'plain'? [Ynesfdaq?] y
382
383 @@ -8,5 +8,3 @@
384 8
385 9
386 10
387 -11
388 -7264f99c5f5ff3261504828afa4fb4d406c3af54
389 record change 2/3 to 'plain'? [Ynesfdaq?] y
390
391 diff --git a/plain2 b/plain2
392 1 hunks, 1 lines changed
393 examine changes to 'plain2'? [Ynesfdaq?] y
394
395 @@ -1,1 +1,2 @@
396 1
397 +2
398 record change 3/3 to 'plain2'? [Ynesfdaq?] y
399
400
401 $ hg tip -p
402 changeset: 11:21df83db12b8
403 tag: tip
404 user: test
405 date: Thu Jan 01 00:00:10 1970 +0000
406 summary: begin-and-end
407
408 diff -r ddb8b281c3ff -r 21df83db12b8 plain
409 --- a/plain Thu Jan 01 00:00:10 1970 +0000
410 +++ b/plain Thu Jan 01 00:00:10 1970 +0000
411 @@ -1,4 +1,4 @@
412 -1
413 +2
414 2
415 3
416 4
417 @@ -8,5 +8,3 @@
418 8
419 9
420 10
421 -11
422 -7264f99c5f5ff3261504828afa4fb4d406c3af54
423 diff -r ddb8b281c3ff -r 21df83db12b8 plain2
424 --- a/plain2 Thu Jan 01 00:00:10 1970 +0000
425 +++ b/plain2 Thu Jan 01 00:00:10 1970 +0000
426 @@ -1,1 +1,2 @@
427 1
428 +2
429
430
431 Trim beginning, modify end
432
433 $ rm plain
434 > for i in 4 5 6 7 8 9 10.new; do
435 > echo $i >> plain
436 > done
437
438 Record end
439
440 $ hg record -d '11 0' -m end-only plain <<EOF
441 > y
442 > n
443 > y
444 > EOF
445 diff --git a/plain b/plain
446 2 hunks, 4 lines changed
447 examine changes to 'plain'? [Ynesfdaq?] y
448
449 @@ -1,9 +1,6 @@
450 -2
451 -2
452 -3
453 4
454 5
455 6
456 7
457 8
458 9
459 record change 1/2 to 'plain'? [Ynesfdaq?] n
460
461 @@ -4,7 +1,7 @@
462 4
463 5
464 6
465 7
466 8
467 9
468 -10
469 +10.new
470 record change 2/2 to 'plain'? [Ynesfdaq?] y
471
472
473 $ hg tip -p
474 changeset: 12:99337501826f
475 tag: tip
476 user: test
477 date: Thu Jan 01 00:00:11 1970 +0000
478 summary: end-only
479
480 diff -r 21df83db12b8 -r 99337501826f plain
481 --- a/plain Thu Jan 01 00:00:10 1970 +0000
482 +++ b/plain Thu Jan 01 00:00:11 1970 +0000
483 @@ -7,4 +7,4 @@
484 7
485 8
486 9
487 -10
488 +10.new
489
490
491 Record beginning
492
493 $ hg record -d '12 0' -m begin-only plain <<EOF
494 > y
495 > y
496 > EOF
497 diff --git a/plain b/plain
498 1 hunks, 3 lines changed
499 examine changes to 'plain'? [Ynesfdaq?] y
500
501 @@ -1,6 +1,3 @@
502 -2
503 -2
504 -3
505 4
506 5
507 6
508 record this change to 'plain'? [Ynesfdaq?] y
509
510
511 $ hg tip -p
512 changeset: 13:bbd45465d540
513 tag: tip
514 user: test
515 date: Thu Jan 01 00:00:12 1970 +0000
516 summary: begin-only
517
518 diff -r 99337501826f -r bbd45465d540 plain
519 --- a/plain Thu Jan 01 00:00:11 1970 +0000
520 +++ b/plain Thu Jan 01 00:00:12 1970 +0000
521 @@ -1,6 +1,3 @@
522 -2
523 -2
524 -3
525 4
526 5
527 6
528
529
530 Add to beginning, trim from end
531
532 $ rm plain
533 $ for i in 1 2 3 4 5 6 7 8 9; do
534 > echo $i >> plain
535 > done
536
537 Record end
538
539 $ hg record --traceback -d '13 0' -m end-again plain<<EOF
540 > y
541 > n
542 > y
543 > EOF
544 diff --git a/plain b/plain
545 2 hunks, 4 lines changed
546 examine changes to 'plain'? [Ynesfdaq?] y
547
548 @@ -1,6 +1,9 @@
549 +1
550 +2
551 +3
552 4
553 5
554 6
555 7
556 8
557 9
558 record change 1/2 to 'plain'? [Ynesfdaq?] n
559
560 @@ -1,7 +4,6 @@
561 4
562 5
563 6
564 7
565 8
566 9
567 -10.new
568 record change 2/2 to 'plain'? [Ynesfdaq?] y
569
570
571 Add to beginning, middle, end
572
573 $ rm plain
574 $ for i in 1 2 3 4 5 5.new 5.reallynew 6 7 8 9 10 11; do
575 > echo $i >> plain
576 > done
577
578 Record beginning, middle, and test that format-breaking diffopts are ignored
579
580 $ hg record --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
581 > y
582 > y
583 > y
584 > n
585 > EOF
586 diff --git a/plain b/plain
587 3 hunks, 7 lines changed
588 examine changes to 'plain'? [Ynesfdaq?] y
589
590 @@ -1,2 +1,5 @@
591 +1
592 +2
593 +3
594 4
595 5
596 record change 1/3 to 'plain'? [Ynesfdaq?] y
597
598 @@ -1,6 +4,8 @@
599 4
600 5
601 +5.new
602 +5.reallynew
603 6
604 7
605 8
606 9
607 record change 2/3 to 'plain'? [Ynesfdaq?] y
608
609 @@ -3,4 +8,6 @@
610 6
611 7
612 8
613 9
614 +10
615 +11
616 record change 3/3 to 'plain'? [Ynesfdaq?] n
617
618
619 $ hg tip -p
620 changeset: 15:f34a7937ec33
621 tag: tip
622 user: test
623 date: Thu Jan 01 00:00:14 1970 +0000
624 summary: middle-only
625
626 diff -r 82c065d0b850 -r f34a7937ec33 plain
627 --- a/plain Thu Jan 01 00:00:13 1970 +0000
628 +++ b/plain Thu Jan 01 00:00:14 1970 +0000
629 @@ -1,5 +1,10 @@
630 +1
631 +2
632 +3
633 4
634 5
635 +5.new
636 +5.reallynew
637 6
638 7
639 8
640
641
642 Record end
643
644 $ hg record -d '15 0' -m end-only plain <<EOF
645 > y
646 > y
647 > EOF
648 diff --git a/plain b/plain
649 1 hunks, 2 lines changed
650 examine changes to 'plain'? [Ynesfdaq?] y
651
652 @@ -9,3 +9,5 @@
653 7
654 8
655 9
656 +10
657 +11
658 record this change to 'plain'? [Ynesfdaq?] y
659
660
661 $ hg tip -p
662 changeset: 16:f9900b71a04c
663 tag: tip
664 user: test
665 date: Thu Jan 01 00:00:15 1970 +0000
666 summary: end-only
667
668 diff -r f34a7937ec33 -r f9900b71a04c plain
669 --- a/plain Thu Jan 01 00:00:14 1970 +0000
670 +++ b/plain Thu Jan 01 00:00:15 1970 +0000
671 @@ -9,3 +9,5 @@
672 7
673 8
674 9
675 +10
676 +11
677
678
679 $ mkdir subdir
680 $ cd subdir
681 $ echo a > a
682 $ hg ci -d '16 0' -Amsubdir
683 adding subdir/a
684
685 $ echo a >> a
686 $ hg record -d '16 0' -m subdir-change a <<EOF
687 > y
688 > y
689 > EOF
690 diff --git a/subdir/a b/subdir/a
691 1 hunks, 1 lines changed
692 examine changes to 'subdir/a'? [Ynesfdaq?] y
693
694 @@ -1,1 +1,2 @@
695 a
696 +a
697 record this change to 'subdir/a'? [Ynesfdaq?] y
698
699
700 $ hg tip -p
701 changeset: 18:61be427a9deb
702 tag: tip
703 user: test
704 date: Thu Jan 01 00:00:16 1970 +0000
705 summary: subdir-change
706
707 diff -r a7ffae4d61cb -r 61be427a9deb subdir/a
708 --- a/subdir/a Thu Jan 01 00:00:16 1970 +0000
709 +++ b/subdir/a Thu Jan 01 00:00:16 1970 +0000
710 @@ -1,1 +1,2 @@
711 a
712 +a
713
714
715 $ echo a > f1
716 $ echo b > f2
717 $ hg add f1 f2
718
719 $ hg ci -mz -d '17 0'
720
721 $ echo a >> f1
722 $ echo b >> f2
723
724 Help, quit
725
726 $ hg record <<EOF
727 > ?
728 > q
729 > EOF
730 diff --git a/subdir/f1 b/subdir/f1
731 1 hunks, 1 lines changed
732 examine changes to 'subdir/f1'? [Ynesfdaq?] ?
733
734 y - yes, record this change
735 n - no, skip this change
736 e - edit this change manually
737 s - skip remaining changes to this file
738 f - record remaining changes to this file
739 d - done, skip remaining changes and files
740 a - record all changes to all remaining files
741 q - quit, recording no changes
742 ? - ? (display help)
743 examine changes to 'subdir/f1'? [Ynesfdaq?] q
744
745 abort: user quit
746 [255]
747
748 Skip
749
750 $ hg record <<EOF
751 > s
752 > EOF
753 diff --git a/subdir/f1 b/subdir/f1
754 1 hunks, 1 lines changed
755 examine changes to 'subdir/f1'? [Ynesfdaq?] s
756
757 diff --git a/subdir/f2 b/subdir/f2
758 1 hunks, 1 lines changed
759 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
760 [255]
761
762 No
763
764 $ hg record <<EOF
765 > n
766 > EOF
767 diff --git a/subdir/f1 b/subdir/f1
768 1 hunks, 1 lines changed
769 examine changes to 'subdir/f1'? [Ynesfdaq?] n
770
771 diff --git a/subdir/f2 b/subdir/f2
772 1 hunks, 1 lines changed
773 examine changes to 'subdir/f2'? [Ynesfdaq?] abort: response expected
774 [255]
775
776 f, quit
777
778 $ hg record <<EOF
779 > f
780 > q
781 > EOF
782 diff --git a/subdir/f1 b/subdir/f1
783 1 hunks, 1 lines changed
784 examine changes to 'subdir/f1'? [Ynesfdaq?] f
785
786 diff --git a/subdir/f2 b/subdir/f2
787 1 hunks, 1 lines changed
788 examine changes to 'subdir/f2'? [Ynesfdaq?] q
789
790 abort: user quit
791 [255]
792
793 s, all
794
795 $ hg record -d '18 0' -mx <<EOF
796 > s
797 > a
798 > EOF
799 diff --git a/subdir/f1 b/subdir/f1
800 1 hunks, 1 lines changed
801 examine changes to 'subdir/f1'? [Ynesfdaq?] s
802
803 diff --git a/subdir/f2 b/subdir/f2
804 1 hunks, 1 lines changed
805 examine changes to 'subdir/f2'? [Ynesfdaq?] a
806
807
808 $ hg tip -p
809 changeset: 20:b3df3dda369a
810 tag: tip
811 user: test
812 date: Thu Jan 01 00:00:18 1970 +0000
813 summary: x
814
815 diff -r 6e02d6c9906d -r b3df3dda369a subdir/f2
816 --- a/subdir/f2 Thu Jan 01 00:00:17 1970 +0000
817 +++ b/subdir/f2 Thu Jan 01 00:00:18 1970 +0000
818 @@ -1,1 +1,2 @@
819 b
820 +b
821
822
823 f
824
825 $ hg record -d '19 0' -my <<EOF
826 > f
827 > EOF
828 diff --git a/subdir/f1 b/subdir/f1
829 1 hunks, 1 lines changed
830 examine changes to 'subdir/f1'? [Ynesfdaq?] f
831
832
833 $ hg tip -p
834 changeset: 21:38ec577f126b
835 tag: tip
836 user: test
837 date: Thu Jan 01 00:00:19 1970 +0000
838 summary: y
839
840 diff -r b3df3dda369a -r 38ec577f126b subdir/f1
841 --- a/subdir/f1 Thu Jan 01 00:00:18 1970 +0000
842 +++ b/subdir/f1 Thu Jan 01 00:00:19 1970 +0000
843 @@ -1,1 +1,2 @@
844 a
845 +a
846
847
848 #if execbit
849
850 Preserve chmod +x
851
852 $ chmod +x f1
853 $ echo a >> f1
854 $ hg record -d '20 0' -mz <<EOF
855 > y
856 > y
857 > y
858 > EOF
859 diff --git a/subdir/f1 b/subdir/f1
860 old mode 100644
861 new mode 100755
862 1 hunks, 1 lines changed
863 examine changes to 'subdir/f1'? [Ynesfdaq?] y
864
865 @@ -1,2 +1,3 @@
866 a
867 a
868 +a
869 record this change to 'subdir/f1'? [Ynesfdaq?] y
870
871
872 $ hg tip --config diff.git=True -p
873 changeset: 22:3261adceb075
874 tag: tip
875 user: test
876 date: Thu Jan 01 00:00:20 1970 +0000
877 summary: z
878
879 diff --git a/subdir/f1 b/subdir/f1
880 old mode 100644
881 new mode 100755
882 --- a/subdir/f1
883 +++ b/subdir/f1
884 @@ -1,2 +1,3 @@
885 a
886 a
887 +a
888
889
890 Preserve execute permission on original
891
892 $ echo b >> f1
893 $ hg record -d '21 0' -maa <<EOF
894 > y
895 > y
896 > y
897 > EOF
898 diff --git a/subdir/f1 b/subdir/f1
899 1 hunks, 1 lines changed
900 examine changes to 'subdir/f1'? [Ynesfdaq?] y
901
902 @@ -1,3 +1,4 @@
903 a
904 a
905 a
906 +b
907 record this change to 'subdir/f1'? [Ynesfdaq?] y
908
909
910 $ hg tip --config diff.git=True -p
911 changeset: 23:b429867550db
912 tag: tip
913 user: test
914 date: Thu Jan 01 00:00:21 1970 +0000
915 summary: aa
916
917 diff --git a/subdir/f1 b/subdir/f1
918 --- a/subdir/f1
919 +++ b/subdir/f1
920 @@ -1,3 +1,4 @@
921 a
922 a
923 a
924 +b
925
926
927 Preserve chmod -x
928
929 $ chmod -x f1
930 $ echo c >> f1
931 $ hg record -d '22 0' -mab <<EOF
932 > y
933 > y
934 > y
935 > EOF
936 diff --git a/subdir/f1 b/subdir/f1
937 old mode 100755
938 new mode 100644
939 1 hunks, 1 lines changed
940 examine changes to 'subdir/f1'? [Ynesfdaq?] y
941
942 @@ -2,3 +2,4 @@
943 a
944 a
945 b
946 +c
947 record this change to 'subdir/f1'? [Ynesfdaq?] y
948
949
950 $ hg tip --config diff.git=True -p
951 changeset: 24:0b082130c20a
952 tag: tip
953 user: test
954 date: Thu Jan 01 00:00:22 1970 +0000
955 summary: ab
956
957 diff --git a/subdir/f1 b/subdir/f1
958 old mode 100755
959 new mode 100644
960 --- a/subdir/f1
961 +++ b/subdir/f1
962 @@ -2,3 +2,4 @@
963 a
964 a
965 b
966 +c
967
968
969 #else
970
971 Slightly bogus tests to get almost same repo structure as when x bit is used
972 - but with different hashes.
973
974 Mock "Preserve chmod +x"
975
976 $ echo a >> f1
977 $ hg record -d '20 0' -mz <<EOF
978 > y
979 > y
980 > y
981 > EOF
982 diff --git a/subdir/f1 b/subdir/f1
983 1 hunks, 1 lines changed
984 examine changes to 'subdir/f1'? [Ynesfdaq?] y
985
986 @@ -1,2 +1,3 @@
987 a
988 a
989 +a
990 record this change to 'subdir/f1'? [Ynesfdaq?] y
991
992
993 $ hg tip --config diff.git=True -p
994 changeset: 22:0d463bd428f5
995 tag: tip
996 user: test
997 date: Thu Jan 01 00:00:20 1970 +0000
998 summary: z
999
1000 diff --git a/subdir/f1 b/subdir/f1
1001 --- a/subdir/f1
1002 +++ b/subdir/f1
1003 @@ -1,2 +1,3 @@
1004 a
1005 a
1006 +a
1007
1008
1009 Mock "Preserve execute permission on original"
1010
1011 $ echo b >> f1
1012 $ hg record -d '21 0' -maa <<EOF
1013 > y
1014 > y
1015 > y
1016 > EOF
1017 diff --git a/subdir/f1 b/subdir/f1
1018 1 hunks, 1 lines changed
1019 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1020
1021 @@ -1,3 +1,4 @@
1022 a
1023 a
1024 a
1025 +b
1026 record this change to 'subdir/f1'? [Ynesfdaq?] y
1027
1028
1029 $ hg tip --config diff.git=True -p
1030 changeset: 23:0eab41a3e524
1031 tag: tip
1032 user: test
1033 date: Thu Jan 01 00:00:21 1970 +0000
1034 summary: aa
1035
1036 diff --git a/subdir/f1 b/subdir/f1
1037 --- a/subdir/f1
1038 +++ b/subdir/f1
1039 @@ -1,3 +1,4 @@
1040 a
1041 a
1042 a
1043 +b
1044
1045
1046 Mock "Preserve chmod -x"
1047
1048 $ chmod -x f1
1049 $ echo c >> f1
1050 $ hg record -d '22 0' -mab <<EOF
1051 > y
1052 > y
1053 > y
1054 > EOF
1055 diff --git a/subdir/f1 b/subdir/f1
1056 1 hunks, 1 lines changed
1057 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1058
1059 @@ -2,3 +2,4 @@
1060 a
1061 a
1062 b
1063 +c
1064 record this change to 'subdir/f1'? [Ynesfdaq?] y
1065
1066
1067 $ hg tip --config diff.git=True -p
1068 changeset: 24:f4f718f27b7c
1069 tag: tip
1070 user: test
1071 date: Thu Jan 01 00:00:22 1970 +0000
1072 summary: ab
1073
1074 diff --git a/subdir/f1 b/subdir/f1
1075 --- a/subdir/f1
1076 +++ b/subdir/f1
1077 @@ -2,3 +2,4 @@
1078 a
1079 a
1080 b
1081 +c
1082
1083
1084 #endif
1085
1086 $ cd ..
1087
1088
1089 Abort early when a merge is in progress
1090
1091 $ hg up 4
1092 1 files updated, 0 files merged, 6 files removed, 0 files unresolved
1093
1094 $ touch iwillmergethat
1095 $ hg add iwillmergethat
1096
1097 $ hg branch thatbranch
1098 marked working directory as branch thatbranch
1099 (branches are permanent and global, did you want a bookmark?)
1100
1101 $ hg ci -m'new head'
1102
1103 $ hg up default
1104 6 files updated, 0 files merged, 2 files removed, 0 files unresolved
1105
1106 $ hg merge thatbranch
1107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1108 (branch merge, don't forget to commit)
1109
1110 $ hg record -m'will abort'
1111 abort: cannot partially commit a merge (use "hg commit" instead)
1112 [255]
1113
1114 $ hg up -C
1115 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1116
1117 Editing patch (and ignoring trailing text)
1118
1119 $ cat > editor.sh << '__EOF__'
1120 > sed -e 7d -e '5s/^-/ /' -e '/^# ---/i\
1121 > trailing\nditto' "$1" > tmp
1122 > mv tmp "$1"
1123 > __EOF__
1124 $ cat > editedfile << '__EOF__'
1125 > This is the first line
1126 > This is the second line
1127 > This is the third line
1128 > __EOF__
1129 $ hg add editedfile
1130 $ hg commit -medit-patch-1
1131 $ cat > editedfile << '__EOF__'
1132 > This line has changed
1133 > This change will be committed
1134 > This is the third line
1135 > __EOF__
1136 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record -d '23 0' -medit-patch-2 <<EOF
1137 > y
1138 > e
1139 > EOF
1140 diff --git a/editedfile b/editedfile
1141 1 hunks, 2 lines changed
1142 examine changes to 'editedfile'? [Ynesfdaq?] y
1143
1144 @@ -1,3 +1,3 @@
1145 -This is the first line
1146 -This is the second line
1147 +This line has changed
1148 +This change will be committed
1149 This is the third line
1150 record this change to 'editedfile'? [Ynesfdaq?] e
1151
1152 $ cat editedfile
1153 This line has changed
1154 This change will be committed
1155 This is the third line
1156 $ hg cat -r tip editedfile
1157 This is the first line
1158 This change will be committed
1159 This is the third line
1160 $ hg revert editedfile
1161
1162 Trying to edit patch for whole file
1163
1164 $ echo "This is the fourth line" >> editedfile
1165 $ hg record <<EOF
1166 > e
1167 > q
1168 > EOF
1169 diff --git a/editedfile b/editedfile
1170 1 hunks, 1 lines changed
1171 examine changes to 'editedfile'? [Ynesfdaq?] e
1172
1173 cannot edit patch for whole file
1174 examine changes to 'editedfile'? [Ynesfdaq?] q
1175
1176 abort: user quit
1177 [255]
1178 $ hg revert editedfile
1179
1180 Removing changes from patch
1181
1182 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1183 $ mv tmp editedfile
1184 $ echo "This line has been added" >> editedfile
1185 $ cat > editor.sh << '__EOF__'
1186 > sed -e 's/^[-+]/ /' "$1" > tmp
1187 > mv tmp "$1"
1188 > __EOF__
1189 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1190 > y
1191 > e
1192 > EOF
1193 diff --git a/editedfile b/editedfile
1194 1 hunks, 3 lines changed
1195 examine changes to 'editedfile'? [Ynesfdaq?] y
1196
1197 @@ -1,3 +1,3 @@
1198 -This is the first line
1199 -This change will be committed
1200 -This is the third line
1201 +This change will not be committed
1202 +This is the second line
1203 +This line has been added
1204 record this change to 'editedfile'? [Ynesfdaq?] e
1205
1206 no changes to record
1207 $ cat editedfile
1208 This change will not be committed
1209 This is the second line
1210 This line has been added
1211 $ hg cat -r tip editedfile
1212 This is the first line
1213 This change will be committed
1214 This is the third line
1215 $ hg revert editedfile
1216
1217 Invalid patch
1218
1219 $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp
1220 $ mv tmp editedfile
1221 $ echo "This line has been added" >> editedfile
1222 $ cat > editor.sh << '__EOF__'
1223 > sed s/This/That/ "$1" > tmp
1224 > mv tmp "$1"
1225 > __EOF__
1226 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1227 > y
1228 > e
1229 > EOF
1230 diff --git a/editedfile b/editedfile
1231 1 hunks, 3 lines changed
1232 examine changes to 'editedfile'? [Ynesfdaq?] y
1233
1234 @@ -1,3 +1,3 @@
1235 -This is the first line
1236 -This change will be committed
1237 -This is the third line
1238 +This change will not be committed
1239 +This is the second line
1240 +This line has been added
1241 record this change to 'editedfile'? [Ynesfdaq?] e
1242
1243 patching file editedfile
1244 Hunk #1 FAILED at 0
1245 1 out of 1 hunks FAILED -- saving rejects to file editedfile.rej
1246 abort: patch failed to apply
1247 [255]
1248 $ cat editedfile
1249 This change will not be committed
1250 This is the second line
1251 This line has been added
1252 $ hg cat -r tip editedfile
1253 This is the first line
1254 This change will be committed
1255 This is the third line
1256 $ cat editedfile.rej
1257 --- editedfile
1258 +++ editedfile
1259 @@ -1,3 +1,3 @@
1260 -That is the first line
1261 -That change will be committed
1262 -That is the third line
1263 +That change will not be committed
1264 +That is the second line
1265 +That line has been added
1266
1267 Malformed patch - error handling
1268
1269 $ cat > editor.sh << '__EOF__'
1270 > sed -e '/^@/p' "$1" > tmp
1271 > mv tmp "$1"
1272 > __EOF__
1273 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1274 > y
1275 > e
1276 > EOF
1277 diff --git a/editedfile b/editedfile
1278 1 hunks, 3 lines changed
1279 examine changes to 'editedfile'? [Ynesfdaq?] y
1280
1281 @@ -1,3 +1,3 @@
1282 -This is the first line
1283 -This change will be committed
1284 -This is the third line
1285 +This change will not be committed
1286 +This is the second line
1287 +This line has been added
1288 record this change to 'editedfile'? [Ynesfdaq?] e
1289
1290 abort: error parsing patch: unhandled transition: range -> range
1291 [255]
1292
1293 random text in random positions is still an error
1294
1295 $ cat > editor.sh << '__EOF__'
1296 > sed -e '/^@/i\
1297 > other' "$1" > tmp
1298 > mv tmp "$1"
1299 > __EOF__
1300 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
1301 > y
1302 > e
1303 > EOF
1304 diff --git a/editedfile b/editedfile
1305 1 hunks, 3 lines changed
1306 examine changes to 'editedfile'? [Ynesfdaq?] y
1307
1308 @@ -1,3 +1,3 @@
1309 -This is the first line
1310 -This change will be committed
1311 -This is the third line
1312 +This change will not be committed
1313 +This is the second line
1314 +This line has been added
1315 record this change to 'editedfile'? [Ynesfdaq?] e
1316
1317 abort: error parsing patch: unhandled transition: file -> other
1318 [255]
1319
1320 $ hg up -C
1321 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1322
1323 With win32text
1324
1325 $ echo '[extensions]' >> .hg/hgrc
1326 $ echo 'win32text = ' >> .hg/hgrc
1327 $ echo '[decode]' >> .hg/hgrc
1328 $ echo '** = cleverdecode:' >> .hg/hgrc
1329 $ echo '[encode]' >> .hg/hgrc
1330 $ echo '** = cleverencode:' >> .hg/hgrc
1331 $ echo '[patch]' >> .hg/hgrc
1332 $ echo 'eol = crlf' >> .hg/hgrc
1333
1334 Ignore win32text deprecation warning for now:
1335
1336 $ echo '[win32text]' >> .hg/hgrc
1337 $ echo 'warn = no' >> .hg/hgrc
1338
1339 $ echo d >> subdir/f1
1340 $ hg record -d '24 0' -mw1 <<EOF
1341 > y
1342 > y
1343 > EOF
1344 diff --git a/subdir/f1 b/subdir/f1
1345 1 hunks, 1 lines changed
1346 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1347
1348 @@ -3,3 +3,4 @@
1349 a
1350 b
1351 c
1352 +d
1353 record this change to 'subdir/f1'? [Ynesfdaq?] y
1354
1355
1356 $ hg tip -p
1357 changeset: 28:* (glob)
1358 tag: tip
1359 user: test
1360 date: Thu Jan 01 00:00:24 1970 +0000
1361 summary: w1
1362
1363 diff -r ???????????? -r ???????????? subdir/f1 (glob)
1364 --- a/subdir/f1 Thu Jan 01 00:00:23 1970 +0000
1365 +++ b/subdir/f1 Thu Jan 01 00:00:24 1970 +0000
1366 @@ -3,3 +3,4 @@
1367 a
1368 b
1369 c
1370 +d
1371
1372
1373
1374 Test --user when ui.username not set
1375 $ unset HGUSER
1376 $ echo e >> subdir/f1
1377 $ hg record --config ui.username= -d '8 0' --user xyz -m "user flag" <<EOF
1378 > y
1379 > y
1380 > EOF
1381 diff --git a/subdir/f1 b/subdir/f1
1382 1 hunks, 1 lines changed
1383 examine changes to 'subdir/f1'? [Ynesfdaq?] y
1384
1385 @@ -4,3 +4,4 @@
1386 b
1387 c
1388 d
1389 +e
1390 record this change to 'subdir/f1'? [Ynesfdaq?] y
1391
1392 $ hg log --template '{author}\n' -l 1
1393 xyz
1394 $ HGUSER="test"
1395 $ export HGUSER
1396
1397
1398 Editing patch of newly added file
1399
1400 $ cat > editor.sh << '__EOF__'
1401 > cat "$1" | sed "s/first/very/g" > tt
1402 > mv tt "$1"
1403 > __EOF__
1404 $ cat > newfile << '__EOF__'
1405 > This is the first line
1406 > This is the second line
1407 > This is the third line
1408 > __EOF__
1409 $ hg add newfile
1410 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record -d '23 0' -medit-patch-new <<EOF
1411 > y
1412 > e
1413 > EOF
1414 diff --git a/newfile b/newfile
1415 new file mode 100644
1416 examine changes to 'newfile'? [Ynesfdaq?] y
1417
1418 @@ -0,0 +1,3 @@
1419 +This is the first line
1420 +This is the second line
1421 +This is the third line
1422 record this change to 'newfile'? [Ynesfdaq?] e
1423
1424 $ hg cat -r tip newfile
1425 This is the very line
1426 This is the second line
1427 This is the third line
1428
1429 $ cat newfile
1430 This is the first line
1431 This is the second line
1432 This is the third line
1433
1434 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now