evolve: check for None before adding in set of revisions to strip
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 23 May 2018 02:36:14 +0530
changeset 3755 a19703c6d2bb
parent 3754 73ee40cbfb53
child 3756 26b9b89f8dac
evolve: check for None before adding in set of revisions to strip After previous patch, replacements can contain None. Let's make sure we don't add None to the revisions to strip during `hg evolve --abort` The test changes demonstrate the usefulness of this and the previous patch. Now abort is working and public changesets are not a problem.
hgext3rd/evolve/evolvecmd.py
tests/test-evolve-abort-phasediv.t
--- a/hgext3rd/evolve/evolvecmd.py	Wed May 23 02:33:14 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Wed May 23 02:36:14 2018 +0530
@@ -1312,7 +1312,8 @@
         cleanup = True
         startnode = evolvestate['startnode']
         for old, new in evolvestate['replacements'].iteritems():
-            evolvedctx.append(repo[new])
+            if new:
+                evolvedctx.append(repo[new])
         evolvedrevs = [c.rev() for c in evolvedctx]
 
         # checking if phase changed of any of the evolved rev
--- a/tests/test-evolve-abort-phasediv.t	Wed May 23 02:33:14 2018 +0530
+++ b/tests/test-evolve-abort-phasediv.t	Wed May 23 02:36:14 2018 +0530
@@ -189,14 +189,13 @@
   [255]
 
   $ hg evolve --abort
-  cannot clean up public changesets: c41c793e0ef1
-  abort: unable to abort interrupted evolve, use 'hg evolve --stop' to stop evolve
-  [255]
+  evolve aborted
+  working directory is now at 28cd06b3f801
 
   $ hg glog --hidden
   x  10:b7aedbe61ce6 added d
   |   () draft
-  | *  9:28cd06b3f801 added c
+  | @  9:28cd06b3f801 added c
   | |   () draft
   | | x  8:9ff8adbe8a24 added c
   | |/    () draft
@@ -210,7 +209,7 @@
   | |     () public
   o |  3:ca1b80f7960a added c
   | |   () public
-  @ |  2:b1661037fa25 added b
+  o |  2:b1661037fa25 added b
   |/    () public
   o  1:c7586e2a9264 added a
   |   () public