evolve: make sure bookmarks are moved after phase-divergence resolution
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 23 Mar 2018 17:49:26 +0530
changeset 3624 6756f2a85f5b
parent 3623 71fbb679e311
child 3625 7e253bbac9a1
evolve: make sure bookmarks are moved after phase-divergence resolution This patch adds logic to move bookmarks from the rebased node to the phase-divergence resolved node.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-phase-divergence.t
--- a/hgext3rd/evolve/evolvecmd.py	Fri Mar 23 17:46:46 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Fri Mar 23 17:49:26 2018 +0530
@@ -228,6 +228,9 @@
     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,6 +251,7 @@
                 # 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:
             repo.vfs.write('graftstate', bumped.hex() + '\n')
             repo.ui.write_err(_('evolution failed!\n'))
@@ -301,6 +305,9 @@
         compat.createmarkers(repo, [(tmpctx, (repo[newid],))],
                              flag=obsolete.bumpedfix, operation='evolve')
     bmupdate(newid)
+    # if rebased happened, update bookmarks from there too
+    if rebasedbmupdate:
+        rebasedbmupdate(newid)
     repo.ui.status(_('committed as %s\n') % node.short(newid))
     # reroute the working copy parent to the new changeset
     with repo.dirstate.parentchange():
--- a/tests/test-evolve-phase-divergence.t	Fri Mar 23 17:46:46 2018 +0530
+++ b/tests/test-evolve-phase-divergence.t	Fri Mar 23 17:49:26 2018 +0530
@@ -608,10 +608,8 @@
 
 XXX: we should move bookmark here
   $ hg glog
-  x  11:b1a0e143e32b added x to x
-  |   (bm) draft
-  | @  9:2352021b3785 added x to x
-  |/    () public
+  @  9:2352021b3785 added x to x
+  |   (bm) public
   o  8:502e73736632 phase-divergent update to b756eb10ea73:
   |
   |  foo to bar