changeset 22038:021becbf024a

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 phase movement within the transaction. Avoiding phase movement from high-level code will avoid the burden of transaction handling. It is also important to limit the need for transaction handling as this limits the odds of people messing up. Most common expected mess-up is code using a different transaction for changeset creation and phase adjustment.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 05 Aug 2014 13:22:44 -0700
parents 8665c647da6e
children 0aa2cb965f4c
files hgext/rebase.py
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Tue Aug 05 21:16:24 2014 -0700
+++ b/hgext/rebase.py	Tue Aug 05 13:22:44 2014 -0700
@@ -469,15 +469,18 @@
         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