hgext3rd/evolve/evolvecmd.py
changeset 3632 8d38b88233cb
parent 3631 8db32b33cdf1
child 3633 ed3032ee53eb
--- a/hgext3rd/evolve/evolvecmd.py	Sat Mar 24 16:38:03 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sat Mar 24 16:41:14 2018 +0530
@@ -223,14 +223,7 @@
         return (False, '')
     if progresscb:
         progresscb()
-    newid = tmpctx = None
     tmpctx = bumped
-    tr = repo.currenttransaction()
-    assert tr is not None
-    bmupdate = _bookmarksupdater(repo, bumped.node(), tr)
-    # function to update the bookmark from the rebased changeset to new resolved
-    # changeset
-    rebasedbmupdate = None
 
     # Checking for whether the phase-divergent changeset has common parents as
     # it's precursors. Phase-divergent changeset and precursor having different
@@ -248,10 +241,6 @@
                 tmpctx = repo[tmpid]
                 compat.createmarkers(repo, [(bumped, (tmpctx,))],
                                      operation='evolve')
-                # after rebasing, the changeset against which revert should
-                # happen should be the new rebased changeset
-                bumped = tmpctx
-                rebasedbmupdate = _bookmarksupdater(repo, bumped.node(), tr)
         except MergeFailure:
             evolvestate['current'] = bumped.hex()
             evolvestate['precursor'] = prec.hex()
@@ -261,6 +250,22 @@
             repo.ui.write_err(msg)
             raise
 
+    return _resolvephasedivergent(ui, repo, prec, bumped, tmpctx)
+
+def _resolvephasedivergent(ui, repo, prec, bumped, tmpctx=None):
+
+    tr = repo.currenttransaction()
+    assert tr is not None
+    bmupdate = _bookmarksupdater(repo, bumped.node(), tr)
+    newid = None
+
+    # function to update the bookmark from the rebased changeset to new resolved
+    # changeset
+    rebasedbmupdate = None
+    if tmpctx and tmpctx.node() != bumped.node():
+        rebasedbmupdate = _bookmarksupdater(repo, tmpctx.node(), tr)
+        bumped = tmpctx
+
     # Create the new commit context
     repo.ui.status(_('computing new diff\n'))
     files = set()