##// END OF EJS Templates
tests: use "hg help revisions.<predicate>" instead of grepping...
Martin von Zweigbergk -
r30786:e2a6f383 default
parent child Browse files
Show More
@@ -1,1612 +1,1613 b''
1 1 $ checkundo()
2 2 > {
3 3 > if [ -f .hg/store/undo ]; then
4 4 > echo ".hg/store/undo still exists after $1"
5 5 > fi
6 6 > }
7 7
8 8 $ cat <<EOF >> $HGRCPATH
9 9 > [extensions]
10 10 > mq =
11 11 > [mq]
12 12 > plain = true
13 13 > EOF
14 14
15 15
16 16 help
17 17
18 18 $ hg help mq
19 19 mq extension - manage a stack of patches
20 20
21 21 This extension lets you work with a stack of patches in a Mercurial
22 22 repository. It manages two stacks of patches - all known patches, and applied
23 23 patches (subset of known patches).
24 24
25 25 Known patches are represented as patch files in the .hg/patches directory.
26 26 Applied patches are both patch files and changesets.
27 27
28 28 Common tasks (use 'hg help command' for more details):
29 29
30 30 create new patch qnew
31 31 import existing patch qimport
32 32
33 33 print patch series qseries
34 34 print applied patches qapplied
35 35
36 36 add known patch to applied stack qpush
37 37 remove patch from applied stack qpop
38 38 refresh contents of top applied patch qrefresh
39 39
40 40 By default, mq will automatically use git patches when required to avoid
41 41 losing file mode changes, copy records, binary files or empty files creations
42 42 or deletions. This behavior can be configured with:
43 43
44 44 [mq]
45 45 git = auto/keep/yes/no
46 46
47 47 If set to 'keep', mq will obey the [diff] section configuration while
48 48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
49 49 will override the [diff] section and always generate git or regular patches,
50 50 possibly losing data in the second case.
51 51
52 52 It may be desirable for mq changesets to be kept in the secret phase (see 'hg
53 53 help phases'), which can be enabled with the following setting:
54 54
55 55 [mq]
56 56 secret = True
57 57
58 58 You will by default be managing a patch queue named "patches". You can create
59 59 other, independent patch queues with the 'hg qqueue' command.
60 60
61 61 If the working directory contains uncommitted files, qpush, qpop and qgoto
62 62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
63 63
64 64 [mq]
65 65 keepchanges = True
66 66
67 67 make them behave as if --keep-changes were passed, and non-conflicting local
68 68 changes will be tolerated and preserved. If incompatible options such as
69 69 -f/--force or --exact are passed, this setting is ignored.
70 70
71 71 This extension used to provide a strip command. This command now lives in the
72 72 strip extension.
73 73
74 74 list of commands:
75 75
76 76 qapplied print the patches already applied
77 77 qclone clone main and patch repository at same time
78 78 qdelete remove patches from queue
79 79 qdiff diff of the current patch and subsequent modifications
80 80 qfinish move applied patches into repository history
81 81 qfold fold the named patches into the current patch
82 82 qgoto push or pop patches until named patch is at top of stack
83 83 qguard set or print guards for a patch
84 84 qheader print the header of the topmost or specified patch
85 85 qimport import a patch or existing changeset
86 86 qnew create a new patch
87 87 qnext print the name of the next pushable patch
88 88 qpop pop the current patch off the stack
89 89 qprev print the name of the preceding applied patch
90 90 qpush push the next patch onto the stack
91 91 qqueue manage multiple patch queues
92 92 qrefresh update the current patch
93 93 qrename rename a patch
94 94 qselect set or print guarded patches to push
95 95 qseries print the entire series file
96 96 qtop print the name of the current patch
97 97 qunapplied print the patches not yet applied
98 98
99 99 (use 'hg help -v mq' to show built-in aliases and global options)
100 100
101 101 $ hg init a
102 102 $ cd a
103 103 $ echo a > a
104 104 $ hg ci -Ama
105 105 adding a
106 106
107 107 $ hg clone . ../k
108 108 updating to branch default
109 109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 110
111 111 $ mkdir b
112 112 $ echo z > b/z
113 113 $ hg ci -Ama
114 114 adding b/z
115 115
116 116
117 117 qinit
118 118
119 119 $ hg qinit
120 120
121 121 $ cd ..
122 122 $ hg init b
123 123
124 124
125 125 -R qinit
126 126
127 127 $ hg -R b qinit
128 128
129 129 $ hg init c
130 130
131 131
132 132 qinit -c
133 133
134 134 $ hg --cwd c qinit -c
135 135 $ hg -R c/.hg/patches st
136 136 A .hgignore
137 137 A series
138 138
139 139
140 140 qinit; qinit -c
141 141
142 142 $ hg init d
143 143 $ cd d
144 144 $ hg qinit
145 145 $ hg qinit -c
146 146
147 147 qinit -c should create both files if they don't exist
148 148
149 149 $ cat .hg/patches/.hgignore
150 150 ^\.hg
151 151 ^\.mq
152 152 syntax: glob
153 153 status
154 154 guards
155 155 $ cat .hg/patches/series
156 156 $ hg qinit -c
157 157 abort: repository $TESTTMP/d/.hg/patches already exists! (glob)
158 158 [255]
159 159 $ cd ..
160 160
161 161 $ echo '% qinit; <stuff>; qinit -c'
162 162 % qinit; <stuff>; qinit -c
163 163 $ hg init e
164 164 $ cd e
165 165 $ hg qnew A
166 166 $ checkundo qnew
167 167 $ echo foo > foo
168 168 $ hg phase -r qbase
169 169 0: draft
170 170 $ hg add foo
171 171 $ hg qrefresh
172 172 $ hg phase -r qbase
173 173 0: draft
174 174 $ hg qnew B
175 175 $ echo >> foo
176 176 $ hg qrefresh
177 177 $ echo status >> .hg/patches/.hgignore
178 178 $ echo bleh >> .hg/patches/.hgignore
179 179 $ hg qinit -c
180 180 adding .hg/patches/A (glob)
181 181 adding .hg/patches/B (glob)
182 182 $ hg -R .hg/patches status
183 183 A .hgignore
184 184 A A
185 185 A B
186 186 A series
187 187
188 188 qinit -c shouldn't touch these files if they already exist
189 189
190 190 $ cat .hg/patches/.hgignore
191 191 status
192 192 bleh
193 193 $ cat .hg/patches/series
194 194 A
195 195 B
196 196
197 197 add an untracked file
198 198
199 199 $ echo >> .hg/patches/flaf
200 200
201 201 status --mq with color (issue2096)
202 202
203 203 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
204 204 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
205 205 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
206 206 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
207 207 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
208 208 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
209 209
210 210 try the --mq option on a command provided by an extension
211 211
212 212 $ hg purge --mq --verbose --config extensions.purge=
213 213 removing file flaf
214 214
215 215 $ cd ..
216 216
217 217 #if no-outer-repo
218 218
219 219 init --mq without repo
220 220
221 221 $ mkdir f
222 222 $ cd f
223 223 $ hg init --mq
224 224 abort: there is no Mercurial repository here (.hg not found)
225 225 [255]
226 226 $ cd ..
227 227
228 228 #endif
229 229
230 230 init --mq with repo path
231 231
232 232 $ hg init g
233 233 $ hg init --mq g
234 234 $ test -d g/.hg/patches/.hg
235 235
236 236 init --mq with nonexistent directory
237 237
238 238 $ hg init --mq nonexistentdir
239 239 abort: repository nonexistentdir not found!
240 240 [255]
241 241
242 242
243 243 init --mq with bundle (non "local")
244 244
245 245 $ hg -R a bundle --all a.bundle >/dev/null
246 246 $ hg init --mq a.bundle
247 247 abort: only a local queue repository may be initialized
248 248 [255]
249 249
250 250 $ cd a
251 251
252 252 $ hg qnew -m 'foo bar' test.patch
253 253
254 254 $ echo '# comment' > .hg/patches/series.tmp
255 255 $ echo >> .hg/patches/series.tmp # empty line
256 256 $ cat .hg/patches/series >> .hg/patches/series.tmp
257 257 $ mv .hg/patches/series.tmp .hg/patches/series
258 258
259 259
260 260 qrefresh
261 261
262 262 $ echo a >> a
263 263 $ hg qrefresh
264 264 $ cat .hg/patches/test.patch
265 265 foo bar
266 266
267 267 diff -r [a-f0-9]* a (re)
268 268 --- a/a\t(?P<date>.*) (re)
269 269 \+\+\+ b/a\t(?P<date2>.*) (re)
270 270 @@ -1,1 +1,2 @@
271 271 a
272 272 +a
273 273
274 274 empty qrefresh
275 275
276 276 $ hg qrefresh -X a
277 277
278 278 revision:
279 279
280 280 $ hg diff -r -2 -r -1
281 281
282 282 patch:
283 283
284 284 $ cat .hg/patches/test.patch
285 285 foo bar
286 286
287 287
288 288 working dir diff:
289 289
290 290 $ hg diff --nodates -q
291 291 --- a/a
292 292 +++ b/a
293 293 @@ -1,1 +1,2 @@
294 294 a
295 295 +a
296 296
297 297 restore things
298 298
299 299 $ hg qrefresh
300 300 $ checkundo qrefresh
301 301
302 302
303 303 qpop
304 304
305 305 $ hg qpop
306 306 popping test.patch
307 307 patch queue now empty
308 308 $ checkundo qpop
309 309
310 310
311 311 qpush with dump of tag cache
312 312 Dump the tag cache to ensure that it has exactly one head after qpush.
313 313
314 314 $ rm -f .hg/cache/tags2-visible
315 315 $ hg tags > /dev/null
316 316
317 317 .hg/cache/tags2-visible (pre qpush):
318 318
319 319 $ cat .hg/cache/tags2-visible
320 320 1 [\da-f]{40} (re)
321 321 $ hg qpush
322 322 applying test.patch
323 323 now at: test.patch
324 324 $ hg phase -r qbase
325 325 2: draft
326 326 $ hg tags > /dev/null
327 327
328 328 .hg/cache/tags2-visible (post qpush):
329 329
330 330 $ cat .hg/cache/tags2-visible
331 331 2 [\da-f]{40} (re)
332 332 $ checkundo qpush
333 333 $ cd ..
334 334
335 335
336 336 pop/push outside repo
337 337 $ hg -R a qpop
338 338 popping test.patch
339 339 patch queue now empty
340 340 $ hg -R a qpush
341 341 applying test.patch
342 342 now at: test.patch
343 343
344 344 $ cd a
345 345 $ hg qnew test2.patch
346 346
347 347 qrefresh in subdir
348 348
349 349 $ cd b
350 350 $ echo a > a
351 351 $ hg add a
352 352 $ hg qrefresh
353 353
354 354 pop/push -a in subdir
355 355
356 356 $ hg qpop -a
357 357 popping test2.patch
358 358 popping test.patch
359 359 patch queue now empty
360 360 $ hg --traceback qpush -a
361 361 applying test.patch
362 362 applying test2.patch
363 363 now at: test2.patch
364 364
365 365
366 366 setting columns & formatted tests truncating (issue1912)
367 367
368 368 $ COLUMNS=4 hg qseries --config ui.formatted=true
369 369 test.patch
370 370 test2.patch
371 371 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs
372 372 0 A test.patch: f...
373 373 1 A test2.patch:
374 374 $ hg qpop
375 375 popping test2.patch
376 376 now at: test.patch
377 377 $ hg qseries -vs
378 378 0 A test.patch: foo bar
379 379 1 U test2.patch:
380 380 $ hg sum | grep mq
381 381 mq: 1 applied, 1 unapplied
382 382 $ hg qpush
383 383 applying test2.patch
384 384 now at: test2.patch
385 385 $ hg sum | grep mq
386 386 mq: 2 applied
387 387 $ hg qapplied
388 388 test.patch
389 389 test2.patch
390 390 $ hg qtop
391 391 test2.patch
392 392
393 393
394 394 prev
395 395
396 396 $ hg qapp -1
397 397 test.patch
398 398
399 399 next
400 400
401 401 $ hg qunapp -1
402 402 all patches applied
403 403 [1]
404 404
405 405 $ hg qpop
406 406 popping test2.patch
407 407 now at: test.patch
408 408
409 409 commit should fail
410 410
411 411 $ hg commit
412 412 abort: cannot commit over an applied mq patch
413 413 [255]
414 414
415 415 push should fail if draft
416 416
417 417 $ hg push ../../k
418 418 pushing to ../../k
419 419 abort: source has mq patches applied
420 420 [255]
421 421
422 422
423 423 import should fail
424 424
425 425 $ hg st .
426 426 $ echo foo >> ../a
427 427 $ hg diff > ../../import.diff
428 428 $ hg revert --no-backup ../a
429 429 $ hg import ../../import.diff
430 430 abort: cannot import over an applied patch
431 431 [255]
432 432 $ hg st
433 433
434 434 import --no-commit should succeed
435 435
436 436 $ hg import --no-commit ../../import.diff
437 437 applying ../../import.diff
438 438 $ hg st
439 439 M a
440 440 $ hg revert --no-backup ../a
441 441
442 442
443 443 qunapplied
444 444
445 445 $ hg qunapplied
446 446 test2.patch
447 447
448 448
449 449 qpush/qpop with index
450 450
451 451 $ hg qnew test1b.patch
452 452 $ echo 1b > 1b
453 453 $ hg add 1b
454 454 $ hg qrefresh
455 455 $ hg qpush 2
456 456 applying test2.patch
457 457 now at: test2.patch
458 458 $ hg qpop 0
459 459 popping test2.patch
460 460 popping test1b.patch
461 461 now at: test.patch
462 462 $ hg qpush test.patch+1
463 463 applying test1b.patch
464 464 now at: test1b.patch
465 465 $ hg qpush test.patch+2
466 466 applying test2.patch
467 467 now at: test2.patch
468 468 $ hg qpop test2.patch-1
469 469 popping test2.patch
470 470 now at: test1b.patch
471 471 $ hg qpop test2.patch-2
472 472 popping test1b.patch
473 473 now at: test.patch
474 474 $ hg qpush test1b.patch+1
475 475 applying test1b.patch
476 476 applying test2.patch
477 477 now at: test2.patch
478 478
479 479
480 480 qpush --move
481 481
482 482 $ hg qpop -a
483 483 popping test2.patch
484 484 popping test1b.patch
485 485 popping test.patch
486 486 patch queue now empty
487 487 $ hg qguard test1b.patch -- -negguard
488 488 $ hg qguard test2.patch -- +posguard
489 489 $ hg qpush --move test2.patch # can't move guarded patch
490 490 cannot push 'test2.patch' - guarded by '+posguard'
491 491 [1]
492 492 $ hg qselect posguard
493 493 number of unguarded, unapplied patches has changed from 2 to 3
494 494 $ hg qpush --move test2.patch # move to front
495 495 applying test2.patch
496 496 now at: test2.patch
497 497 $ hg qpush --move test1b.patch # negative guard unselected
498 498 applying test1b.patch
499 499 now at: test1b.patch
500 500 $ hg qpush --move test.patch # noop move
501 501 applying test.patch
502 502 now at: test.patch
503 503 $ hg qseries -v
504 504 0 A test2.patch
505 505 1 A test1b.patch
506 506 2 A test.patch
507 507 $ hg qpop -a
508 508 popping test.patch
509 509 popping test1b.patch
510 510 popping test2.patch
511 511 patch queue now empty
512 512
513 513 cleaning up
514 514
515 515 $ hg qselect --none
516 516 guards deactivated
517 517 number of unguarded, unapplied patches has changed from 3 to 2
518 518 $ hg qguard --none test1b.patch
519 519 $ hg qguard --none test2.patch
520 520 $ hg qpush --move test.patch
521 521 applying test.patch
522 522 now at: test.patch
523 523 $ hg qpush --move test1b.patch
524 524 applying test1b.patch
525 525 now at: test1b.patch
526 526 $ hg qpush --move bogus # nonexistent patch
527 527 abort: patch bogus not in series
528 528 [255]
529 529 $ hg qpush --move # no patch
530 530 abort: please specify the patch to move
531 531 [255]
532 532 $ hg qpush --move test.patch # already applied
533 533 abort: cannot push to a previous patch: test.patch
534 534 [255]
535 535 $ sed '2i\
536 536 > # make qtip index different in series and fullseries
537 537 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
538 538 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
539 539 $ cat `hg root`/.hg/patches/series
540 540 # comment
541 541 # make qtip index different in series and fullseries
542 542
543 543 test.patch
544 544 test1b.patch
545 545 test2.patch
546 546 $ hg qpush --move test2.patch
547 547 applying test2.patch
548 548 now at: test2.patch
549 549
550 550
551 551 series after move
552 552
553 553 $ cat `hg root`/.hg/patches/series
554 554 # comment
555 555 # make qtip index different in series and fullseries
556 556
557 557 test.patch
558 558 test1b.patch
559 559 test2.patch
560 560
561 561
562 562 pop, qapplied, qunapplied
563 563
564 564 $ hg qseries -v
565 565 0 A test.patch
566 566 1 A test1b.patch
567 567 2 A test2.patch
568 568
569 569 qapplied -1 test.patch
570 570
571 571 $ hg qapplied -1 test.patch
572 572 only one patch applied
573 573 [1]
574 574
575 575 qapplied -1 test1b.patch
576 576
577 577 $ hg qapplied -1 test1b.patch
578 578 test.patch
579 579
580 580 qapplied -1 test2.patch
581 581
582 582 $ hg qapplied -1 test2.patch
583 583 test1b.patch
584 584
585 585 qapplied -1
586 586
587 587 $ hg qapplied -1
588 588 test1b.patch
589 589
590 590 qapplied
591 591
592 592 $ hg qapplied
593 593 test.patch
594 594 test1b.patch
595 595 test2.patch
596 596
597 597 qapplied test1b.patch
598 598
599 599 $ hg qapplied test1b.patch
600 600 test.patch
601 601 test1b.patch
602 602
603 603 qunapplied -1
604 604
605 605 $ hg qunapplied -1
606 606 all patches applied
607 607 [1]
608 608
609 609 qunapplied
610 610
611 611 $ hg qunapplied
612 612
613 613 popping
614 614
615 615 $ hg qpop
616 616 popping test2.patch
617 617 now at: test1b.patch
618 618
619 619 qunapplied -1
620 620
621 621 $ hg qunapplied -1
622 622 test2.patch
623 623
624 624 qunapplied
625 625
626 626 $ hg qunapplied
627 627 test2.patch
628 628
629 629 qunapplied test2.patch
630 630
631 631 $ hg qunapplied test2.patch
632 632
633 633 qunapplied -1 test2.patch
634 634
635 635 $ hg qunapplied -1 test2.patch
636 636 all patches applied
637 637 [1]
638 638
639 639 popping -a
640 640
641 641 $ hg qpop -a
642 642 popping test1b.patch
643 643 popping test.patch
644 644 patch queue now empty
645 645
646 646 qapplied
647 647
648 648 $ hg qapplied
649 649
650 650 qapplied -1
651 651
652 652 $ hg qapplied -1
653 653 no patches applied
654 654 [1]
655 655 $ hg qpush
656 656 applying test.patch
657 657 now at: test.patch
658 658
659 659
660 660 push should succeed
661 661
662 662 $ hg qpop -a
663 663 popping test.patch
664 664 patch queue now empty
665 665 $ hg push ../../k
666 666 pushing to ../../k
667 667 searching for changes
668 668 adding changesets
669 669 adding manifests
670 670 adding file changes
671 671 added 1 changesets with 1 changes to 1 files
672 672
673 673
674 674 we want to start with some patches applied
675 675
676 676 $ hg qpush -a
677 677 applying test.patch
678 678 applying test1b.patch
679 679 applying test2.patch
680 680 now at: test2.patch
681 681
682 682 % pops all patches and succeeds
683 683
684 684 $ hg qpop -a
685 685 popping test2.patch
686 686 popping test1b.patch
687 687 popping test.patch
688 688 patch queue now empty
689 689
690 690 % does nothing and succeeds
691 691
692 692 $ hg qpop -a
693 693 no patches applied
694 694
695 695 % fails - nothing else to pop
696 696
697 697 $ hg qpop
698 698 no patches applied
699 699 [1]
700 700
701 701 % pushes a patch and succeeds
702 702
703 703 $ hg qpush
704 704 applying test.patch
705 705 now at: test.patch
706 706
707 707 % pops a patch and succeeds
708 708
709 709 $ hg qpop
710 710 popping test.patch
711 711 patch queue now empty
712 712
713 713 % pushes up to test1b.patch and succeeds
714 714
715 715 $ hg qpush test1b.patch
716 716 applying test.patch
717 717 applying test1b.patch
718 718 now at: test1b.patch
719 719
720 720 % does nothing and succeeds
721 721
722 722 $ hg qpush test1b.patch
723 723 qpush: test1b.patch is already at the top
724 724
725 725 % does nothing and succeeds
726 726
727 727 $ hg qpop test1b.patch
728 728 qpop: test1b.patch is already at the top
729 729
730 730 % fails - can't push to this patch
731 731
732 732 $ hg qpush test.patch
733 733 abort: cannot push to a previous patch: test.patch
734 734 [255]
735 735
736 736 % fails - can't pop to this patch
737 737
738 738 $ hg qpop test2.patch
739 739 abort: patch test2.patch is not applied
740 740 [255]
741 741
742 742 % pops up to test.patch and succeeds
743 743
744 744 $ hg qpop test.patch
745 745 popping test1b.patch
746 746 now at: test.patch
747 747
748 748 % pushes all patches and succeeds
749 749
750 750 $ hg qpush -a
751 751 applying test1b.patch
752 752 applying test2.patch
753 753 now at: test2.patch
754 754
755 755 % does nothing and succeeds
756 756
757 757 $ hg qpush -a
758 758 all patches are currently applied
759 759
760 760 % fails - nothing else to push
761 761
762 762 $ hg qpush
763 763 patch series already fully applied
764 764 [1]
765 765
766 766 % does nothing and succeeds
767 767
768 768 $ hg qpush test2.patch
769 769 qpush: test2.patch is already at the top
770 770
771 771 strip
772 772
773 773 $ cd ../../b
774 774 $ echo x>x
775 775 $ hg ci -Ama
776 776 adding x
777 777 $ hg strip tip
778 778 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
779 779 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
780 780 $ hg unbundle .hg/strip-backup/*
781 781 adding changesets
782 782 adding manifests
783 783 adding file changes
784 784 added 1 changesets with 1 changes to 1 files
785 785 (run 'hg update' to get a working copy)
786 786
787 787
788 788 strip with local changes, should complain
789 789
790 790 $ hg up
791 791 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
792 792 $ echo y>y
793 793 $ hg add y
794 794 $ hg strip tip
795 795 abort: local changes found
796 796 [255]
797 797
798 798 --force strip with local changes
799 799
800 800 $ hg strip -f tip
801 801 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
802 802 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg (glob)
803 803 $ cd ..
804 804
805 805
806 806 cd b; hg qrefresh
807 807
808 808 $ hg init refresh
809 809 $ cd refresh
810 810 $ echo a > a
811 811 $ hg ci -Ama
812 812 adding a
813 813 $ hg qnew -mfoo foo
814 814 $ echo a >> a
815 815 $ hg qrefresh
816 816 $ mkdir b
817 817 $ cd b
818 818 $ echo f > f
819 819 $ hg add f
820 820 $ hg qrefresh
821 821 $ cat ../.hg/patches/foo
822 822 foo
823 823
824 824 diff -r cb9a9f314b8b a
825 825 --- a/a\t(?P<date>.*) (re)
826 826 \+\+\+ b/a\t(?P<date>.*) (re)
827 827 @@ -1,1 +1,2 @@
828 828 a
829 829 +a
830 830 diff -r cb9a9f314b8b b/f
831 831 --- /dev/null\t(?P<date>.*) (re)
832 832 \+\+\+ b/b/f\t(?P<date>.*) (re)
833 833 @@ -0,0 +1,1 @@
834 834 +f
835 835
836 836 hg qrefresh .
837 837
838 838 $ hg qrefresh .
839 839 $ cat ../.hg/patches/foo
840 840 foo
841 841
842 842 diff -r cb9a9f314b8b b/f
843 843 --- /dev/null\t(?P<date>.*) (re)
844 844 \+\+\+ b/b/f\t(?P<date>.*) (re)
845 845 @@ -0,0 +1,1 @@
846 846 +f
847 847 $ hg status
848 848 M a
849 849
850 850
851 851 qpush failure
852 852
853 853 $ cd ..
854 854 $ hg qrefresh
855 855 $ hg qnew -mbar bar
856 856 $ echo foo > foo
857 857 $ echo bar > bar
858 858 $ hg add foo bar
859 859 $ hg qrefresh
860 860 $ hg qpop -a
861 861 popping bar
862 862 popping foo
863 863 patch queue now empty
864 864 $ echo bar > foo
865 865 $ hg qpush -a
866 866 applying foo
867 867 applying bar
868 868 file foo already exists
869 869 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
870 870 patch failed, unable to continue (try -v)
871 871 patch failed, rejects left in working directory
872 872 errors during apply, please fix and qrefresh bar
873 873 [2]
874 874 $ hg st
875 875 ? foo
876 876 ? foo.rej
877 877
878 878
879 879 mq tags
880 880
881 881 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
882 882 0 qparent
883 883 1 foo qbase
884 884 2 bar qtip tip
885 885
886 886 mq revset
887 887
888 888 $ hg log -r 'mq()' --template '{rev}\n'
889 889 1
890 890 2
891 $ hg help revsets | grep -i mq
891 $ hg help revisions.mq
892 892 "mq()"
893 893 Changesets managed by MQ.
894
894 895
895 896 bad node in status
896 897
897 898 $ hg qpop
898 899 popping bar
899 900 now at: foo
900 901 $ hg strip -qn tip
901 902 $ hg tip
902 903 changeset: 0:cb9a9f314b8b
903 904 tag: tip
904 905 user: test
905 906 date: Thu Jan 01 00:00:00 1970 +0000
906 907 summary: a
907 908
908 909 $ hg branches
909 910 default 0:cb9a9f314b8b
910 911 $ hg qpop
911 912 no patches applied
912 913 [1]
913 914
914 915 $ cd ..
915 916
916 917
917 918 git patches
918 919
919 920 $ cat >>$HGRCPATH <<EOF
920 921 > [diff]
921 922 > git = True
922 923 > EOF
923 924 $ hg init git
924 925 $ cd git
925 926 $ hg qinit
926 927
927 928 $ hg qnew -m'new file' new
928 929 $ echo foo > new
929 930 #if execbit
930 931 $ chmod +x new
931 932 #endif
932 933 $ hg add new
933 934 $ hg qrefresh
934 935 #if execbit
935 936 $ cat .hg/patches/new
936 937 new file
937 938
938 939 diff --git a/new b/new
939 940 new file mode 100755
940 941 --- /dev/null
941 942 +++ b/new
942 943 @@ -0,0 +1,1 @@
943 944 +foo
944 945 #else
945 946 $ cat .hg/patches/new
946 947 new file
947 948
948 949 diff --git a/new b/new
949 950 new file mode 100644
950 951 --- /dev/null
951 952 +++ b/new
952 953 @@ -0,0 +1,1 @@
953 954 +foo
954 955 #endif
955 956
956 957 $ hg qnew -m'copy file' copy
957 958 $ hg cp new copy
958 959 $ hg qrefresh
959 960 $ cat .hg/patches/copy
960 961 copy file
961 962
962 963 diff --git a/new b/copy
963 964 copy from new
964 965 copy to copy
965 966
966 967 $ hg qpop
967 968 popping copy
968 969 now at: new
969 970 $ hg qpush
970 971 applying copy
971 972 now at: copy
972 973 $ hg qdiff
973 974 diff --git a/new b/copy
974 975 copy from new
975 976 copy to copy
976 977 $ cat >>$HGRCPATH <<EOF
977 978 > [diff]
978 979 > git = False
979 980 > EOF
980 981 $ hg qdiff --git
981 982 diff --git a/new b/copy
982 983 copy from new
983 984 copy to copy
984 985 $ cd ..
985 986
986 987 empty lines in status
987 988
988 989 $ hg init emptystatus
989 990 $ cd emptystatus
990 991 $ hg qinit
991 992 $ printf '\n\n' > .hg/patches/status
992 993 $ hg qser
993 994 $ cd ..
994 995
995 996 bad line in status (without ":")
996 997
997 998 $ hg init badstatus
998 999 $ cd badstatus
999 1000 $ hg qinit
1000 1001 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1001 1002 $ hg qser
1002 1003 malformated mq status line: ['babar has no colon in this line']
1003 1004 $ cd ..
1004 1005
1005 1006
1006 1007 test file addition in slow path
1007 1008
1008 1009 $ hg init slow
1009 1010 $ cd slow
1010 1011 $ hg qinit
1011 1012 $ echo foo > foo
1012 1013 $ hg add foo
1013 1014 $ hg ci -m 'add foo'
1014 1015 $ hg qnew bar
1015 1016 $ echo bar > bar
1016 1017 $ hg add bar
1017 1018 $ hg mv foo baz
1018 1019 $ hg qrefresh --git
1019 1020 $ hg up -C 0
1020 1021 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1021 1022 $ echo >> foo
1022 1023 $ hg ci -m 'change foo'
1023 1024 created new head
1024 1025 $ hg up -C 1
1025 1026 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1026 1027 $ hg qrefresh --git
1027 1028 $ cat .hg/patches/bar
1028 1029 diff --git a/bar b/bar
1029 1030 new file mode 100644
1030 1031 --- /dev/null
1031 1032 +++ b/bar
1032 1033 @@ -0,0 +1,1 @@
1033 1034 +bar
1034 1035 diff --git a/foo b/baz
1035 1036 rename from foo
1036 1037 rename to baz
1037 1038 $ hg log -v --template '{rev} {file_copies}\n' -r .
1038 1039 2 baz (foo)
1039 1040 $ hg qrefresh --git
1040 1041 $ cat .hg/patches/bar
1041 1042 diff --git a/bar b/bar
1042 1043 new file mode 100644
1043 1044 --- /dev/null
1044 1045 +++ b/bar
1045 1046 @@ -0,0 +1,1 @@
1046 1047 +bar
1047 1048 diff --git a/foo b/baz
1048 1049 rename from foo
1049 1050 rename to baz
1050 1051 $ hg log -v --template '{rev} {file_copies}\n' -r .
1051 1052 2 baz (foo)
1052 1053 $ hg qrefresh
1053 1054 $ grep 'diff --git' .hg/patches/bar
1054 1055 diff --git a/bar b/bar
1055 1056 diff --git a/foo b/baz
1056 1057
1057 1058
1058 1059 test file move chains in the slow path
1059 1060
1060 1061 $ hg up -C 1
1061 1062 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1062 1063 $ echo >> foo
1063 1064 $ hg ci -m 'change foo again'
1064 1065 $ hg up -C 2
1065 1066 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1066 1067 $ hg mv bar quux
1067 1068 $ hg mv baz bleh
1068 1069 $ hg qrefresh --git
1069 1070 $ cat .hg/patches/bar
1070 1071 diff --git a/foo b/bleh
1071 1072 rename from foo
1072 1073 rename to bleh
1073 1074 diff --git a/quux b/quux
1074 1075 new file mode 100644
1075 1076 --- /dev/null
1076 1077 +++ b/quux
1077 1078 @@ -0,0 +1,1 @@
1078 1079 +bar
1079 1080 $ hg log -v --template '{rev} {file_copies}\n' -r .
1080 1081 3 bleh (foo)
1081 1082 $ hg mv quux fred
1082 1083 $ hg mv bleh barney
1083 1084 $ hg qrefresh --git
1084 1085 $ cat .hg/patches/bar
1085 1086 diff --git a/foo b/barney
1086 1087 rename from foo
1087 1088 rename to barney
1088 1089 diff --git a/fred b/fred
1089 1090 new file mode 100644
1090 1091 --- /dev/null
1091 1092 +++ b/fred
1092 1093 @@ -0,0 +1,1 @@
1093 1094 +bar
1094 1095 $ hg log -v --template '{rev} {file_copies}\n' -r .
1095 1096 3 barney (foo)
1096 1097
1097 1098
1098 1099 refresh omitting an added file
1099 1100
1100 1101 $ hg qnew baz
1101 1102 $ echo newfile > newfile
1102 1103 $ hg add newfile
1103 1104 $ hg qrefresh
1104 1105 $ hg st -A newfile
1105 1106 C newfile
1106 1107 $ hg qrefresh -X newfile
1107 1108 $ hg st -A newfile
1108 1109 A newfile
1109 1110 $ hg revert newfile
1110 1111 $ rm newfile
1111 1112 $ hg qpop
1112 1113 popping baz
1113 1114 now at: bar
1114 1115
1115 1116 test qdel/qrm
1116 1117
1117 1118 $ hg qdel baz
1118 1119 $ echo p >> .hg/patches/series
1119 1120 $ hg qrm p
1120 1121 $ hg qser
1121 1122 bar
1122 1123
1123 1124 create a git patch
1124 1125
1125 1126 $ echo a > alexander
1126 1127 $ hg add alexander
1127 1128 $ hg qnew -f --git addalexander
1128 1129 $ grep diff .hg/patches/addalexander
1129 1130 diff --git a/alexander b/alexander
1130 1131
1131 1132
1132 1133 create a git binary patch
1133 1134
1134 1135 $ cat > writebin.py <<EOF
1135 1136 > import sys
1136 1137 > path = sys.argv[1]
1137 1138 > open(path, 'wb').write('BIN\x00ARY')
1138 1139 > EOF
1139 1140 $ python writebin.py bucephalus
1140 1141
1141 1142 $ python "$TESTDIR/md5sum.py" bucephalus
1142 1143 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1143 1144 $ hg add bucephalus
1144 1145 $ hg qnew -f --git addbucephalus
1145 1146 $ grep diff .hg/patches/addbucephalus
1146 1147 diff --git a/bucephalus b/bucephalus
1147 1148
1148 1149
1149 1150 check binary patches can be popped and pushed
1150 1151
1151 1152 $ hg qpop
1152 1153 popping addbucephalus
1153 1154 now at: addalexander
1154 1155 $ test -f bucephalus && echo % bucephalus should not be there
1155 1156 [1]
1156 1157 $ hg qpush
1157 1158 applying addbucephalus
1158 1159 now at: addbucephalus
1159 1160 $ test -f bucephalus
1160 1161 $ python "$TESTDIR/md5sum.py" bucephalus
1161 1162 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1162 1163
1163 1164
1164 1165
1165 1166 strip again
1166 1167
1167 1168 $ cd ..
1168 1169 $ hg init strip
1169 1170 $ cd strip
1170 1171 $ touch foo
1171 1172 $ hg add foo
1172 1173 $ hg ci -m 'add foo'
1173 1174 $ echo >> foo
1174 1175 $ hg ci -m 'change foo 1'
1175 1176 $ hg up -C 0
1176 1177 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1177 1178 $ echo 1 >> foo
1178 1179 $ hg ci -m 'change foo 2'
1179 1180 created new head
1180 1181 $ HGMERGE=true hg merge
1181 1182 merging foo
1182 1183 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1183 1184 (branch merge, don't forget to commit)
1184 1185 $ hg ci -m merge
1185 1186 $ hg log
1186 1187 changeset: 3:99615015637b
1187 1188 tag: tip
1188 1189 parent: 2:20cbbe65cff7
1189 1190 parent: 1:d2871fc282d4
1190 1191 user: test
1191 1192 date: Thu Jan 01 00:00:00 1970 +0000
1192 1193 summary: merge
1193 1194
1194 1195 changeset: 2:20cbbe65cff7
1195 1196 parent: 0:53245c60e682
1196 1197 user: test
1197 1198 date: Thu Jan 01 00:00:00 1970 +0000
1198 1199 summary: change foo 2
1199 1200
1200 1201 changeset: 1:d2871fc282d4
1201 1202 user: test
1202 1203 date: Thu Jan 01 00:00:00 1970 +0000
1203 1204 summary: change foo 1
1204 1205
1205 1206 changeset: 0:53245c60e682
1206 1207 user: test
1207 1208 date: Thu Jan 01 00:00:00 1970 +0000
1208 1209 summary: add foo
1209 1210
1210 1211 $ hg strip 1
1211 1212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1212 1213 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1213 1214 $ checkundo strip
1214 1215 $ hg log
1215 1216 changeset: 1:20cbbe65cff7
1216 1217 tag: tip
1217 1218 user: test
1218 1219 date: Thu Jan 01 00:00:00 1970 +0000
1219 1220 summary: change foo 2
1220 1221
1221 1222 changeset: 0:53245c60e682
1222 1223 user: test
1223 1224 date: Thu Jan 01 00:00:00 1970 +0000
1224 1225 summary: add foo
1225 1226
1226 1227 $ cd ..
1227 1228
1228 1229
1229 1230 qclone
1230 1231
1231 1232 $ qlog()
1232 1233 > {
1233 1234 > echo 'main repo:'
1234 1235 > hg log --template ' rev {rev}: {desc}\n'
1235 1236 > echo 'patch repo:'
1236 1237 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1237 1238 > }
1238 1239 $ hg init qclonesource
1239 1240 $ cd qclonesource
1240 1241 $ echo foo > foo
1241 1242 $ hg add foo
1242 1243 $ hg ci -m 'add foo'
1243 1244 $ hg qinit
1244 1245 $ hg qnew patch1
1245 1246 $ echo bar >> foo
1246 1247 $ hg qrefresh -m 'change foo'
1247 1248 $ cd ..
1248 1249
1249 1250
1250 1251 repo with unversioned patch dir
1251 1252
1252 1253 $ hg qclone qclonesource failure
1253 1254 abort: versioned patch repository not found (see init --mq)
1254 1255 [255]
1255 1256
1256 1257 $ cd qclonesource
1257 1258 $ hg qinit -c
1258 1259 adding .hg/patches/patch1 (glob)
1259 1260 $ hg qci -m checkpoint
1260 1261 $ qlog
1261 1262 main repo:
1262 1263 rev 1: change foo
1263 1264 rev 0: add foo
1264 1265 patch repo:
1265 1266 rev 0: checkpoint
1266 1267 $ cd ..
1267 1268
1268 1269
1269 1270 repo with patches applied
1270 1271
1271 1272 $ hg qclone qclonesource qclonedest
1272 1273 updating to branch default
1273 1274 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1274 1275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1275 1276 $ cd qclonedest
1276 1277 $ qlog
1277 1278 main repo:
1278 1279 rev 0: add foo
1279 1280 patch repo:
1280 1281 rev 0: checkpoint
1281 1282 $ cd ..
1282 1283
1283 1284
1284 1285 repo with patches unapplied
1285 1286
1286 1287 $ cd qclonesource
1287 1288 $ hg qpop -a
1288 1289 popping patch1
1289 1290 patch queue now empty
1290 1291 $ qlog
1291 1292 main repo:
1292 1293 rev 0: add foo
1293 1294 patch repo:
1294 1295 rev 0: checkpoint
1295 1296 $ cd ..
1296 1297 $ hg qclone qclonesource qclonedest2
1297 1298 updating to branch default
1298 1299 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1299 1300 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1300 1301 $ cd qclonedest2
1301 1302 $ qlog
1302 1303 main repo:
1303 1304 rev 0: add foo
1304 1305 patch repo:
1305 1306 rev 0: checkpoint
1306 1307 $ cd ..
1307 1308
1308 1309
1309 1310 Issue1033: test applying on an empty file
1310 1311
1311 1312 $ hg init empty
1312 1313 $ cd empty
1313 1314 $ touch a
1314 1315 $ hg ci -Am addempty
1315 1316 adding a
1316 1317 $ echo a > a
1317 1318 $ hg qnew -f -e changea
1318 1319 $ hg qpop
1319 1320 popping changea
1320 1321 patch queue now empty
1321 1322 $ hg qpush
1322 1323 applying changea
1323 1324 now at: changea
1324 1325 $ cd ..
1325 1326
1326 1327 test qpush with --force, issue1087
1327 1328
1328 1329 $ hg init forcepush
1329 1330 $ cd forcepush
1330 1331 $ echo hello > hello.txt
1331 1332 $ echo bye > bye.txt
1332 1333 $ hg ci -Ama
1333 1334 adding bye.txt
1334 1335 adding hello.txt
1335 1336 $ hg qnew -d '0 0' empty
1336 1337 $ hg qpop
1337 1338 popping empty
1338 1339 patch queue now empty
1339 1340 $ echo world >> hello.txt
1340 1341
1341 1342
1342 1343 qpush should fail, local changes
1343 1344
1344 1345 $ hg qpush
1345 1346 abort: local changes found
1346 1347 [255]
1347 1348
1348 1349
1349 1350 apply force, should not discard changes with empty patch
1350 1351
1351 1352 $ hg qpush -f
1352 1353 applying empty
1353 1354 patch empty is empty
1354 1355 now at: empty
1355 1356 $ hg diff --config diff.nodates=True
1356 1357 diff -r d58265112590 hello.txt
1357 1358 --- a/hello.txt
1358 1359 +++ b/hello.txt
1359 1360 @@ -1,1 +1,2 @@
1360 1361 hello
1361 1362 +world
1362 1363 $ hg qdiff --config diff.nodates=True
1363 1364 diff -r 9ecee4f634e3 hello.txt
1364 1365 --- a/hello.txt
1365 1366 +++ b/hello.txt
1366 1367 @@ -1,1 +1,2 @@
1367 1368 hello
1368 1369 +world
1369 1370 $ hg log -l1 -p
1370 1371 changeset: 1:d58265112590
1371 1372 tag: empty
1372 1373 tag: qbase
1373 1374 tag: qtip
1374 1375 tag: tip
1375 1376 user: test
1376 1377 date: Thu Jan 01 00:00:00 1970 +0000
1377 1378 summary: imported patch empty
1378 1379
1379 1380
1380 1381 $ hg qref -d '0 0'
1381 1382 $ hg qpop
1382 1383 popping empty
1383 1384 patch queue now empty
1384 1385 $ echo universe >> hello.txt
1385 1386 $ echo universe >> bye.txt
1386 1387
1387 1388
1388 1389 qpush should fail, local changes
1389 1390
1390 1391 $ hg qpush
1391 1392 abort: local changes found
1392 1393 [255]
1393 1394
1394 1395
1395 1396 apply force, should discard changes in hello, but not bye
1396 1397
1397 1398 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1398 1399 applying empty
1399 1400 creating directory: $TESTTMP/forcepush/.hg/origbackups (glob)
1400 1401 saving current version of hello.txt as $TESTTMP/forcepush/.hg/origbackups/hello.txt.orig (glob)
1401 1402 patching file hello.txt
1402 1403 committing files:
1403 1404 hello.txt
1404 1405 committing manifest
1405 1406 committing changelog
1406 1407 now at: empty
1407 1408 $ hg st
1408 1409 M bye.txt
1409 1410 $ hg diff --config diff.nodates=True
1410 1411 diff -r ba252371dbc1 bye.txt
1411 1412 --- a/bye.txt
1412 1413 +++ b/bye.txt
1413 1414 @@ -1,1 +1,2 @@
1414 1415 bye
1415 1416 +universe
1416 1417 $ hg qdiff --config diff.nodates=True
1417 1418 diff -r 9ecee4f634e3 bye.txt
1418 1419 --- a/bye.txt
1419 1420 +++ b/bye.txt
1420 1421 @@ -1,1 +1,2 @@
1421 1422 bye
1422 1423 +universe
1423 1424 diff -r 9ecee4f634e3 hello.txt
1424 1425 --- a/hello.txt
1425 1426 +++ b/hello.txt
1426 1427 @@ -1,1 +1,3 @@
1427 1428 hello
1428 1429 +world
1429 1430 +universe
1430 1431
1431 1432 test that the previous call to qpush with -f (--force) and --config actually put
1432 1433 the orig files out of the working copy
1433 1434 $ ls .hg/origbackups
1434 1435 hello.txt.orig
1435 1436
1436 1437 test popping revisions not in working dir ancestry
1437 1438
1438 1439 $ hg qseries -v
1439 1440 0 A empty
1440 1441 $ hg up qparent
1441 1442 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1442 1443 $ hg qpop
1443 1444 popping empty
1444 1445 patch queue now empty
1445 1446
1446 1447 $ cd ..
1447 1448 $ hg init deletion-order
1448 1449 $ cd deletion-order
1449 1450
1450 1451 $ touch a
1451 1452 $ hg ci -Aqm0
1452 1453
1453 1454 $ hg qnew rename-dir
1454 1455 $ hg rm a
1455 1456 $ hg qrefresh
1456 1457
1457 1458 $ mkdir a b
1458 1459 $ touch a/a b/b
1459 1460 $ hg add -q a b
1460 1461 $ hg qrefresh
1461 1462
1462 1463
1463 1464 test popping must remove files added in subdirectories first
1464 1465
1465 1466 $ hg qpop
1466 1467 popping rename-dir
1467 1468 patch queue now empty
1468 1469 $ cd ..
1469 1470
1470 1471
1471 1472 test case preservation through patch pushing especially on case
1472 1473 insensitive filesystem
1473 1474
1474 1475 $ hg init casepreserve
1475 1476 $ cd casepreserve
1476 1477
1477 1478 $ hg qnew add-file1
1478 1479 $ echo a > TeXtFiLe.TxT
1479 1480 $ hg add TeXtFiLe.TxT
1480 1481 $ hg qrefresh
1481 1482
1482 1483 $ hg qnew add-file2
1483 1484 $ echo b > AnOtHeRFiLe.TxT
1484 1485 $ hg add AnOtHeRFiLe.TxT
1485 1486 $ hg qrefresh
1486 1487
1487 1488 $ hg qnew modify-file
1488 1489 $ echo c >> AnOtHeRFiLe.TxT
1489 1490 $ hg qrefresh
1490 1491
1491 1492 $ hg qapplied
1492 1493 add-file1
1493 1494 add-file2
1494 1495 modify-file
1495 1496 $ hg qpop -a
1496 1497 popping modify-file
1497 1498 popping add-file2
1498 1499 popping add-file1
1499 1500 patch queue now empty
1500 1501
1501 1502 this qpush causes problems below, if case preservation on case
1502 1503 insensitive filesystem is not enough:
1503 1504 (1) unexpected "adding ..." messages are shown
1504 1505 (2) patching fails in modification of (1) files
1505 1506
1506 1507 $ hg qpush -a
1507 1508 applying add-file1
1508 1509 applying add-file2
1509 1510 applying modify-file
1510 1511 now at: modify-file
1511 1512
1512 1513 Proper phase default with mq:
1513 1514
1514 1515 1. mq.secret=false
1515 1516
1516 1517 $ rm .hg/store/phaseroots
1517 1518 $ hg phase 'qparent::'
1518 1519 -1: public
1519 1520 0: draft
1520 1521 1: draft
1521 1522 2: draft
1522 1523 $ echo '[mq]' >> $HGRCPATH
1523 1524 $ echo 'secret=true' >> $HGRCPATH
1524 1525 $ rm -f .hg/store/phaseroots
1525 1526 $ hg phase 'qparent::'
1526 1527 -1: public
1527 1528 0: secret
1528 1529 1: secret
1529 1530 2: secret
1530 1531
1531 1532 Test that qfinish change phase when mq.secret=true
1532 1533
1533 1534 $ hg qfinish qbase
1534 1535 patch add-file1 finalized without changeset message
1535 1536 $ hg phase 'all()'
1536 1537 0: draft
1537 1538 1: secret
1538 1539 2: secret
1539 1540
1540 1541 Test that qfinish respect phases.new-commit setting
1541 1542
1542 1543 $ echo '[phases]' >> $HGRCPATH
1543 1544 $ echo 'new-commit=secret' >> $HGRCPATH
1544 1545 $ hg qfinish qbase
1545 1546 patch add-file2 finalized without changeset message
1546 1547 $ hg phase 'all()'
1547 1548 0: draft
1548 1549 1: secret
1549 1550 2: secret
1550 1551
1551 1552 (restore env for next test)
1552 1553
1553 1554 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1554 1555 $ cp $TESTTMP/sedtmp $HGRCPATH
1555 1556 $ hg qimport -r 1 --name add-file2
1556 1557
1557 1558 Test that qfinish preserve phase when mq.secret=false
1558 1559
1559 1560 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1560 1561 $ cp $TESTTMP/sedtmp $HGRCPATH
1561 1562 $ hg qfinish qbase
1562 1563 patch add-file2 finalized without changeset message
1563 1564 $ hg phase 'all()'
1564 1565 0: draft
1565 1566 1: secret
1566 1567 2: secret
1567 1568
1568 1569 Test that secret mq patch does not break hgweb
1569 1570
1570 1571 $ cat > hgweb.cgi <<HGWEB
1571 1572 > from mercurial import demandimport; demandimport.enable()
1572 1573 > from mercurial.hgweb import hgweb
1573 1574 > from mercurial.hgweb import wsgicgi
1574 1575 > import cgitb
1575 1576 > cgitb.enable()
1576 1577 > app = hgweb('.', 'test')
1577 1578 > wsgicgi.launch(app)
1578 1579 > HGWEB
1579 1580 $ . "$TESTDIR/cgienv"
1580 1581 #if msys
1581 1582 $ PATH_INFO=//tags; export PATH_INFO
1582 1583 #else
1583 1584 $ PATH_INFO=/tags; export PATH_INFO
1584 1585 #endif
1585 1586 $ QUERY_STRING='style=raw'
1586 1587 $ python hgweb.cgi | grep '^tip'
1587 1588 tip [0-9a-f]{40} (re)
1588 1589
1589 1590 $ cd ..
1590 1591
1591 1592 Test interaction with revset (issue4426)
1592 1593
1593 1594 $ hg init issue4426
1594 1595 $ cd issue4426
1595 1596
1596 1597 $ echo a > a
1597 1598 $ hg ci -Am a
1598 1599 adding a
1599 1600 $ echo a >> a
1600 1601 $ hg ci -m a
1601 1602 $ echo a >> a
1602 1603 $ hg ci -m a
1603 1604 $ hg qimport -r 0::
1604 1605
1605 1606 reimport things
1606 1607
1607 1608 $ hg qimport -r 1::
1608 1609 abort: revision 2 is already managed
1609 1610 [255]
1610 1611
1611 1612
1612 1613 $ cd ..
@@ -1,992 +1,993 b''
1 1 #require killdaemons
2 2
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [extensions]
5 5 > transplant=
6 6 > EOF
7 7
8 8 $ hg init t
9 9 $ cd t
10 10 $ hg transplant
11 11 abort: no source URL, branch revision, or revision list provided
12 12 [255]
13 13 $ hg transplant --continue --all
14 14 abort: --continue is incompatible with --branch, --all and --merge
15 15 [255]
16 16 $ hg transplant --all tip
17 17 abort: --all requires a branch revision
18 18 [255]
19 19 $ hg transplant --all --branch default tip
20 20 abort: --all is incompatible with a revision list
21 21 [255]
22 22 $ echo r1 > r1
23 23 $ hg ci -Amr1 -d'0 0'
24 24 adding r1
25 25 $ hg co -q null
26 26 $ hg transplant tip
27 27 abort: no revision checked out
28 28 [255]
29 29 $ hg up -q
30 30 $ echo r2 > r2
31 31 $ hg ci -Amr2 -d'1 0'
32 32 adding r2
33 33 $ hg up 0
34 34 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
35 35
36 36 $ echo b1 > b1
37 37 $ hg ci -Amb1 -d '0 0'
38 38 adding b1
39 39 created new head
40 40 $ hg merge 1
41 41 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
42 42 (branch merge, don't forget to commit)
43 43 $ hg transplant 1
44 44 abort: outstanding uncommitted merges
45 45 [255]
46 46 $ hg up -qC tip
47 47 $ echo b0 > b1
48 48 $ hg transplant 1
49 49 abort: outstanding local changes
50 50 [255]
51 51 $ hg up -qC tip
52 52 $ echo b2 > b2
53 53 $ hg ci -Amb2 -d '1 0'
54 54 adding b2
55 55 $ echo b3 > b3
56 56 $ hg ci -Amb3 -d '2 0'
57 57 adding b3
58 58
59 59 $ hg log --template '{rev} {parents} {desc}\n'
60 60 4 b3
61 61 3 b2
62 62 2 0:17ab29e464c6 b1
63 63 1 r2
64 64 0 r1
65 65
66 66 $ hg clone . ../rebase
67 67 updating to branch default
68 68 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
69 69 $ hg init ../emptydest
70 70 $ cd ../emptydest
71 71 $ hg transplant --source=../t > /dev/null
72 72 $ cd ../rebase
73 73
74 74 $ hg up -C 1
75 75 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
76 76
77 77 rebase b onto r1
78 78 (this also tests that editor is not invoked if '--edit' is not specified)
79 79
80 80 $ HGEDITOR=cat hg transplant -a -b tip
81 81 applying 37a1297eb21b
82 82 37a1297eb21b transplanted to e234d668f844
83 83 applying 722f4667af76
84 84 722f4667af76 transplanted to 539f377d78df
85 85 applying a53251cdf717
86 86 a53251cdf717 transplanted to ffd6818a3975
87 87 $ hg log --template '{rev} {parents} {desc}\n'
88 88 7 b3
89 89 6 b2
90 90 5 1:d11e3596cc1a b1
91 91 4 b3
92 92 3 b2
93 93 2 0:17ab29e464c6 b1
94 94 1 r2
95 95 0 r1
96 96
97 97 test transplanted revset
98 98
99 99 $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'
100 100 5 1:d11e3596cc1a b1
101 101 6 b2
102 102 7 b3
103 103 $ hg log -r 'transplanted(head())' --template '{rev} {parents} {desc}\n'
104 104 7 b3
105 $ hg help revsets | grep transplanted
105 $ hg help revisions.transplanted
106 106 "transplanted([set])"
107 107 Transplanted changesets in set, or all transplanted changesets.
108
108 109
109 110 test transplanted keyword
110 111
111 112 $ hg log --template '{rev} {transplanted}\n'
112 113 7 a53251cdf717679d1907b289f991534be05c997a
113 114 6 722f4667af767100cb15b6a79324bf8abbfe1ef4
114 115 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21
115 116 4
116 117 3
117 118 2
118 119 1
119 120 0
120 121
121 122 test destination() revset predicate with a transplant of a transplant; new
122 123 clone so subsequent rollback isn't affected
123 124 (this also tests that editor is invoked if '--edit' is specified)
124 125
125 126 $ hg clone -q . ../destination
126 127 $ cd ../destination
127 128 $ hg up -Cq 0
128 129 $ hg branch -q b4
129 130 $ hg ci -qm "b4"
130 131 $ hg status --rev "7^1" --rev 7
131 132 A b3
132 133 $ cat > $TESTTMP/checkeditform.sh <<EOF
133 134 > env | grep HGEDITFORM
134 135 > true
135 136 > EOF
136 137 $ cat > $TESTTMP/checkeditform-n-cat.sh <<EOF
137 138 > env | grep HGEDITFORM
138 139 > cat \$*
139 140 > EOF
140 141 $ HGEDITOR="sh $TESTTMP/checkeditform-n-cat.sh" hg transplant --edit 7
141 142 applying ffd6818a3975
142 143 HGEDITFORM=transplant.normal
143 144 b3
144 145
145 146
146 147 HG: Enter commit message. Lines beginning with 'HG:' are removed.
147 148 HG: Leave message empty to abort commit.
148 149 HG: --
149 150 HG: user: test
150 151 HG: branch 'b4'
151 152 HG: added b3
152 153 ffd6818a3975 transplanted to 502236fa76bb
153 154
154 155
155 156 $ hg log -r 'destination()'
156 157 changeset: 5:e234d668f844
157 158 parent: 1:d11e3596cc1a
158 159 user: test
159 160 date: Thu Jan 01 00:00:00 1970 +0000
160 161 summary: b1
161 162
162 163 changeset: 6:539f377d78df
163 164 user: test
164 165 date: Thu Jan 01 00:00:01 1970 +0000
165 166 summary: b2
166 167
167 168 changeset: 7:ffd6818a3975
168 169 user: test
169 170 date: Thu Jan 01 00:00:02 1970 +0000
170 171 summary: b3
171 172
172 173 changeset: 9:502236fa76bb
173 174 branch: b4
174 175 tag: tip
175 176 user: test
176 177 date: Thu Jan 01 00:00:02 1970 +0000
177 178 summary: b3
178 179
179 180 $ hg log -r 'destination(a53251cdf717)'
180 181 changeset: 7:ffd6818a3975
181 182 user: test
182 183 date: Thu Jan 01 00:00:02 1970 +0000
183 184 summary: b3
184 185
185 186 changeset: 9:502236fa76bb
186 187 branch: b4
187 188 tag: tip
188 189 user: test
189 190 date: Thu Jan 01 00:00:02 1970 +0000
190 191 summary: b3
191 192
192 193
193 194 test subset parameter in reverse order
194 195 $ hg log -r 'reverse(all()) and destination(a53251cdf717)'
195 196 changeset: 9:502236fa76bb
196 197 branch: b4
197 198 tag: tip
198 199 user: test
199 200 date: Thu Jan 01 00:00:02 1970 +0000
200 201 summary: b3
201 202
202 203 changeset: 7:ffd6818a3975
203 204 user: test
204 205 date: Thu Jan 01 00:00:02 1970 +0000
205 206 summary: b3
206 207
207 208
208 209 back to the original dir
209 210 $ cd ../rebase
210 211
211 212 rollback the transplant
212 213 $ hg rollback
213 214 repository tip rolled back to revision 4 (undo transplant)
214 215 working directory now based on revision 1
215 216 $ hg tip -q
216 217 4:a53251cdf717
217 218 $ hg parents -q
218 219 1:d11e3596cc1a
219 220 $ hg status
220 221 ? b1
221 222 ? b2
222 223 ? b3
223 224
224 225 $ hg clone ../t ../prune
225 226 updating to branch default
226 227 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 228 $ cd ../prune
228 229
229 230 $ hg up -C 1
230 231 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
231 232
232 233 rebase b onto r1, skipping b2
233 234
234 235 $ hg transplant -a -b tip -p 3
235 236 applying 37a1297eb21b
236 237 37a1297eb21b transplanted to e234d668f844
237 238 applying a53251cdf717
238 239 a53251cdf717 transplanted to 7275fda4d04f
239 240 $ hg log --template '{rev} {parents} {desc}\n'
240 241 6 b3
241 242 5 1:d11e3596cc1a b1
242 243 4 b3
243 244 3 b2
244 245 2 0:17ab29e464c6 b1
245 246 1 r2
246 247 0 r1
247 248
248 249 test same-parent transplant with --log
249 250
250 251 $ hg clone -r 1 ../t ../sameparent
251 252 adding changesets
252 253 adding manifests
253 254 adding file changes
254 255 added 2 changesets with 2 changes to 2 files
255 256 updating to branch default
256 257 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
257 258 $ cd ../sameparent
258 259 $ hg transplant --log -s ../prune 5
259 260 searching for changes
260 261 applying e234d668f844
261 262 e234d668f844 transplanted to e07aea8ecf9c
262 263 $ hg log --template '{rev} {parents} {desc}\n'
263 264 2 b1
264 265 (transplanted from e234d668f844e1b1a765f01db83a32c0c7bfa170)
265 266 1 r2
266 267 0 r1
267 268 remote transplant, and also test that transplant doesn't break with
268 269 format-breaking diffopts
269 270
270 271 $ hg clone -r 1 ../t ../remote
271 272 adding changesets
272 273 adding manifests
273 274 adding file changes
274 275 added 2 changesets with 2 changes to 2 files
275 276 updating to branch default
276 277 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 278 $ cd ../remote
278 279 $ hg --config diff.noprefix=True transplant --log -s ../t 2 4
279 280 searching for changes
280 281 applying 37a1297eb21b
281 282 37a1297eb21b transplanted to c19cf0ccb069
282 283 applying a53251cdf717
283 284 a53251cdf717 transplanted to f7fe5bf98525
284 285 $ hg log --template '{rev} {parents} {desc}\n'
285 286 3 b3
286 287 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
287 288 2 b1
288 289 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
289 290 1 r2
290 291 0 r1
291 292
292 293 skip previous transplants
293 294
294 295 $ hg transplant -s ../t -a -b 4
295 296 searching for changes
296 297 applying 722f4667af76
297 298 722f4667af76 transplanted to 47156cd86c0b
298 299 $ hg log --template '{rev} {parents} {desc}\n'
299 300 4 b2
300 301 3 b3
301 302 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
302 303 2 b1
303 304 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
304 305 1 r2
305 306 0 r1
306 307
307 308 skip local changes transplanted to the source
308 309
309 310 $ echo b4 > b4
310 311 $ hg ci -Amb4 -d '3 0'
311 312 adding b4
312 313 $ hg clone ../t ../pullback
313 314 updating to branch default
314 315 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
315 316 $ cd ../pullback
316 317 $ hg transplant -s ../remote -a -b tip
317 318 searching for changes
318 319 applying 4333daefcb15
319 320 4333daefcb15 transplanted to 5f42c04e07cc
320 321
321 322
322 323 remote transplant with pull
323 324
324 325 $ hg serve -R ../t -p $HGPORT -d --pid-file=../t.pid
325 326 $ cat ../t.pid >> $DAEMON_PIDS
326 327
327 328 $ hg clone -r 0 ../t ../rp
328 329 adding changesets
329 330 adding manifests
330 331 adding file changes
331 332 added 1 changesets with 1 changes to 1 files
332 333 updating to branch default
333 334 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
334 335 $ cd ../rp
335 336 $ hg transplant -s http://localhost:$HGPORT/ 37a1297eb21b a53251cdf717
336 337 searching for changes
337 338 searching for changes
338 339 adding changesets
339 340 adding manifests
340 341 adding file changes
341 342 added 1 changesets with 1 changes to 1 files
342 343 applying a53251cdf717
343 344 a53251cdf717 transplanted to 8d9279348abb
344 345 $ hg log --template '{rev} {parents} {desc}\n'
345 346 2 b3
346 347 1 b1
347 348 0 r1
348 349
349 350 remote transplant without pull
350 351 (It was using "2" and "4" (as the previous transplant used to) which referenced
351 352 revision different from one run to another)
352 353
353 354 $ hg pull -q http://localhost:$HGPORT/
354 355 $ hg transplant -s http://localhost:$HGPORT/ 8d9279348abb 722f4667af76
355 356 skipping already applied revision 2:8d9279348abb
356 357 applying 722f4667af76
357 358 722f4667af76 transplanted to 76e321915884
358 359
359 360 transplant --continue
360 361
361 362 $ hg init ../tc
362 363 $ cd ../tc
363 364 $ cat <<EOF > foo
364 365 > foo
365 366 > bar
366 367 > baz
367 368 > EOF
368 369 $ echo toremove > toremove
369 370 $ echo baz > baz
370 371 $ hg ci -Amfoo
371 372 adding baz
372 373 adding foo
373 374 adding toremove
374 375 $ cat <<EOF > foo
375 376 > foo2
376 377 > bar2
377 378 > baz2
378 379 > EOF
379 380 $ rm toremove
380 381 $ echo added > added
381 382 $ hg ci -Amfoo2
382 383 adding added
383 384 removing toremove
384 385 $ echo bar > bar
385 386 $ cat > baz <<EOF
386 387 > before baz
387 388 > baz
388 389 > after baz
389 390 > EOF
390 391 $ hg ci -Ambar
391 392 adding bar
392 393 $ echo bar2 >> bar
393 394 $ hg ci -mbar2
394 395 $ hg up 0
395 396 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
396 397 $ echo foobar > foo
397 398 $ hg ci -mfoobar
398 399 created new head
399 400 $ hg transplant 1:3
400 401 applying 46ae92138f3c
401 402 patching file foo
402 403 Hunk #1 FAILED at 0
403 404 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
404 405 patch failed to apply
405 406 abort: fix up the working directory and run hg transplant --continue
406 407 [255]
407 408
408 409 transplant -c shouldn't use an old changeset
409 410
410 411 $ hg up -C
411 412 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
412 413 1 other heads for branch "default"
413 414 $ rm added
414 415 $ hg transplant --continue
415 416 abort: no transplant to continue
416 417 [255]
417 418 $ hg transplant 1
418 419 applying 46ae92138f3c
419 420 patching file foo
420 421 Hunk #1 FAILED at 0
421 422 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
422 423 patch failed to apply
423 424 abort: fix up the working directory and run hg transplant --continue
424 425 [255]
425 426 $ cp .hg/transplant/journal .hg/transplant/journal.orig
426 427 $ cat .hg/transplant/journal
427 428 # User test
428 429 # Date 0 0
429 430 # Node ID 46ae92138f3ce0249f6789650403286ead052b6d
430 431 # Parent e8643552fde58f57515e19c4b373a57c96e62af3
431 432 foo2
432 433 $ grep -v 'Date' .hg/transplant/journal.orig > .hg/transplant/journal
433 434 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
434 435 abort: filter corrupted changeset (no user or date)
435 436 [255]
436 437 $ cp .hg/transplant/journal.orig .hg/transplant/journal
437 438 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
438 439 HGEDITFORM=transplant.normal
439 440 46ae92138f3c transplanted as 9159dada197d
440 441 $ hg transplant 1:3
441 442 skipping already applied revision 1:46ae92138f3c
442 443 applying 9d6d6b5a8275
443 444 9d6d6b5a8275 transplanted to 2d17a10c922f
444 445 applying 1dab759070cf
445 446 1dab759070cf transplanted to e06a69927eb0
446 447 $ hg locate
447 448 added
448 449 bar
449 450 baz
450 451 foo
451 452
452 453 test multiple revisions and --continue
453 454
454 455 $ hg up -qC 0
455 456 $ echo bazbaz > baz
456 457 $ hg ci -Am anotherbaz baz
457 458 created new head
458 459 $ hg transplant 1:3
459 460 applying 46ae92138f3c
460 461 46ae92138f3c transplanted to 1024233ea0ba
461 462 applying 9d6d6b5a8275
462 463 patching file baz
463 464 Hunk #1 FAILED at 0
464 465 1 out of 1 hunks FAILED -- saving rejects to file baz.rej
465 466 patch failed to apply
466 467 abort: fix up the working directory and run hg transplant --continue
467 468 [255]
468 469 $ hg transplant 1:3
469 470 abort: transplant in progress
470 471 (use 'hg transplant --continue' or 'hg update' to abort)
471 472 [255]
472 473 $ echo fixed > baz
473 474 $ hg transplant --continue
474 475 9d6d6b5a8275 transplanted as d80c49962290
475 476 applying 1dab759070cf
476 477 1dab759070cf transplanted to aa0ffe6bd5ae
477 478
478 479 $ cd ..
479 480
480 481 Issue1111: Test transplant --merge
481 482
482 483 $ hg init t1111
483 484 $ cd t1111
484 485 $ echo a > a
485 486 $ hg ci -Am adda
486 487 adding a
487 488 $ echo b >> a
488 489 $ hg ci -m appendb
489 490 $ echo c >> a
490 491 $ hg ci -m appendc
491 492 $ hg up -C 0
492 493 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
493 494 $ echo d >> a
494 495 $ hg ci -m appendd
495 496 created new head
496 497
497 498 transplant
498 499
499 500 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant -m 1 -e
500 501 applying 42dc4432fd35
501 502 HGEDITFORM=transplant.merge
502 503 1:42dc4432fd35 merged at a9f4acbac129
503 504 $ hg update -q -C 2
504 505 $ cat > a <<EOF
505 506 > x
506 507 > y
507 508 > z
508 509 > EOF
509 510 $ hg commit -m replace
510 511 $ hg update -q -C 4
511 512 $ hg transplant -m 5
512 513 applying 600a3cdcb41d
513 514 patching file a
514 515 Hunk #1 FAILED at 0
515 516 1 out of 1 hunks FAILED -- saving rejects to file a.rej
516 517 patch failed to apply
517 518 abort: fix up the working directory and run hg transplant --continue
518 519 [255]
519 520 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
520 521 HGEDITFORM=transplant.merge
521 522 600a3cdcb41d transplanted as a3f88be652e0
522 523
523 524 $ cd ..
524 525
525 526 test transplant into empty repository
526 527
527 528 $ hg init empty
528 529 $ cd empty
529 530 $ hg transplant -s ../t -b tip -a
530 531 adding changesets
531 532 adding manifests
532 533 adding file changes
533 534 added 4 changesets with 4 changes to 4 files
534 535
535 536 test "--merge" causing pull from source repository on local host
536 537
537 538 $ hg --config extensions.mq= -q strip 2
538 539 $ hg transplant -s ../t --merge tip
539 540 searching for changes
540 541 searching for changes
541 542 adding changesets
542 543 adding manifests
543 544 adding file changes
544 545 added 2 changesets with 2 changes to 2 files
545 546 applying a53251cdf717
546 547 4:a53251cdf717 merged at 4831f4dc831a
547 548
548 549 test interactive transplant
549 550
550 551 $ hg --config extensions.strip= -q strip 0
551 552 $ hg -R ../t log -G --template "{rev}:{node|short}"
552 553 @ 4:a53251cdf717
553 554 |
554 555 o 3:722f4667af76
555 556 |
556 557 o 2:37a1297eb21b
557 558 |
558 559 | o 1:d11e3596cc1a
559 560 |/
560 561 o 0:17ab29e464c6
561 562
562 563 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
563 564 > ?
564 565 > x
565 566 > q
566 567 > EOF
567 568 0:17ab29e464c6
568 569 apply changeset? [ynmpcq?]: ?
569 570 y: yes, transplant this changeset
570 571 n: no, skip this changeset
571 572 m: merge at this changeset
572 573 p: show patch
573 574 c: commit selected changesets
574 575 q: quit and cancel transplant
575 576 ?: ? (show this help)
576 577 apply changeset? [ynmpcq?]: x
577 578 unrecognized response
578 579 apply changeset? [ynmpcq?]: q
579 580 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
580 581 > p
581 582 > y
582 583 > n
583 584 > n
584 585 > m
585 586 > c
586 587 > EOF
587 588 0:17ab29e464c6
588 589 apply changeset? [ynmpcq?]: p
589 590 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
590 591 +++ b/r1 Thu Jan 01 00:00:00 1970 +0000
591 592 @@ -0,0 +1,1 @@
592 593 +r1
593 594 apply changeset? [ynmpcq?]: y
594 595 1:d11e3596cc1a
595 596 apply changeset? [ynmpcq?]: n
596 597 2:37a1297eb21b
597 598 apply changeset? [ynmpcq?]: n
598 599 3:722f4667af76
599 600 apply changeset? [ynmpcq?]: m
600 601 4:a53251cdf717
601 602 apply changeset? [ynmpcq?]: c
602 603 $ hg log -G --template "{node|short}"
603 604 @ 88be5dde5260
604 605 |\
605 606 | o 722f4667af76
606 607 | |
607 608 | o 37a1297eb21b
608 609 |/
609 610 o 17ab29e464c6
610 611
611 612 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
612 613 > x
613 614 > ?
614 615 > y
615 616 > q
616 617 > EOF
617 618 1:d11e3596cc1a
618 619 apply changeset? [ynmpcq?]: x
619 620 unrecognized response
620 621 apply changeset? [ynmpcq?]: ?
621 622 y: yes, transplant this changeset
622 623 n: no, skip this changeset
623 624 m: merge at this changeset
624 625 p: show patch
625 626 c: commit selected changesets
626 627 q: quit and cancel transplant
627 628 ?: ? (show this help)
628 629 apply changeset? [ynmpcq?]: y
629 630 4:a53251cdf717
630 631 apply changeset? [ynmpcq?]: q
631 632 $ hg heads --template "{node|short}\n"
632 633 88be5dde5260
633 634
634 635 $ cd ..
635 636
636 637
637 638 #if unix-permissions system-sh
638 639
639 640 test filter
640 641
641 642 $ hg init filter
642 643 $ cd filter
643 644 $ cat <<'EOF' >test-filter
644 645 > #!/bin/sh
645 646 > sed 's/r1/r2/' $1 > $1.new
646 647 > mv $1.new $1
647 648 > EOF
648 649 $ chmod +x test-filter
649 650 $ hg transplant -s ../t -b tip -a --filter ./test-filter
650 651 filtering * (glob)
651 652 applying 17ab29e464c6
652 653 17ab29e464c6 transplanted to e9ffc54ea104
653 654 filtering * (glob)
654 655 applying 37a1297eb21b
655 656 37a1297eb21b transplanted to 348b36d0b6a5
656 657 filtering * (glob)
657 658 applying 722f4667af76
658 659 722f4667af76 transplanted to 0aa6979afb95
659 660 filtering * (glob)
660 661 applying a53251cdf717
661 662 a53251cdf717 transplanted to 14f8512272b5
662 663 $ hg log --template '{rev} {parents} {desc}\n'
663 664 3 b3
664 665 2 b2
665 666 1 b1
666 667 0 r2
667 668 $ cd ..
668 669
669 670
670 671 test filter with failed patch
671 672
672 673 $ cd filter
673 674 $ hg up 0
674 675 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
675 676 $ echo foo > b1
676 677 $ hg ci -Am foo
677 678 adding b1
678 679 adding test-filter
679 680 created new head
680 681 $ hg transplant 1 --filter ./test-filter
681 682 filtering * (glob)
682 683 applying 348b36d0b6a5
683 684 file b1 already exists
684 685 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
685 686 patch failed to apply
686 687 abort: fix up the working directory and run hg transplant --continue
687 688 [255]
688 689 $ cd ..
689 690
690 691 test environment passed to filter
691 692
692 693 $ hg init filter-environment
693 694 $ cd filter-environment
694 695 $ cat <<'EOF' >test-filter-environment
695 696 > #!/bin/sh
696 697 > echo "Transplant by $HGUSER" >> $1
697 698 > echo "Transplant from rev $HGREVISION" >> $1
698 699 > EOF
699 700 $ chmod +x test-filter-environment
700 701 $ hg transplant -s ../t --filter ./test-filter-environment 0
701 702 filtering * (glob)
702 703 applying 17ab29e464c6
703 704 17ab29e464c6 transplanted to 5190e68026a0
704 705
705 706 $ hg log --template '{rev} {parents} {desc}\n'
706 707 0 r1
707 708 Transplant by test
708 709 Transplant from rev 17ab29e464c6ca53e329470efe2a9918ac617a6f
709 710 $ cd ..
710 711
711 712 test transplant with filter handles invalid changelog
712 713
713 714 $ hg init filter-invalid-log
714 715 $ cd filter-invalid-log
715 716 $ cat <<'EOF' >test-filter-invalid-log
716 717 > #!/bin/sh
717 718 > echo "" > $1
718 719 > EOF
719 720 $ chmod +x test-filter-invalid-log
720 721 $ hg transplant -s ../t --filter ./test-filter-invalid-log 0
721 722 filtering * (glob)
722 723 abort: filter corrupted changeset (no user or date)
723 724 [255]
724 725 $ cd ..
725 726
726 727 #endif
727 728
728 729
729 730 test with a win32ext like setup (differing EOLs)
730 731
731 732 $ hg init twin1
732 733 $ cd twin1
733 734 $ echo a > a
734 735 $ echo b > b
735 736 $ echo b >> b
736 737 $ hg ci -Am t
737 738 adding a
738 739 adding b
739 740 $ echo a > b
740 741 $ echo b >> b
741 742 $ hg ci -m changeb
742 743 $ cd ..
743 744
744 745 $ hg init twin2
745 746 $ cd twin2
746 747 $ echo '[patch]' >> .hg/hgrc
747 748 $ echo 'eol = crlf' >> .hg/hgrc
748 749 $ $PYTHON -c "file('b', 'wb').write('b\r\nb\r\n')"
749 750 $ hg ci -Am addb
750 751 adding b
751 752 $ hg transplant -s ../twin1 tip
752 753 searching for changes
753 754 warning: repository is unrelated
754 755 applying 2e849d776c17
755 756 2e849d776c17 transplanted to 8e65bebc063e
756 757 $ cat b
757 758 a\r (esc)
758 759 b\r (esc)
759 760 $ cd ..
760 761
761 762 test transplant with merge changeset is skipped
762 763
763 764 $ hg init merge1a
764 765 $ cd merge1a
765 766 $ echo a > a
766 767 $ hg ci -Am a
767 768 adding a
768 769 $ hg branch b
769 770 marked working directory as branch b
770 771 (branches are permanent and global, did you want a bookmark?)
771 772 $ hg ci -m branchb
772 773 $ echo b > b
773 774 $ hg ci -Am b
774 775 adding b
775 776 $ hg update default
776 777 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
777 778 $ hg merge b
778 779 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
779 780 (branch merge, don't forget to commit)
780 781 $ hg ci -m mergeb
781 782 $ cd ..
782 783
783 784 $ hg init merge1b
784 785 $ cd merge1b
785 786 $ hg transplant -s ../merge1a tip
786 787 $ cd ..
787 788
788 789 test transplant with merge changeset accepts --parent
789 790
790 791 $ hg init merge2a
791 792 $ cd merge2a
792 793 $ echo a > a
793 794 $ hg ci -Am a
794 795 adding a
795 796 $ hg branch b
796 797 marked working directory as branch b
797 798 (branches are permanent and global, did you want a bookmark?)
798 799 $ hg ci -m branchb
799 800 $ echo b > b
800 801 $ hg ci -Am b
801 802 adding b
802 803 $ hg update default
803 804 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
804 805 $ hg merge b
805 806 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
806 807 (branch merge, don't forget to commit)
807 808 $ hg ci -m mergeb
808 809 $ cd ..
809 810
810 811 $ hg init merge2b
811 812 $ cd merge2b
812 813 $ hg transplant -s ../merge2a --parent tip tip
813 814 abort: be9f9b39483f is not a parent of be9f9b39483f
814 815 [255]
815 816 $ hg transplant -s ../merge2a --parent 0 tip
816 817 applying be9f9b39483f
817 818 be9f9b39483f transplanted to 9959e51f94d1
818 819 $ cd ..
819 820
820 821 test transplanting a patch turning into a no-op
821 822
822 823 $ hg init binarysource
823 824 $ cd binarysource
824 825 $ echo a > a
825 826 $ hg ci -Am adda a
826 827 >>> file('b', 'wb').write('\0b1')
827 828 $ hg ci -Am addb b
828 829 >>> file('b', 'wb').write('\0b2')
829 830 $ hg ci -m changeb b
830 831 $ cd ..
831 832
832 833 $ hg clone -r0 binarysource binarydest
833 834 adding changesets
834 835 adding manifests
835 836 adding file changes
836 837 added 1 changesets with 1 changes to 1 files
837 838 updating to branch default
838 839 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
839 840 $ cd binarydest
840 841 $ cp ../binarysource/b b
841 842 $ hg ci -Am addb2 b
842 843 $ hg transplant -s ../binarysource 2
843 844 searching for changes
844 845 applying 7a7d57e15850
845 846 skipping emptied changeset 7a7d57e15850
846 847
847 848 Test empty result in --continue
848 849
849 850 $ hg transplant -s ../binarysource 1
850 851 searching for changes
851 852 applying 645035761929
852 853 file b already exists
853 854 1 out of 1 hunks FAILED -- saving rejects to file b.rej
854 855 patch failed to apply
855 856 abort: fix up the working directory and run hg transplant --continue
856 857 [255]
857 858 $ hg status
858 859 ? b.rej
859 860 $ hg transplant --continue
860 861 645035761929 skipped due to empty diff
861 862
862 863 $ cd ..
863 864
864 865 Explicitly kill daemons to let the test exit on Windows
865 866
866 867 $ killdaemons.py
867 868
868 869 Test that patch-ed files are treated as "modified", when transplant is
869 870 aborted by failure of patching, even if none of mode, size and
870 871 timestamp of them isn't changed on the filesystem (see also issue4583)
871 872
872 873 $ cd t
873 874
874 875 $ cat > $TESTTMP/abort.py <<EOF
875 876 > # emulate that patch.patch() is aborted at patching on "abort" file
876 877 > from mercurial import extensions, patch as patchmod
877 878 > def patch(orig, ui, repo, patchname,
878 879 > strip=1, prefix='', files=None,
879 880 > eolmode='strict', similarity=0):
880 881 > if files is None:
881 882 > files = set()
882 883 > r = orig(ui, repo, patchname,
883 884 > strip=strip, prefix=prefix, files=files,
884 885 > eolmode=eolmode, similarity=similarity)
885 886 > if 'abort' in files:
886 887 > raise patchmod.PatchError('intentional error while patching')
887 888 > return r
888 889 > def extsetup(ui):
889 890 > extensions.wrapfunction(patchmod, 'patch', patch)
890 891 > EOF
891 892
892 893 $ echo X1 > r1
893 894 $ hg diff --nodates r1
894 895 diff -r a53251cdf717 r1
895 896 --- a/r1
896 897 +++ b/r1
897 898 @@ -1,1 +1,1 @@
898 899 -r1
899 900 +X1
900 901 $ hg commit -m "X1 as r1"
901 902
902 903 $ echo 'marking to abort patching' > abort
903 904 $ hg add abort
904 905 $ echo Y1 > r1
905 906 $ hg diff --nodates r1
906 907 diff -r 22c515968f13 r1
907 908 --- a/r1
908 909 +++ b/r1
909 910 @@ -1,1 +1,1 @@
910 911 -X1
911 912 +Y1
912 913 $ hg commit -m "Y1 as r1"
913 914
914 915 $ hg update -q -C d11e3596cc1a
915 916 $ cat r1
916 917 r1
917 918
918 919 $ cat >> .hg/hgrc <<EOF
919 920 > [fakedirstatewritetime]
920 921 > # emulate invoking dirstate.write() via repo.status() or markcommitted()
921 922 > # at 2000-01-01 00:00
922 923 > fakenow = 200001010000
923 924 >
924 925 > # emulate invoking patch.internalpatch() at 2000-01-01 00:00
925 926 > [fakepatchtime]
926 927 > fakenow = 200001010000
927 928 >
928 929 > [extensions]
929 930 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
930 931 > fakepatchtime = $TESTDIR/fakepatchtime.py
931 932 > abort = $TESTTMP/abort.py
932 933 > EOF
933 934 $ hg transplant "22c515968f13::"
934 935 applying 22c515968f13
935 936 22c515968f13 transplanted to * (glob)
936 937 applying e38700ba9dd3
937 938 intentional error while patching
938 939 abort: fix up the working directory and run hg transplant --continue
939 940 [255]
940 941 $ cat >> .hg/hgrc <<EOF
941 942 > [hooks]
942 943 > fakedirstatewritetime = !
943 944 > fakepatchtime = !
944 945 > [extensions]
945 946 > abort = !
946 947 > EOF
947 948
948 949 $ cat r1
949 950 Y1
950 951 $ hg debugstate | grep ' r1$'
951 952 n 644 3 unset r1
952 953 $ hg status -A r1
953 954 M r1
954 955
955 956 Test that rollback by unexpected failure after transplanting the first
956 957 revision restores dirstate correctly.
957 958
958 959 $ hg rollback -q
959 960 $ rm -f abort
960 961 $ hg update -q -C d11e3596cc1a
961 962 $ hg parents -T "{node|short}\n"
962 963 d11e3596cc1a
963 964 $ hg status -A
964 965 C r1
965 966 C r2
966 967
967 968 $ cat >> .hg/hgrc <<EOF
968 969 > [hooks]
969 970 > # emulate failure at transplanting the 2nd revision
970 971 > pretxncommit.abort = test ! -f abort
971 972 > EOF
972 973 $ hg transplant "22c515968f13::"
973 974 applying 22c515968f13
974 975 22c515968f13 transplanted to * (glob)
975 976 applying e38700ba9dd3
976 977 transaction abort!
977 978 rollback completed
978 979 abort: pretxncommit.abort hook exited with status 1
979 980 [255]
980 981 $ cat >> .hg/hgrc <<EOF
981 982 > [hooks]
982 983 > pretxncommit.abort = !
983 984 > EOF
984 985
985 986 $ hg parents -T "{node|short}\n"
986 987 d11e3596cc1a
987 988 $ hg status -A
988 989 M r1
989 990 ? abort
990 991 C r2
991 992
992 993 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now