changeset 3824:a8f509981d30

evolve: factor out logic for --stop flag in separate function This will make code clean
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 10 Jun 2018 22:42:57 +0530
parents 7b33a6ed0539
children b5dfa78073b9
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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`"""