diff --git a/eden/scm/sapling/ext/rebase.py b/eden/scm/sapling/ext/rebase.py index 9cf1ea908bdd6..7a217fed67cf6 100644 --- a/eden/scm/sapling/ext/rebase.py +++ b/eden/scm/sapling/ext/rebase.py @@ -250,6 +250,7 @@ def __init__(self, repo, ui, templ, inmemory=False, opts=None): self.collapsef = opts.get("collapse", False) self.collapsemsg = cmdutil.logmessage(repo, opts) + self.contf = opts.get("continue", False) self.date = opts.get("date", None) e = opts.get("extrafn") # internal, used by e.g. hgsubversion @@ -674,6 +675,7 @@ def _performrebasesubset(self, tr, subset, pos, prog): _("%s (in %s); switching to on-disk merge\n") % (kindstr, pathstr) ) + cmdutil.bailifchanged(repo) ui.log( "rebase", rebase_imm_new_restart=str(True).lower(), @@ -790,7 +792,7 @@ def _performrebaseone(self, rev, ctx, desc, tr, dest): if self.collapsef: storecollapsemsg(repo, self.collapsemsg) - if len(repo[None].parents()) == 2: + if self.contf and len(repo[None].parents()) == 2: repo.ui.debug("resuming interrupted rebase\n") else: with ui.configoverride( diff --git a/eden/scm/tests/test-rebase-bail-merge-state.t b/eden/scm/tests/test-rebase-bail-merge-state.t index bb358f2b4c61b..40ec7cd6cf6d0 100644 --- a/eden/scm/tests/test-rebase-bail-merge-state.t +++ b/eden/scm/tests/test-rebase-bail-merge-state.t @@ -1,3 +1,5 @@ +#require no-eden + $ enable rebase undo $ setconfig rebase.experimental.inmemory=true $ newclientrepo @@ -11,31 +13,51 @@ $ hg whereami 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 112478962961147124edd43549aedd1a335e44bf -FIXME: not correct! +Rebase is in-memory - works okay and leaves us in merge state: $ hg rebase -r $C -d $B rebasing dc0947a82db8 "C" - note: not rebasing dc0947a82db8, its destination (rebasing onto) commit already has all its changes $ hg whereami 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 112478962961147124edd43549aedd1a335e44bf -Similar, but falling back to on-disk rebase: +Falling back to on-disk rebase: $ newclientrepo $ drawdag < B C # C/B = conflict > |/ > A > EOS +Start with rebase dest checked out: $ hg go -q $B $ hg debugsetparents $B $A $ hg whereami 112478962961147124edd43549aedd1a335e44bf 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 -FIXME: not correct! +Rebase errors out after transitioning to on-disk merge: + $ hg rebase -r $C -d $B + rebasing ce63d6ee6316 "C" + merging B + hit merge conflicts (in B); switching to on-disk merge + abort: outstanding uncommitted merge + [255] + $ hg whereami + 112478962961147124edd43549aedd1a335e44bf + 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 + +Start with rebase dest _not_ checked out: + $ hg go -q $A + $ hg debugsetparents $B $A + $ hg whereami + 112478962961147124edd43549aedd1a335e44bf + 426bada5c67598ca65036d57d9e4b64b0c1ce7a0 +Rebase errors out after transitioning to on-disk merge: $ hg rebase -r $C -d $B rebasing ce63d6ee6316 "C" - note: not rebasing ce63d6ee6316, its destination (rebasing onto) commit already has all its changes + merging B + hit merge conflicts (in B); switching to on-disk merge + abort: outstanding uncommitted merge + [255] $ hg whereami 112478962961147124edd43549aedd1a335e44bf 426bada5c67598ca65036d57d9e4b64b0c1ce7a0