evolve: factor out logic for --stop flag in separate function
authorPulkit Goyal <7895pulkit@gmail.com>
Sun, 10 Jun 2018 22:42:57 +0530
changeset 3824 a8f509981d30
parent 3823 7b33a6ed0539
child 3825 b5dfa78073b9
evolve: factor out logic for --stop flag in separate function This will make code clean
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Sun Jun 10 22:38:08 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Jun 10 22:42:57 2018 +0530
@@ -1405,10 +1405,7 @@
         if not evolvestate:
             raise error.Abort(_('no interrupted evolve to stop'))
         evolvestate.load()
-        pctx = repo['.']
-        hg.updaterepo(repo, pctx.node(), True)
-        ui.status(_('stopped the interrupted evolve\n'))
-        ui.status(_('working directory is now at %s\n') % pctx)
+        stopevolve(ui, repo, evolvestate)
         evolvestate.delete()
         return
     elif abortopt:
@@ -1471,6 +1468,13 @@
     progresscb()
     _cleanup(ui, repo, startnode, showprogress, shouldupdate)
 
+def stopevolve(ui, repo, evolvestate):
+    """logic for handling of `hg evolve --stop`"""
+    pctx = repo['.']
+    hg.updaterepo(repo, pctx.node(), True)
+    ui.status(_('stopped the interrupted evolve\n'))
+    ui.status(_('working directory is now at %s\n') % pctx)
+
 def abortevolve(ui, repo, evolvestate):
     """ logic for handling of `hg evolve --abort`"""