# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1521889874 -19800 # Node ID 8d38b88233cba01a5e9c2a14f3f8399c106c463a # Parent 8db32b33cdf1b8867845a6bd7b30156c34ae3275 evolve: move logic to resolve phase-divergence in a new function This patch moves logic which does the revert and create a commit on top of public changeset because we need to repeat that logic while handling continuation of `hg evolve` when there are conflicts while rebasing the phase-divergent changeset. diff -r 8db32b33cdf1 -r 8d38b88233cb hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Sat Mar 24 16:38:03 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Sat Mar 24 16:41:14 2018 +0530 @@ -223,14 +223,7 @@ return (False, '') if progresscb: progresscb() - newid = tmpctx = None tmpctx = bumped - tr = repo.currenttransaction() - assert tr is not None - bmupdate = _bookmarksupdater(repo, bumped.node(), tr) - # function to update the bookmark from the rebased changeset to new resolved - # changeset - rebasedbmupdate = None # Checking for whether the phase-divergent changeset has common parents as # it's precursors. Phase-divergent changeset and precursor having different @@ -248,10 +241,6 @@ tmpctx = repo[tmpid] compat.createmarkers(repo, [(bumped, (tmpctx,))], operation='evolve') - # after rebasing, the changeset against which revert should - # happen should be the new rebased changeset - bumped = tmpctx - rebasedbmupdate = _bookmarksupdater(repo, bumped.node(), tr) except MergeFailure: evolvestate['current'] = bumped.hex() evolvestate['precursor'] = prec.hex() @@ -261,6 +250,22 @@ repo.ui.write_err(msg) raise + return _resolvephasedivergent(ui, repo, prec, bumped, tmpctx) + +def _resolvephasedivergent(ui, repo, prec, bumped, tmpctx=None): + + tr = repo.currenttransaction() + assert tr is not None + bmupdate = _bookmarksupdater(repo, bumped.node(), tr) + newid = None + + # function to update the bookmark from the rebased changeset to new resolved + # changeset + rebasedbmupdate = None + if tmpctx and tmpctx.node() != bumped.node(): + rebasedbmupdate = _bookmarksupdater(repo, tmpctx.node(), tr) + bumped = tmpctx + # Create the new commit context repo.ui.status(_('computing new diff\n')) files = set()