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.
--- 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 """