Mercurial > evolve
changeset 4154:dd81d7f43857
evolve: extract displayer to _solveone()
I extracted this displayer method to _solveone() so that it would be
easy to pass a different template to show evolve msgs. In upcoming
patches we will be using stacktemplate in some cases where we want
to include stack alias s# in evolve msgs.
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Mon, 01 Oct 2018 19:59:17 +0530 |
parents | e1f6f9da82c1 |
children | cc3a0b13ae57 |
files | hgext3rd/evolve/evolvecmd.py |
diffstat | 1 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Mon Oct 01 13:20:30 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Mon Oct 01 19:59:17 2018 +0530 @@ -64,18 +64,21 @@ commit. If bool is False, this is ''. """ wlock = lock = tr = None + displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate}) try: wlock = repo.wlock() lock = repo.lock() tr = repo.transaction("evolve") if 'orphan' == category: - result = _solveunstable(ui, repo, ctx, evolvestate, dryrun, confirm, - progresscb, lastsolved=lastsolved) + result = _solveunstable(ui, repo, ctx, evolvestate, displayer, + dryrun, confirm, progresscb, + lastsolved=lastsolved) elif 'phasedivergent' == category: result = _solvephasedivergence(ui, repo, ctx, evolvestate, - dryrun, confirm, progresscb) + displayer, dryrun, confirm, + progresscb) elif 'contentdivergent' == category: - result = _solvedivergent(ui, repo, ctx, evolvestate, + result = _solvedivergent(ui, repo, ctx, evolvestate, displayer, dryrun, confirm, progresscb) else: assert False, "unknown trouble category: %s" % (category) @@ -84,8 +87,8 @@ finally: lockmod.release(tr, lock, wlock) -def _solveunstable(ui, repo, orig, evolvestate, dryrun=False, confirm=False, - progresscb=None, lastsolved=None): +def _solveunstable(ui, repo, orig, evolvestate, displayer, dryrun=False, + confirm=False, progresscb=None, lastsolved=None): """ Tries to stabilize the changeset orig which is orphan. returns a tuple (bool, newnode) where, @@ -154,7 +157,6 @@ target = repo[heads.first()] else: target = targets[0] - displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate}) target = repo[target] if not ui.quiet or confirm: repo.ui.write(_('move:'), label='evolve.operation') @@ -185,8 +187,8 @@ raise error.InterventionRequired(_("fix conflicts and see `hg help " "evolve.interrupted`")) -def _solvephasedivergence(ui, repo, bumped, evolvestate, dryrun=False, - confirm=False, progresscb=None): +def _solvephasedivergence(ui, repo, bumped, evolvestate, displayer, + dryrun=False, confirm=False, progresscb=None): """Stabilize a phase divergent changeset returns a tuple (bool, newnode) where, @@ -210,7 +212,6 @@ ui.write_err(msg) return (False, '') - displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate}) if not ui.quiet or confirm: repo.ui.write(_('recreate:'), label='evolve.operation') displayer.show(bumped) @@ -328,7 +329,7 @@ repo.dirstate.setparents(newid, nodemod.nullid) return (True, replacementnode) -def _solvedivergent(ui, repo, divergent, evolvestate, dryrun=False, +def _solvedivergent(ui, repo, divergent, evolvestate, displayer, dryrun=False, confirm=False, progresscb=None): """tries to solve content-divergence of a changeset @@ -445,7 +446,6 @@ ui.write_err(hint) return (False, '') - displayer = compat.changesetdisplayer(ui, repo, {'template': shorttemplate}) if not ui.quiet or confirm: ui.write(_('merge:'), label='evolve.operation') displayer.show(divergent)