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