evolve: store the evolvestate if relocation results in conflicts
authorPulkit Goyal <7895pulkit@gmail.com>
Thu, 07 Jun 2018 22:59:39 +0530
changeset 3811 3273b178c202
parent 3810 04fe01b0c0d0
child 3821 f67ac33c07d2
evolve: store the evolvestate if relocation results in conflicts We missed storing the evolvestate on disk when relocation lead to conflicts. We need to store it to grab information to continue or abort or stop the evolve.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-content-divergence.t
--- a/hgext3rd/evolve/evolvecmd.py	Thu Jun 07 22:45:54 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Jun 07 22:59:39 2018 +0530
@@ -451,15 +451,19 @@
 
     # relocate the other divergent if required
     if relocatereq:
-        evolvestate['current'] = other.node()
         # relocating will help us understand during the time of conflicts that
         # whether conflicts occur at reloacting or they occured at merging
         # content divergent changesets
         evolvestate['relocating'] = True
         ui.status(_('rebasing "other" content-divergent changeset %s on'
                     ' %s\n' % (other, divergent.p1())))
-        newother = relocate(repo, other, divergent.p1(), evolvestate,
-                            keepbranch=True)
+        try:
+            newother = relocate(repo, other, divergent.p1(), evolvestate,
+                                keepbranch=True)
+        except MergeFailure:
+            evolvestate['current'] = other.node()
+            evolvestate.save()
+            raise
         other = repo[newother]
         evolvestate['relocating'] = False
         evolvestate['relocated'] = other.node()
--- a/tests/test-evolve-content-divergence.t	Thu Jun 07 22:45:54 2018 +0530
+++ b/tests/test-evolve-content-divergence.t	Thu Jun 07 22:59:39 2018 +0530
@@ -636,9 +636,11 @@
   $ hg rebase -r . -d bbaca013758a --config experimental.evolution.allowdivergence=True
   rebasing 21:884c9d1a1a84 "added z"
   2 new content-divergent changesets
+  $ echo bar > z
+  $ hg amend
 
   $ hg glog
-  @  23:478a0057fd1a added z
+  @  24:d2eca78cc588 added z
   |   () [bar] draft
   | *  22:3e22a949fe7d added z
   | |   () [default] draft
@@ -658,7 +660,7 @@
       () [default] draft
 
   $ hg evolve --content-divergent
-  merge:[23] added z
+  merge:[24] added z
   with: [22] added z
   base: [21] added z
   rebasing "other" content-divergent changeset 3e22a949fe7d on bbaca013758a
@@ -686,28 +688,47 @@
   $ echo foo > y
   $ hg resolve -m
   (no more unresolved files)
+  continue: hg evolve --continue
 
-XXX: wat?
   $ hg evolve --continue
-  abort: no interrupted evolve to continue
-  [255]
+  working directory is now at a15eb4e32166
 
   $ hg glog
-  *  23:478a0057fd1a added z
+  @  25:a15eb4e32166 added z
+  |   () [default] draft
+  o  20:bbaca013758a added y
   |   () [bar] draft
-  | *  22:3e22a949fe7d added z
-  | |   () [default] draft
-  @ |  20:bbaca013758a added y
-  | |   () [bar] draft
-  o |  14:be41fdcd0ee1 added foo to x
-  | |   () [bar] draft
-  o |  9:b6b20b8eefdc added d
-  | |   () [default] draft
-  o |  8:7c46f743e62f added c
-  |/    () [default] draft
+  o  14:be41fdcd0ee1 added foo to x
+  |   () [bar] draft
+  o  9:b6b20b8eefdc added d
+  |   () [default] draft
+  o  8:7c46f743e62f added c
+  |   () [default] draft
   o  5:7ed0642d644b added b
   |   () [default] draft
   o  1:c7586e2a9264 added a
   |   () [default] draft
   o  0:8fa14d15e168 added hgignore
       () [default] draft
+
+XXX: z should have bar inside, the merge definitely did not happen
+  $ hg exp
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID a15eb4e32166b0652fdec4c1dd30c9d668323bac
+  # Parent  bbaca013758a55364955939e2d2e4536cb8d05cf
+  added z
+  
+  diff -r bbaca013758a -r a15eb4e32166 y
+  --- a/y	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,1 +1,1 @@
+  -watbar
+  +foo
+  diff -r bbaca013758a -r a15eb4e32166 z
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/z	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +z