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