##// END OF EJS Templates
rebase: allow aborting when descendants detected...
Matt Mackall -
r19518:12843143 stable
parent child Browse files
Show More
@@ -608,32 +608,36 b' def abort(repo, originalwd, target, stat'
608 608 'Restore the repository to its original state'
609 609 dstates = [s for s in state.values() if s != nullrev]
610 610 immutable = [d for d in dstates if not repo[d].mutable()]
611 cleanup = True
611 612 if immutable:
612 613 repo.ui.warn(_("warning: can't clean up immutable changesets %s\n")
613 614 % ', '.join(str(repo[r]) for r in immutable),
614 615 hint=_('see hg help phases for details'))
616 cleanup = False
615 617
616 618 descendants = set()
617 619 if dstates:
618 620 descendants = set(repo.changelog.descendants(dstates))
619 621 if descendants - set(dstates):
620 622 repo.ui.warn(_("warning: new changesets detected on target branch, "
621 "can't abort\n"))
622 return -1
623 else:
623 "can't strip\n"))
624 cleanup = False
625
626 if cleanup:
624 627 # Update away from the rebase if necessary
625 if not immutable and inrebase(repo, originalwd, state):
628 if inrebase(repo, originalwd, state):
626 629 merge.update(repo, repo[originalwd].rev(), False, True, False)
627 630
628 631 # Strip from the first rebased revision
629 632 rebased = filter(lambda x: x > -1 and x != target, state.values())
630 if rebased and not immutable:
633 if rebased:
631 634 strippoints = [c.node() for c in repo.set('roots(%ld)', rebased)]
632 635 # no backup of rebased cset versions needed
633 636 repair.strip(repo.ui, repo, strippoints)
634 clearstatus(repo)
635 repo.ui.warn(_('rebase aborted\n'))
636 return 0
637
638 clearstatus(repo)
639 repo.ui.warn(_('rebase aborted\n'))
640 return 0
637 641
638 642 def buildstate(repo, dest, rebaseset, collapse):
639 643 '''Define which revisions are going to be rebased and where
@@ -180,8 +180,8 b" Force a commit on B' during the interrup"
180 180 Abort the rebasing:
181 181
182 182 $ hg rebase --abort
183 warning: new changesets detected on target branch, can't abort
184 [255]
183 warning: new changesets detected on target branch, can't strip
184 rebase aborted
185 185
186 186 $ hg tglog
187 187 @ 6: 'Extra'
General Comments 0
You need to be logged in to leave comments. Login now