##// END OF EJS Templates
rebase: on abort delete rebase state file no matter what...
Christian Delahousse -
r26744:21e50e36 default
parent child Browse files
Show More
@@ -926,43 +926,46 b' def abort(repo, originalwd, target, stat'
926 activebookmark: the name of the bookmark that should be active after the
926 activebookmark: the name of the bookmark that should be active after the
927 restore'''
927 restore'''
928
928
929 # If the first commits in the rebased set get skipped during the rebase,
929 try:
930 # their values within the state mapping will be the target rev id. The
930 # If the first commits in the rebased set get skipped during the rebase,
931 # dstates list must must not contain the target rev (issue4896)
931 # their values within the state mapping will be the target rev id. The
932 dstates = [s for s in state.values() if s >= 0 and s != target]
932 # dstates list must must not contain the target rev (issue4896)
933 immutable = [d for d in dstates if not repo[d].mutable()]
933 dstates = [s for s in state.values() if s >= 0 and s != target]
934 cleanup = True
934 immutable = [d for d in dstates if not repo[d].mutable()]
935 if immutable:
935 cleanup = True
936 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
936 if immutable:
937 % ', '.join(str(repo[r]) for r in immutable),
937 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
938 hint=_('see "hg help phases" for details'))
938 % ', '.join(str(repo[r]) for r in immutable),
939 cleanup = False
939 hint=_('see "hg help phases" for details'))
940 cleanup = False
940
941
941 descendants = set()
942 descendants = set()
942 if dstates:
943 if dstates:
943 descendants = set(repo.changelog.descendants(dstates))
944 descendants = set(repo.changelog.descendants(dstates))
944 if descendants - set(dstates):
945 if descendants - set(dstates):
945 repo.ui.warn(_("warning: new changesets detected on target branch, "
946 repo.ui.warn(_("warning: new changesets detected on target branch, "
946 "can't strip\n"))
947 "can't strip\n"))
947 cleanup = False
948 cleanup = False
948
949
949 if cleanup:
950 if cleanup:
950 # Update away from the rebase if necessary
951 # Update away from the rebase if necessary
951 if needupdate(repo, state):
952 if needupdate(repo, state):
952 merge.update(repo, originalwd, False, True, False)
953 merge.update(repo, originalwd, False, True, False)
953
954
954 # Strip from the first rebased revision
955 # Strip from the first rebased revision
955 rebased = filter(lambda x: x >= 0 and x != target, state.values())
956 rebased = filter(lambda x: x >= 0 and x != target, state.values())
956 if rebased:
957 if rebased:
957 strippoints = [c.node() for c in repo.set('roots(%ld)', rebased)]
958 strippoints = [
958 # no backup of rebased cset versions needed
959 c.node() for c in repo.set('roots(%ld)', rebased)]
959 repair.strip(repo.ui, repo, strippoints)
960 # no backup of rebased cset versions needed
961 repair.strip(repo.ui, repo, strippoints)
960
962
961 if activebookmark and activebookmark in repo._bookmarks:
963 if activebookmark and activebookmark in repo._bookmarks:
962 bookmarks.activate(repo, activebookmark)
964 bookmarks.activate(repo, activebookmark)
963
965
964 clearstatus(repo)
966 finally:
965 repo.ui.warn(_('rebase aborted\n'))
967 clearstatus(repo)
968 repo.ui.warn(_('rebase aborted\n'))
966 return 0
969 return 0
967
970
968 def buildstate(repo, dest, rebaseset, collapse, obsoletenotrebased):
971 def buildstate(repo, dest, rebaseset, collapse, obsoletenotrebased):
General Comments 0
You need to be logged in to leave comments. Login now