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