# HG changeset patch # User Martin von Zweigbergk # Date 2018-12-01 00:21:37 # Node ID f07d4f94f0989781f279b4b70ad501bed81cd430 # Parent 8ff910b21eefaed305414f7b1b49d10d12c36409 rebase: preserve working copy when redoing in-mem rebase on disk When in-memory rebase runs into conflicts, we retry it on disk. But before we do that, we abort the in-memory rebase. That is done because even though it's mostly in memory, there are still a few state files written (e.g. the merge state). We should make it not write those files so we don't need to abort, but for the stable branch, let's explicitly clear the state we need to clear instead of running the usual abort code. Differential Revision: https://phab.mercurial-scm.org/D5356 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -865,7 +865,11 @@ def rebase(ui, repo, **opts): except error.InMemoryMergeConflictsError: ui.warn(_('hit merge conflicts; re-running rebase without in-memory' ' merge\n')) - _dorebase(ui, repo, action='abort', opts={}) + # TODO: Make in-memory merge not use the on-disk merge state, so + # we don't have to clean it here + mergemod.mergestate.clean(repo) + clearstatus(repo) + clearcollapsemsg(repo) return _dorebase(ui, repo, action, opts, inmemory=False) else: return _dorebase(ui, repo, action, opts) diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -422,7 +422,6 @@ In-memory rebase that fails due to merge transaction abort! rollback completed hit merge conflicts; re-running rebase without in-memory merge - rebase aborted rebasing 2:177f92b77385 "c" rebasing 3:055a42cdd887 "d" rebasing 4:e860deea161a "e" @@ -447,17 +446,10 @@ Retrying without in-memory merge won't l transaction abort! rollback completed hit merge conflicts; re-running rebase without in-memory merge - rebase aborted - rebasing 2:177f92b77385 "c" - rebasing 3:055a42cdd887 "d" - rebasing 4:e860deea161a "e" - merging e - warning: conflicts while merging e! (edit, then use 'hg resolve --mark') - unresolved conflicts (see hg resolve, then hg rebase --continue) - [1] -BROKEN: working copy change to "a" was lost + abort: uncommitted changes + [255] $ cat a - a + dirty Retrying without in-memory merge won't lose merge state $ cd ..