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