changeset 3548:79d995cb8152

next: move logic to evolve the children to it's own function This patch moves the logic which evolves the children and updates to it in `hg next --evolve` to it's own function as we want to use that again.
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 16 Mar 2018 11:56:50 +0530
parents 78abffad8626
children 802441114400
files hgext3rd/evolve/__init__.py
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Fri Mar 16 11:46:47 2018 +0530
+++ b/hgext3rd/evolve/__init__.py	Fri Mar 16 11:56:50 2018 +0530
@@ -1145,21 +1145,26 @@
                 ui.warn(_("(run 'hg evolve --rev REV' on one of them)\n"))
                 return 1
             else:
-                cmdutil.bailifchanged(repo)
-                evolvestate = state.cmdstate(repo, opts={'command': 'next'})
-                result = evolvecmd._solveone(ui, repo, repo[aspchildren[0]],
-                                             evolvestate, dryrunopt, False,
-                                             lambda: None, category='orphan')
-                # making sure a next commit is formed
-                if result[0] and result[1]:
-                    ui.status(_('working directory now at %s\n')
-                              % ui.label(str(repo['.']), 'evolve.node'))
-                return 0
+                return _nextevolve(ui, repo, aspchildren[0], opts)
             return 1
         return result
     finally:
         lockmod.release(wlock)
 
+def _nextevolve(ui, repo, aspchildren, opts):
+    """logic for hg next command to evolve and update to an aspiring children"""
+
+    cmdutil.bailifchanged(repo)
+    evolvestate = state.cmdstate(repo, opts={'command': 'next'})
+    result = evolvecmd._solveone(ui, repo, repo[aspchildren],
+                                 evolvestate, opts.get('dry_run'), False,
+                                 lambda: None, category='orphan')
+    # making sure a next commit is formed
+    if result[0] and result[1]:
+        ui.status(_('working directory now at %s\n')
+                  % ui.label(str(repo['.']), 'evolve.node'))
+    return 0
+
 def _updatetonext(ui, repo, children, displayer, opts):
     """ logic for `hg next` command to update to children and move bookmarks if
     required """