Show More
@@ -475,12 +475,24 b' class rebaseruntime(object):' | |||||
475 | editopt = True |
|
475 | editopt = True | |
476 | editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) |
|
476 | editor = cmdutil.getcommiteditor(edit=editopt, editform=editform) | |
477 | revtoreuse = max(self.state) |
|
477 | revtoreuse = max(self.state) | |
478 | newnode = concludenode(repo, revtoreuse, p1, self.external, |
|
478 | dsguard = dirstateguard.dirstateguard(repo, 'rebase') | |
479 | commitmsg=commitmsg, |
|
479 | try: | |
480 | extrafn=_makeextrafn(self.extrafns), |
|
480 | newnode = concludenode(repo, revtoreuse, p1, self.external, | |
481 |
|
|
481 | commitmsg=commitmsg, | |
482 |
|
|
482 | extrafn=_makeextrafn(self.extrafns), | |
483 |
|
|
483 | editor=editor, | |
|
484 | keepbranches=self.keepbranchesf, | |||
|
485 | date=self.date) | |||
|
486 | dsguard.close() | |||
|
487 | release(dsguard) | |||
|
488 | except error.InterventionRequired: | |||
|
489 | dsguard.close() | |||
|
490 | release(dsguard) | |||
|
491 | raise | |||
|
492 | except Exception: | |||
|
493 | release(dsguard) | |||
|
494 | raise | |||
|
495 | ||||
484 | if newnode is None: |
|
496 | if newnode is None: | |
485 | newrev = self.target |
|
497 | newrev = self.target | |
486 | else: |
|
498 | else: | |
@@ -712,11 +724,19 b' def rebase(ui, repo, **opts):' | |||||
712 | return retcode |
|
724 | return retcode | |
713 |
|
725 | |||
714 | with repo.transaction('rebase') as tr: |
|
726 | with repo.transaction('rebase') as tr: | |
|
727 | dsguard = dirstateguard.dirstateguard(repo, 'rebase') | |||
715 | try: |
|
728 | try: | |
716 | rbsrt._performrebase(tr) |
|
729 | rbsrt._performrebase(tr) | |
|
730 | dsguard.close() | |||
|
731 | release(dsguard) | |||
717 | except error.InterventionRequired: |
|
732 | except error.InterventionRequired: | |
|
733 | dsguard.close() | |||
|
734 | release(dsguard) | |||
718 | tr.close() |
|
735 | tr.close() | |
719 | raise |
|
736 | raise | |
|
737 | except Exception: | |||
|
738 | release(dsguard) | |||
|
739 | raise | |||
720 | rbsrt._finishrebase() |
|
740 | rbsrt._finishrebase() | |
721 | finally: |
|
741 | finally: | |
722 | release(lock, wlock) |
|
742 | release(lock, wlock) | |
@@ -840,33 +860,28 b' def concludenode(repo, rev, p1, p2, comm' | |||||
840 | '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev |
|
860 | '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev | |
841 | but also store useful information in extra. |
|
861 | but also store useful information in extra. | |
842 | Return node of committed revision.''' |
|
862 | Return node of committed revision.''' | |
843 | dsguard = dirstateguard.dirstateguard(repo, 'rebase') |
|
863 | repo.setparents(repo[p1].node(), repo[p2].node()) | |
844 | try: |
|
864 | ctx = repo[rev] | |
845 | repo.setparents(repo[p1].node(), repo[p2].node()) |
|
865 | if commitmsg is None: | |
846 | ctx = repo[rev] |
|
866 | commitmsg = ctx.description() | |
847 | if commitmsg is None: |
|
867 | keepbranch = keepbranches and repo[p1].branch() != ctx.branch() | |
848 | commitmsg = ctx.description() |
|
868 | extra = {'rebase_source': ctx.hex()} | |
849 | keepbranch = keepbranches and repo[p1].branch() != ctx.branch() |
|
869 | if extrafn: | |
850 | extra = {'rebase_source': ctx.hex()} |
|
870 | extrafn(ctx, extra) | |
851 | if extrafn: |
|
|||
852 | extrafn(ctx, extra) |
|
|||
853 |
|
871 | |||
854 |
|
|
872 | targetphase = max(ctx.phase(), phases.draft) | |
855 |
|
|
873 | overrides = {('phases', 'new-commit'): targetphase} | |
856 |
|
|
874 | with repo.ui.configoverride(overrides, 'rebase'): | |
857 |
|
|
875 | if keepbranch: | |
858 |
|
|
876 | repo.ui.setconfig('ui', 'allowemptycommit', True) | |
859 |
|
|
877 | # Commit might fail if unresolved files exist | |
860 |
|
|
878 | if date is None: | |
861 |
|
|
879 | date = ctx.date() | |
862 |
|
|
880 | newnode = repo.commit(text=commitmsg, user=ctx.user(), | |
863 |
|
|
881 | date=date, extra=extra, editor=editor) | |
864 |
|
882 | |||
865 |
|
|
883 | repo.dirstate.setbranch(repo[newnode].branch()) | |
866 | dsguard.close() |
|
884 | return newnode | |
867 | return newnode |
|
|||
868 | finally: |
|
|||
869 | release(dsguard) |
|
|||
870 |
|
885 | |||
871 | def rebasenode(repo, rev, p1, base, state, collapse, target): |
|
886 | def rebasenode(repo, rev, p1, base, state, collapse, target): | |
872 | 'Rebase a single revision rev on top of p1 using base as merge ancestor' |
|
887 | 'Rebase a single revision rev on top of p1 using base as merge ancestor' |
@@ -572,6 +572,8 b' Interactions between collapse and keepbr' | |||||
572 | o 0: 'A' |
|
572 | o 0: 'A' | |
573 |
|
573 | |||
574 | $ hg rebase --keepbranches --collapse -s 1 -d 3 |
|
574 | $ hg rebase --keepbranches --collapse -s 1 -d 3 | |
|
575 | transaction abort! | |||
|
576 | rollback completed | |||
575 | abort: cannot collapse multiple named branches |
|
577 | abort: cannot collapse multiple named branches | |
576 | [255] |
|
578 | [255] | |
577 |
|
579 |
@@ -270,6 +270,8 b' G onto B - merge revision with both pare' | |||||
270 |
|
270 | |||
271 | $ hg rebase -s 6 -d 1 |
|
271 | $ hg rebase -s 6 -d 1 | |
272 | rebasing 6:eea13746799a "G" |
|
272 | rebasing 6:eea13746799a "G" | |
|
273 | transaction abort! | |||
|
274 | rollback completed | |||
273 | abort: cannot use revision 6 as base, result would have 3 parents |
|
275 | abort: cannot use revision 6 as base, result would have 3 parents | |
274 | [255] |
|
276 | [255] | |
275 | $ hg rebase --abort |
|
277 | $ hg rebase --abort |
General Comments 0
You need to be logged in to leave comments.
Login now