evolve: fix storage of replacements and temprevs node in evolvestate
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 24 May 2018 00:58:50 +0530
changeset 3772 6240579fd0c0
parent 3771 1f339d81aabd
child 3773 958dad74e877
evolve: fix storage of replacements and temprevs node in evolvestate The _completephaseivergent() was not respecting rules on how to store the new node ids created in evolvestate. The rules are: * store the temporary relocated commits in temprevs * store the final new commit in replacements This patch make sure we follow the above rules and also use the return value returned by _resolvephasedivergence(). The tests change demonstrates that we are all good now.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-abort-phasediv.t
--- a/hgext3rd/evolve/evolvecmd.py	Thu May 24 00:58:35 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Thu May 24 00:58:50 2018 +0530
@@ -1425,6 +1425,7 @@
         # need to start transaction for bookmark changes
         tr = repo.transaction('evolve')
         node = _completerelocation(ui, repo, evolvestate)
+        evolvestate['temprevs'].append(node)
         # resolving conflicts can lead to empty wdir and node can be None in
         # those cases
         ctx = repo[evolvestate['current']]
@@ -1433,8 +1434,8 @@
 
         # now continuing the phase-divergence resolution part
         prec = repo[evolvestate['precursor']]
-        _resolvephasedivergent(ui, repo, prec, ctx, newctx)
-        evolvestate['replacements'][ctx.node()] = node
+        retvalue = _resolvephasedivergent(ui, repo, prec, ctx, newctx)
+        evolvestate['replacements'][ctx.node()] = retvalue[1]
         tr.close()
     finally:
         tr.release()
--- a/tests/test-evolve-abort-phasediv.t	Thu May 24 00:58:35 2018 +0530
+++ b/tests/test-evolve-abort-phasediv.t	Thu May 24 00:58:50 2018 +0530
@@ -278,31 +278,28 @@
   [255]
 
   $ hg evolve --abort
+  1 new phase-divergent changesets
   evolve aborted
   working directory is now at ef9b72b9b42c
 
   $ hg glog --hidden
-  o  11:95d746965290 phase-divergent update to ca1b80f7960a:
-  |
-  |  added c
+  @  10:ef9b72b9b42c added d
   |   () draft
-  | @  10:ef9b72b9b42c added d
-  | |   () draft
-  | | x  9:28cd06b3f801 added c
-  | |/    () draft
-  | | x  8:9ff8adbe8a24 added c
-  | |/    () draft
-  | | x  7:e44ebefe4f54 added d
-  | |/    () draft
-  | | x  6:ddba58020bc0 added d
-  | |/    () draft
-  | | x  5:cfe30edc6125 added d
-  | |/    () draft
-  +---o  4:c41c793e0ef1 added d
-  | |     () public
-  o |  3:ca1b80f7960a added c
+  | *  9:28cd06b3f801 added c
+  |/    () draft
+  | x  8:9ff8adbe8a24 added c
+  |/    () draft
+  | x  7:e44ebefe4f54 added d
+  |/    () draft
+  | x  6:ddba58020bc0 added d
+  |/    () draft
+  | x  5:cfe30edc6125 added d
+  |/    () draft
+  | o  4:c41c793e0ef1 added d
   | |   () public
-  o |  2:b1661037fa25 added b
+  | o  3:ca1b80f7960a added c
+  | |   () public
+  | o  2:b1661037fa25 added b
   |/    () public
   o  1:c7586e2a9264 added a
   |   () public