--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext3rd/evolve/evolvecmd.py Fri Jan 19 14:42:46 2018 +0530
@@ -0,0 +1,43 @@
+# Copyright 2011 Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
+# Logilab SA <contact@logilab.fr>
+# Pierre-Yves David <pierre-yves.david@ens-lyon.org>
+# Patrick Mezard <patrick@mezard.eu>
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+"""logic related to hg evolve command"""
+
+from mercurial import (
+ lock as lockmod,
+)
+
+from . import _solveunstable, _solvebumped, _solvedivergent
+
+def _solveone(ui, repo, ctx, dryrun, confirm, progresscb, category):
+ """Resolve the troubles affecting one revision
+
+ returns a tuple (bool, newnode) where,
+ bool: a boolean value indicating whether the instability was solved
+ newnode: if bool is True, then the newnode of the resultant commit
+ formed. newnode can be node, when resolution led to no new
+ commit. If bool is False, this is ''.
+ """
+ wlock = lock = tr = None
+ try:
+ wlock = repo.wlock()
+ lock = repo.lock()
+ tr = repo.transaction("evolve")
+ if 'orphan' == category:
+ result = _solveunstable(ui, repo, ctx, dryrun, confirm, progresscb)
+ elif 'phasedivergent' == category:
+ result = _solvebumped(ui, repo, ctx, dryrun, confirm, progresscb)
+ elif 'contentdivergent' == category:
+ result = _solvedivergent(ui, repo, ctx, dryrun, confirm,
+ progresscb)
+ else:
+ assert False, "unknown trouble category: %s" % (category)
+ tr.close()
+ return result
+ finally:
+ lockmod.release(tr, lock, wlock)