changeset 5811:4688b7eb7e40

evolve: preserve wdir when using --stop After this change using hg evolve --stop update the working copy parent back to where the working copy was before the hg evolve operation (or the successors of that)
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Wed, 26 Aug 2020 23:27:17 +0530
parents 0a364a0aba27
children 5fdf6faaf977
files hgext3rd/evolve/evolvecmd.py tests/test-evolve-content-divergent-interrupted.t tests/test-evolve-content-divergent-stack.t tests/test-evolve-stop-orphan.t tests/test-evolve-stop-phasediv.t
diffstat 5 files changed, 28 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Mon Mar 01 19:22:33 2021 +0800
+++ b/hgext3rd/evolve/evolvecmd.py	Wed Aug 26 23:27:17 2020 +0530
@@ -1710,8 +1710,11 @@
             raise error.Abort(_(b'no interrupted evolve to stop'))
         evolvestate.load()
         stopevolve(ui, repo, evolvestate)
+        if evolvestate[b'command'] != b'evolve':
+            evolvestate.delete()
+            return
+        startnode = repo.unfiltered()[evolvestate[b'startnode']]
         evolvestate.delete()
-        return
     elif abortopt:
         if not evolvestate:
             raise error.Abort(_(b'no interrupted evolve to abort'))
@@ -1891,7 +1894,6 @@
         pctx = repo[b'.']
         compat.clean_update(pctx)
     ui.status(_(b'stopped the interrupted evolve\n'))
-    ui.status(_(b'working directory is now at %s\n') % pctx)
 
 def abortevolve(ui, repo, evolvestate):
     """ logic for handling of `hg evolve --abort`"""
--- a/tests/test-evolve-content-divergent-interrupted.t	Mon Mar 01 19:22:33 2021 +0800
+++ b/tests/test-evolve-content-divergent-interrupted.t	Wed Aug 26 23:27:17 2020 +0530
@@ -538,12 +538,12 @@
 
   $ hg evolve --stop
   stopped the interrupted evolve
-  working directory is now at e49523854bc8
+  working directory is now at 517d4375cb72
 
   $ hg glog
-  *  7:517d4375cb72 added d
+  @  7:517d4375cb72 added d
   |   () draft
-  | @  5:e49523854bc8 added d
+  | *  5:e49523854bc8 added d
   | |   () draft
   | o  3:ca1b80f7960a added c
   | |   () draft
@@ -560,7 +560,7 @@
 
 Making changes to make sure that it hits conflict while relocating
   $ hg up -r 3
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ echo "some_changes" >> a
   $ hg amend
   1 new orphan changesets
@@ -614,11 +614,10 @@
 
   $ hg evolve --stop
   stopped the interrupted evolve
-  working directory is now at c7586e2a9264
+  working directory is now at 0892835a581f
 
-XXX: we should have preserved the wdir to be at rev 10
   $ hg glog
-  *  10:0892835a581f added d
+  @  10:0892835a581f added d
   |   () draft
   o  8:33c16a2e0eb8 added c
   |   () draft
@@ -626,7 +625,7 @@
   | |   () draft
   o |  2:b1661037fa25 added b
   |/    () draft
-  @  1:c7586e2a9264 added a
+  o  1:c7586e2a9264 added a
   |   () draft
   o  0:8fa14d15e168 added hgignore
       () draft
--- a/tests/test-evolve-content-divergent-stack.t	Mon Mar 01 19:22:33 2021 +0800
+++ b/tests/test-evolve-content-divergent-stack.t	Wed Aug 26 23:27:17 2020 +0530
@@ -749,7 +749,7 @@
   $ hg evolve --stop
   2 new orphan changesets
   stopped the interrupted evolve
-  working directory is now at 2a955e808c53
+  working directory is now at 509103439e5e
   $ hg log -G
   o  changeset:   21:7e67dfb7ee31
   |  tag:         tip
@@ -770,7 +770,7 @@
   | |  instability: orphan, content-divergent
   | |  summary:     added c
   | |
