changeset 3978:fb8e44c70798 stable

evolve: set the second parent if we get conflicts while evolving This patch makes sure we set the second parent correctly if we run into conflicts while evolving. Also, we need to make sure to reset to one parent before committing.
author Pulkit Goyal <pulkit@yandex-team.ru>
date Sat, 18 Aug 2018 21:03:45 +0530
parents a0a4f4de9ea3
children db44da7b9097
files hgext3rd/evolve/evolvecmd.py tests/test-evolve-abort-orphan.t tests/test-evolve-abort-phasediv.t tests/test-evolve-phase.t tests/test-evolve.t tests/test-stabilize-conflict.t
diffstat 6 files changed, 27 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Sat Aug 18 21:01:14 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sat Aug 18 21:03:45 2018 +0530
@@ -814,7 +814,7 @@
         nodenew = _relocatecommit(repo, orig, commitmsg)
     except error.Abort as exc:
         with repo.dirstate.parentchange():
-            repo.setparents(repo['.'].node(), node.nullid)
+            repo.setparents(dest.node(), orig.node())
             repo.dirstate.write(tr)
             # fix up dirstate for copies and renames
             copies.duplicatecopies(repo, repo[None], dest.rev(), orig.p1().rev())
@@ -1866,6 +1866,9 @@
                     repo.dirstate.setparents(ctxparents[0].node(),
                                              currentp1)
             pass
+    else:
+        with repo.dirstate.parentchange():
+            repo.dirstate.setparents(repo.dirstate.parents()[0], nodemod.nullid)
 
     with repo.ui.configoverride(overrides, 'evolve-continue'):
         node = repo.commit(text=message, user=user,
--- a/tests/test-evolve-abort-orphan.t	Sat Aug 18 21:01:14 2018 +0530
+++ b/tests/test-evolve-abort-orphan.t	Sat Aug 18 21:03:45 2018 +0530
@@ -96,6 +96,12 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     added c
   
+  changeset:   4:c41c793e0ef1
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  instability: orphan
+  summary:     added d
+  
 
   $ hg evolve --abort
   evolve aborted
@@ -182,7 +188,7 @@
   |   () draft
   | *  6:e83de241f751 added d
   | |   () draft
-  | *  5:e93a9161a274 added c
+  | @  5:e93a9161a274 added c
   | |   () draft
   | x  2:b1661037fa25 added b
   | |   () draft
@@ -275,7 +281,7 @@
   |/    () draft
   @  7:807e8e2ca559 added a
   |   () draft
-  | *  6:8f20d4390c21 foo to a
+  | @  6:8f20d4390c21 foo to a
   | |   () draft
   | | *  5:bcb1c47f8520 added d
   | | |   () draft
@@ -338,7 +344,7 @@
   |/    () draft
   @  7:807e8e2ca559 added a
   |   () draft
-  | *  6:8f20d4390c21 foo to a
+  | @  6:8f20d4390c21 foo to a
   | |   () draft
   | | *  5:bcb1c47f8520 added d
   | | |   () draft
@@ -422,7 +428,7 @@
   |/    () draft
   @  7:807e8e2ca559 added a
   |   () draft
-  | *  6:8f20d4390c21 foo to a
+  | @  6:8f20d4390c21 foo to a
   | |   () draft
   | x  1:2f913b0c9220 added a
   |/    () draft
@@ -490,7 +496,7 @@
   |   (bm1) draft
   o  4:a0086c17bfc7 added a
   |   () draft
-  | *  3:17509928e5bf added c
+  | @  3:17509928e5bf added c
   | |   () draft
   | x  2:9f0c80a55ddc added b
   | |   () draft
--- a/tests/test-evolve-abort-phasediv.t	Sat Aug 18 21:01:14 2018 +0530
+++ b/tests/test-evolve-abort-phasediv.t	Sat Aug 18 21:03:45 2018 +0530
@@ -114,6 +114,14 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     added c
   
+  changeset:   6:ddba58020bc0
+  tag:         tip
+  parent:      1:c7586e2a9264
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  instability: phase-divergent
+  summary:     added d
+  
 
   $ hg evolve --abort
   evolve aborted
--- a/tests/test-evolve-phase.t	Sat Aug 18 21:01:14 2018 +0530
+++ b/tests/test-evolve-phase.t	Sat Aug 18 21:03:45 2018 +0530
@@ -103,7 +103,7 @@
   $ hg glog
   @  3 - 87495ea7c9ec b (draft)
   |
-  | *  2 - 13833940840c c (secret)
+  | @  2 - 13833940840c c (secret)
   | |
   | x  1 - 1e6c11564562 b (draft)
   |/
--- a/tests/test-evolve.t	Sat Aug 18 21:01:14 2018 +0530
+++ b/tests/test-evolve.t	Sat Aug 18 21:03:45 2018 +0530
@@ -1543,7 +1543,7 @@
   |
   o  37:df89d30f23e2@default(draft) amended
   |
-  | *  36:59c37c5bebd1@default(draft) will cause conflict at evolve
+  | @  36:59c37c5bebd1@default(draft) will cause conflict at evolve
   | |
   | x  35:7cc12c6c7862@default(draft) will be evolved safely
   | |
--- a/tests/test-stabilize-conflict.t	Sat Aug 18 21:01:14 2018 +0530
+++ b/tests/test-stabilize-conflict.t	Sat Aug 18 21:03:45 2018 +0530
@@ -140,7 +140,7 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     babar count up to ten
   |
-  | *  changeset:   4:71c18f70c34f
+  | @  changeset:   4:71c18f70c34f
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  instability: orphan
@@ -232,7 +232,7 @@
   |  date:        Thu Jan 01 00:00:00 1970 +0000
   |  summary:     babar count up to ten
   |
-  | *  changeset:   6:1836b91c6c1d
+  | @  changeset:   6:1836b91c6c1d
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
   | |  instability: orphan