##// END OF EJS Templates
transplant: added support for --stop flag...
Taapas Agrawal -
r43007:f6a4db4b default draft
parent child Browse files
Show More
@@ -412,6 +412,17 b' class transplanter(object):'
412 412 # this is kept only to reduce changes in a patch.
413 413 pass
414 414
415 def stop(self, ui, repo):
416 """logic to stop an interrupted transplant"""
417 if self.canresume():
418 startctx = repo['.']
419 hg.updaterepo(repo, startctx.node(), overwrite=True)
420 ui.status(_("stopped the interrupted transplant\n"))
421 ui.status(_("working directory is now at %s\n") %
422 startctx.hex()[:12])
423 self.unlog()
424 return 0
425
415 426 def readseries(self):
416 427 nodes = []
417 428 merges = []
@@ -559,6 +570,7 b' def browserevs(ui, repo, nodes, opts):'
559 570 _('parent to choose when transplanting merge'), _('REV')),
560 571 ('e', 'edit', False, _('invoke editor on commit messages')),
561 572 ('', 'log', None, _('append transplant info to log message')),
573 ('', 'stop', False, _('stop interrupted transplant')),
562 574 ('c', 'continue', None, _('continue last transplant session '
563 575 'after fixing conflicts')),
564 576 ('', 'filter', '',
@@ -646,6 +658,11 b' def _dotransplant(ui, repo, *revs, **opt'
646 658 raise error.Abort(_('--continue is incompatible with '
647 659 '--branch, --all and --merge'))
648 660 return
661 if opts.get('stop'):
662 if opts.get('branch') or opts.get('all') or opts.get('merge'):
663 raise error.Abort(_('--stop is incompatible with '
664 '--branch, --all and --merge'))
665 return
649 666 if not (opts.get('source') or revs or
650 667 opts.get('merge') or opts.get('branch')):
651 668 raise error.Abort(_('no source URL, branch revision, or revision '
@@ -676,6 +693,10 b' def _dotransplant(ui, repo, *revs, **opt'
676 693 if not tp.canresume():
677 694 raise error.Abort(_('no transplant to continue'))
678 695 else:
696 if opts.get('stop'):
697 if not tp.canresume():
698 raise error.Abort(_('no interrupted transplant found'))
699 return tp.stop(ui, repo)
679 700 cmdutil.checkunfinished(repo)
680 701 cmdutil.bailifchanged(repo)
681 702
@@ -769,8 +790,8 b' def extsetup(ui):'
769 790 'transplant', fname='transplant/journal', clearable=True,
770 791 continuefunc=continuecmd,
771 792 statushint=_('To continue: hg transplant --continue\n'
772 'To abort: hg update'),
773 cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort")
793 'To stop: hg transplant --stop'),
794 cmdhint=_("use 'hg transplant --continue' or 'hg transplant --stop'")
774 795 )
775 796
776 797 # tell hggettext to extract docstrings from these functions:
@@ -2,6 +2,7 b''
2 2 $ cat <<EOF >> $HGRCPATH
3 3 > [extensions]
4 4 > transplant=
5 > graphlog=
5 6 > EOF
6 7
7 8 #if continueflag
@@ -19,6 +20,9 b''
19 20 $ hg transplant --continue --all
20 21 abort: --continue is incompatible with --branch, --all and --merge
21 22 [255]
23 $ hg transplant --stop --all
24 abort: --stop is incompatible with --branch, --all and --merge
25 [255]
22 26 $ hg transplant --all tip
23 27 abort: --all requires a branch revision
24 28 [255]
@@ -376,7 +380,8 b' revision different from one run to anoth'
376 380 applying 722f4667af76
377 381 722f4667af76 transplanted to 76e321915884
378 382
379 transplant --continue
383
384 transplant --continue and --stop behaviour
380 385
381 386 $ hg init ../tc
382 387 $ cd ../tc
@@ -416,6 +421,36 b' transplant --continue'
416 421 $ echo foobar > foo
417 422 $ hg ci -mfoobar
418 423 created new head
424
425 Repo log before transplant
426 $ hg glog
427 @ changeset: 4:e8643552fde5
428 | tag: tip
429 | parent: 0:493149fa1541
430 | user: test
431 | date: Thu Jan 01 00:00:00 1970 +0000
432 | summary: foobar
433 |
434 | o changeset: 3:1dab759070cf
435 | | user: test
436 | | date: Thu Jan 01 00:00:00 1970 +0000
437 | | summary: bar2
438 | |
439 | o changeset: 2:9d6d6b5a8275
440 | | user: test
441 | | date: Thu Jan 01 00:00:00 1970 +0000
442 | | summary: bar
443 | |
444 | o changeset: 1:46ae92138f3c
445 |/ user: test
446 | date: Thu Jan 01 00:00:00 1970 +0000
447 | summary: foo2
448 |
449 o changeset: 0:493149fa1541
450 user: test
451 date: Thu Jan 01 00:00:00 1970 +0000
452 summary: foo
453
419 454 $ hg transplant 1:3
420 455 applying 46ae92138f3c
421 456 patching file foo
@@ -425,6 +460,49 b' transplant --continue'
425 460 abort: fix up the working directory and run hg transplant --continue
426 461 [255]
427 462
463 $ hg transplant --stop
464 stopped the interrupted transplant
465 working directory is now at e8643552fde5
466 Repo log after abort
467 $ hg glog
468 @ changeset: 4:e8643552fde5
469 | tag: tip
470 | parent: 0:493149fa1541
471 | user: test
472 | date: Thu Jan 01 00:00:00 1970 +0000
473 | summary: foobar
474 |
475 | o changeset: 3:1dab759070cf
476 | | user: test
477 | | date: Thu Jan 01 00:00:00 1970 +0000
478 | | summary: bar2
479 | |
480 | o changeset: 2:9d6d6b5a8275
481 | | user: test
482 | | date: Thu Jan 01 00:00:00 1970 +0000
483 | | summary: bar
484 | |
485 | o changeset: 1:46ae92138f3c
486 |/ user: test
487 | date: Thu Jan 01 00:00:00 1970 +0000
488 | summary: foo2
489 |
490 o changeset: 0:493149fa1541
491 user: test
492 date: Thu Jan 01 00:00:00 1970 +0000
493 summary: foo
494
495 $ hg transplant 1:3
496 applying 46ae92138f3c
497 file added already exists
498 1 out of 1 hunks FAILED -- saving rejects to file added.rej
499 patching file foo
500 Hunk #1 FAILED at 0
501 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
502 patch failed to apply
503 abort: fix up the working directory and run hg transplant --continue
504 [255]
505
428 506 transplant -c shouldn't use an old changeset
429 507
430 508 $ hg up -C
@@ -436,6 +514,9 b" transplant -c shouldn't use an old chang"
436 514 abort: no transplant to continue (continueflag !)
437 515 abort: no operation in progress (no-continueflag !)
438 516 [255]
517 $ hg transplant --stop
518 abort: no interrupted transplant found
519 [255]
439 520 $ hg transplant 1
440 521 applying 46ae92138f3c
441 522 patching file foo
@@ -489,23 +570,23 b' test multiple revisions, --continue and '
489 570 [255]
490 571 $ hg transplant 1:3
491 572 abort: transplant in progress
492 (use 'hg transplant --continue' or 'hg update' to abort)
573 (use 'hg transplant --continue' or 'hg transplant --stop')
493 574 [255]
494 575 $ hg status -v
495 576 A bar
577 ? added.rej
496 578 ? baz.rej
497 579 ? foo.rej
498 580 # The repository is in an unfinished *transplant* state.
499 581
500 582 # To continue: hg transplant --continue
501 # To abort: hg update
583 # To stop: hg transplant --stop
502 584
503 585 $ echo fixed > baz
504 586 $ hg continue
505 587 9d6d6b5a8275 transplanted as d80c49962290
506 588 applying 1dab759070cf
507 589 1dab759070cf transplanted to aa0ffe6bd5ae
508
509 590 $ cd ..
510 591
511 592 Issue1111: Test transplant --merge
General Comments 0
You need to be logged in to leave comments. Login now