-  | *  changeset:   17:509103439e5e
+  | @  changeset:   17:509103439e5e
   | |  parent:      5:8e222f257bbf
   | |  user:        test
   | |  date:        Thu Jan 01 00:00:00 1970 +0000
@@ -789,7 +789,7 @@
   | | |  instability: orphan, content-divergent
   | | |  summary:     added c
   | | |
-  | | @  changeset:   14:2a955e808c53
+  | | *  changeset:   14:2a955e808c53
   | | |  parent:      10:c04ff147ef79
   | | |  user:        test
   | | |  date:        Thu Jan 01 00:00:00 1970 +0000
@@ -837,10 +837,10 @@
   x  c7586e2a9264 (1) added a
   
   $ hg obslog -r 'desc("added b")' --all
-  @  2a955e808c53 (14) added b
+  *  2a955e808c53 (14) added b
   |    amended(content) from 6eb54b5af3fb using amend by test (Thu Jan 01 00:00:00 1970 +0000)
   |
-  | *  509103439e5e (17) added b
+  | @  509103439e5e (17) added b
   | |    amended(content) from d5f148423c16 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
   | |
   x |  6eb54b5af3fb (11) added b
--- a/tests/test-evolve-stop-orphan.t	Mon Mar 01 19:22:33 2021 +0800
+++ b/tests/test-evolve-stop-orphan.t	Wed Aug 26 23:27:17 2020 +0530
@@ -165,7 +165,6 @@
 
   $ hg evolve --stop
   stopped the interrupted evolve
-  working directory is now at cb6a2ab625bb
 
   $ hg glog
   @  5:cb6a2ab625bb added c
@@ -274,15 +273,15 @@
 
   $ hg evolve --stop
   stopped the interrupted evolve
-  working directory is now at aec285328e90
+  working directory is now at 21817cd42526
 
 Only changeset which has a successor now are obsoleted
   $ hg glog
-  @  9:aec285328e90 added b
+  o  9:aec285328e90 added b
   |   () draft
   o  8:fd00db71edca added a
   |   () draft
-  o  7:21817cd42526 added hgignore
+  @  7:21817cd42526 added hgignore
       () draft
   *  6:2a4e03d422e2 added d
   |   () draft
@@ -321,11 +320,11 @@
   |   () draft
   o  10:cb1dd1086ef6 added c
   |   () draft
-  @  9:aec285328e90 added b
+  o  9:aec285328e90 added b
   |   () draft
   o  8:fd00db71edca added a
   |   () draft
-  o  7:21817cd42526 added hgignore
+  @  7:21817cd42526 added hgignore
       () draft
 
 Bookmarks should only be moved of the changesets which have been evolved,
@@ -333,7 +332,7 @@
 -------------------------------------------------------------------------
 
   $ hg up tip^
-  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg bookmark b1
   $ hg up .^
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -387,13 +386,13 @@
 
   $ hg evolve --stop
   stopped the interrupted evolve
-  working directory is now at a3f4b95da934
+  working directory is now at a3cc2042492f
 
 Bookmarks of only the changeset which are evolved is moved
   $ hg glog
-  @  13:a3f4b95da934 added b
+  o  13:a3f4b95da934 added b
   |   (b2) draft
-  o  12:a3cc2042492f added a
+  @  12:a3cc2042492f added a
   |   () draft
   | *  11:cd0909a30222 added d
   | |   () draft
--- a/tests/test-evolve-stop-phasediv.t	Mon Mar 01 19:22:33 2021 +0800
+++ b/tests/test-evolve-stop-phasediv.t	Wed Aug 26 23:27:17 2020 +0530
@@ -98,15 +98,14 @@
 
   $ hg evolve --stop
   stopped the interrupted evolve
-  working directory is now at ca1b80f7960a
+  working directory is now at ddba58020bc0
 
-XXX: maybe we should update wdir to where it was
   $ hg glog
-  *  6:ddba58020bc0 added d
+  @  6:ddba58020bc0 added d
   |   () draft
   | o  4:c41c793e0ef1 added d
   | |   () public
-  | @  3:ca1b80f7960a added c
+  | o  3:ca1b80f7960a added c
   | |   () public
   | o  2:b1661037fa25 added b
   |/    () public