graft: move rebase cleanup code next to actual rebase
authorMatt Mackall <mpm@selenic.com>
Mon, 13 Oct 2014 13:21:03 -0500
changeset 22899 67cb1ab1ad1d
parent 22898 43816070284e
child 22900 7bf82faba774
graft: move rebase cleanup code next to actual rebase This is prep for refactoring the rebase logic.
mercurial/commands.py
--- a/mercurial/commands.py	Fri Oct 10 13:44:40 2014 -0500
+++ b/mercurial/commands.py	Mon Oct 13 13:21:03 2014 -0500
@@ -3485,6 +3485,13 @@
                     stats = mergemod.update(repo, ctx.node(), True, True, False,
                                             ctx.p1().node(),
                                             labels=['local', 'graft'])
+                    # drop the second merge parent
+                    repo.dirstate.beginparentchange()
+                    repo.setparents(current.node(), nullid)
+                    repo.dirstate.write()
+                    # fix up dirstate for copies and renames
+                    cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
+                    repo.dirstate.endparentchange()
                 finally:
                     repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
                 # report any conflicts
@@ -3498,14 +3505,6 @@
             else:
                 cont = False
 
-            # drop the second merge parent
-            repo.dirstate.beginparentchange()
-            repo.setparents(current.node(), nullid)
-            repo.dirstate.write()
-            # fix up dirstate for copies and renames
-            cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev())
-            repo.dirstate.endparentchange()
-
             # commit
             node = repo.commit(text=message, user=user,
                         date=date, extra=extra, editor=editor)