From patchwork Wed Aug 6 04:27:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2,of,6] rebase: do not retract phase boundary by hand From: Pierre-Yves David X-Patchwork-Id: 5284 Message-Id: <78b7329fcb845f6c2603.1407299250@marginatus.alto.octopoid.net> To: mercurial-devel@selenic.com Cc: pierre-yves.david@ens-lyon.org Date: Tue, 05 Aug 2014 21:27:30 -0700 # HG changeset patch # User Pierre-Yves David # Date 1407270164 25200 # Tue Aug 05 13:22:44 2014 -0700 # Node ID 78b7329fcb845f6c2603104a688ead6ef4f88c77 # Parent a0abbd44e930bd673c088f8412c46efc1d0b442a rebase: do not retract phase boundary by hand. We rely on the internal mechanism to commit the changeset in the right phase. This similar to what the mq extension is doing. This is an important change as we plan to includes phases movement within the transaction. Avoiding phase movement from high level code will avoid them the burden of transaction handling. It is also important to limit the need for transaction handling as this limit the odds of people messing up. Most common expected mess up is code using a different transaction for changesets creation and phase adjustment. diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -466,19 +466,22 @@ def concludenode(repo, rev, p1, p2, comm if commitmsg is None: commitmsg = ctx.description() extra = {'rebase_source': ctx.hex()} if extrafn: extrafn(ctx, extra) - # Commit might fail if unresolved files exist - newrev = repo.commit(text=commitmsg, user=ctx.user(), - date=ctx.date(), extra=extra, editor=editor) + + backup = repo.ui.backupconfig('phases', 'new-commit') + try: + targetphase = max(ctx.phase(), phases.draft) + repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') + # Commit might fail if unresolved files exist + newrev = repo.commit(text=commitmsg, user=ctx.user(), + date=ctx.date(), extra=extra, editor=editor) + finally: + repo.ui.restoreconfig(backup) + repo.dirstate.setbranch(repo[newrev].branch()) - targetphase = max(ctx.phase(), phases.draft) - # retractboundary doesn't overwrite upper phase inherited from parent - newnode = repo[newrev].node() - if newnode: - phases.retractboundary(repo, targetphase, [newnode]) return newrev except util.Abort: # Invalidate the previous setparents repo.dirstate.invalidate() raise