##// 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 # this is kept only to reduce changes in a patch.
412 # this is kept only to reduce changes in a patch.
413 pass
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 def readseries(self):
426 def readseries(self):
416 nodes = []
427 nodes = []
417 merges = []
428 merges = []
@@ -559,6 +570,7 b' def browserevs(ui, repo, nodes, opts):'
559 _('parent to choose when transplanting merge'), _('REV')),
570 _('parent to choose when transplanting merge'), _('REV')),
560 ('e', 'edit', False, _('invoke editor on commit messages')),
571 ('e', 'edit', False, _('invoke editor on commit messages')),
561 ('', 'log', None, _('append transplant info to log message')),
572 ('', 'log', None, _('append transplant info to log message')),
573 ('', 'stop', False, _('stop interrupted transplant')),
562 ('c', 'continue', None, _('continue last transplant session '
574 ('c', 'continue', None, _('continue last transplant session '
563 'after fixing conflicts')),
575 'after fixing conflicts')),
564 ('', 'filter', '',
576 ('', 'filter', '',
@@ -646,6 +658,11 b' def _dotransplant(ui, repo, *revs, **opt'
646 raise error.Abort(_('--continue is incompatible with '
658 raise error.Abort(_('--continue is incompatible with '
647 '--branch, --all and --merge'))
659 '--branch, --all and --merge'))
648 return
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 if not (opts.get('source') or revs or
666 if not (opts.get('source') or revs or
650 opts.get('merge') or opts.get('branch')):
667 opts.get('merge') or opts.get('branch')):
651 raise error.Abort(_('no source URL, branch revision, or revision '
668 raise error.Abort(_('no source URL, branch revision, or revision '
@@ -676,6 +693,10 b' def _dotransplant(ui, repo, *revs, **opt'
676 if not tp.canresume():
693 if not tp.canresume():
677 raise error.Abort(_('no transplant to continue'))
694 raise error.Abort(_('no transplant to continue'))
678 else:
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 cmdutil.checkunfinished(repo)
700 cmdutil.checkunfinished(repo)
680 cmdutil.bailifchanged(repo)
701 cmdutil.bailifchanged(repo)
681
702
@@ -769,8 +790,8 b' def extsetup(ui):'
769 'transplant', fname='transplant/journal', clearable=True,
790 'transplant', fname='transplant/journal', clearable=True,
770 continuefunc=continuecmd,
791 continuefunc=continuecmd,
771 statushint=_('To continue: hg transplant --continue\n'
792 statushint=_('To continue: hg transplant --continue\n'
772 'To abort: hg update'),
793 'To stop: hg transplant --stop'),
773 cmdhint=_("use 'hg transplant --continue' or 'hg update' to abort")
794 cmdhint=_("use 'hg transplant --continue' or 'hg transplant --stop'")
774 )
795 )
775
796
776 # tell hggettext to extract docstrings from these functions:
797 # tell hggettext to extract docstrings from these functions:
@@ -2,6 +2,7 b''
2 $ cat <<EOF >> $HGRCPATH
2 $ cat <<EOF >> $HGRCPATH
3 > [extensions]
3 > [extensions]
4 > transplant=
4 > transplant=
5 > graphlog=
5 > EOF
6 > EOF
6
7
7 #if continueflag
8 #if continueflag
@@ -19,6 +20,9 b''
19 $ hg transplant --continue --all
20 $ hg transplant --continue --all
20 abort: --continue is incompatible with --branch, --all and --merge
21 abort: --continue is incompatible with --branch, --all and --merge
21 [255]
22 [255]
23 $ hg transplant --stop --all
24 abort: --stop is incompatible with --branch, --all and --merge
25 [255]
22 $ hg transplant --all tip
26 $ hg transplant --all tip
23 abort: --all requires a branch revision
27 abort: --all requires a branch revision
24 [255]
28 [255]
@@ -376,7 +380,8 b' revision different from one run to anoth'
376 applying 722f4667af76
380 applying 722f4667af76
377 722f4667af76 transplanted to 76e321915884
381 722f4667af76 transplanted to 76e321915884
378
382
379 transplant --continue
383
384 transplant --continue and --stop behaviour
380
385
381 $ hg init ../tc
386 $ hg init ../tc
382 $ cd ../tc
387 $ cd ../tc
@@ -416,6 +421,36 b' transplant --continue'
416 $ echo foobar > foo
421 $ echo foobar > foo
417 $ hg ci -mfoobar
422 $ hg ci -mfoobar
418 created new head
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 $ hg transplant 1:3
454 $ hg transplant 1:3
420 applying 46ae92138f3c
455 applying 46ae92138f3c
421 patching file foo
456 patching file foo
@@ -425,6 +460,49 b' transplant --continue'
425 abort: fix up the working directory and run hg transplant --continue
460 abort: fix up the working directory and run hg transplant --continue
426 [255]
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 transplant -c shouldn't use an old changeset
506 transplant -c shouldn't use an old changeset
429
507
430 $ hg up -C
508 $ hg up -C
@@ -436,6 +514,9 b" transplant -c shouldn't use an old chang"
436 abort: no transplant to continue (continueflag !)
514 abort: no transplant to continue (continueflag !)
437 abort: no operation in progress (no-continueflag !)
515 abort: no operation in progress (no-continueflag !)
438 [255]
516 [255]
517 $ hg transplant --stop
518 abort: no interrupted transplant found
519 [255]
439 $ hg transplant 1
520 $ hg transplant 1
440 applying 46ae92138f3c
521 applying 46ae92138f3c
441 patching file foo
522 patching file foo
@@ -489,23 +570,23 b' test multiple revisions, --continue and '
489 [255]
570 [255]
490 $ hg transplant 1:3
571 $ hg transplant 1:3
491 abort: transplant in progress
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 [255]
574 [255]
494 $ hg status -v
575 $ hg status -v
495 A bar
576 A bar
577 ? added.rej
496 ? baz.rej
578 ? baz.rej
497 ? foo.rej
579 ? foo.rej
498 # The repository is in an unfinished *transplant* state.
580 # The repository is in an unfinished *transplant* state.
499
581
500 # To continue: hg transplant --continue
582 # To continue: hg transplant --continue
501 # To abort: hg update
583 # To stop: hg transplant --stop
502
584
503 $ echo fixed > baz
585 $ echo fixed > baz
504 $ hg continue
586 $ hg continue
505 9d6d6b5a8275 transplanted as d80c49962290
587 9d6d6b5a8275 transplanted as d80c49962290
506 applying 1dab759070cf
588 applying 1dab759070cf
507 1dab759070cf transplanted to aa0ffe6bd5ae
589 1dab759070cf transplanted to aa0ffe6bd5ae
508
509 $ cd ..
590 $ cd ..
510
591
511 Issue1111: Test transplant --merge
592 Issue1111: Test transplant --merge
General Comments 0
You need to be logged in to leave comments. Login now