Skip to content
Snippets Groups Projects
Commit 910123eac887 authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

rebase: extract final changesets cleanup logic in a dedicated function

At the end of the rebase, rebased changesets are currently stripped. This
behavior will be eventually dropped in favor of obsolescence marker creation.

The main rebase function is already big and branchy enough. This changeset move
the clean-up logic in a dedicated function before we make it more complex.
parent d0afa149e059
No related branches found
No related tags found
No related merge requests found
......@@ -310,15 +310,7 @@
nstate[repo[k].node()] = repo[v].node()
if not keepf:
# Remove no more useful revisions
rebased = [rev for rev in state if state[rev] != nullmerge]
if rebased:
if set(repo.changelog.descendants([min(rebased)])) - set(state):
ui.warn(_("warning: new changesets detected "
"on source branch, not stripping\n"))
else:
# backup the old csets by default
repair.strip(ui, repo, repo[min(rebased)].node(), "all")
clearrebased(ui, repo, state)
if currentbookmarks:
updatebookmarks(repo, nstate, currentbookmarks, **opts)
......@@ -664,6 +656,18 @@
state.update(dict.fromkeys(detachset, nullmerge))
return repo['.'].rev(), dest.rev(), state
def clearrebased(ui, repo, state):
"""dispose of rebased revision at the end of the rebase"""
rebased = [rev for rev in state if state[rev] != nullmerge]
if rebased:
if set(repo.changelog.descendants([min(rebased)])) - set(state):
ui.warn(_("warning: new changesets detected "
"on source branch, not stripping\n"))
else:
# backup the old csets by default
repair.strip(ui, repo, repo[min(rebased)].node(), "all")
def pullrebase(orig, ui, repo, *args, **opts):
'Call rebase after pull if the latter has been invoked with --rebase'
if opts.get('rebase'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment