Mercurial > evolve
changeset 6703:cc49139f580f
evolve: drop cmdutil.STATES compatibility for hg 5.0
The diff is not looking great, but actually the change is pretty
straightforward. What was at some point living inside mercurial.cmdutil, now
lives in mercurial.state and has slightly more sophisticated API.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 11 Jan 2024 13:21:08 -0300 |
parents | 691a9301b51e |
children | 920f767589df |
files | hgext3rd/evolve/__init__.py |
diffstat | 1 files changed, 17 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Wed Jan 10 15:39:03 2024 -0300 +++ b/hgext3rd/evolve/__init__.py Thu Jan 11 13:21:08 2024 -0300 @@ -296,6 +296,7 @@ obsolete, pycompat, registrar, + state as statemod, util, ) @@ -1143,69 +1144,26 @@ evolvestateversion = 0 -def _evolvemessage(): +@eh.uisetup +def setupevolveunfinished(ui): _msg = _(b'To continue: hg evolve --continue\n' b'To abort: hg evolve --abort\n' b'To stop: hg evolve --stop\n' b'(also see `hg help evolve.interrupted`)') - return cmdutil._commentlines(_msg) - -def _fixupmessage(): - _msg = _(b'To continue: hg fixup --continue\n' - b'To abort: hg fixup --abort\n') - return cmdutil._commentlines(_msg) - -@eh.uisetup -def setupevolveunfinished(ui): - if not util.safehasattr(cmdutil, 'unfinishedstates'): - from mercurial import state as statemod - _msg = _(b'To continue: hg evolve --continue\n' - b'To abort: hg evolve --abort\n' - b'To stop: hg evolve --stop\n' - b'(also see `hg help evolve.interrupted`)') - statemod.addunfinished(b'evolve', fname=b'evolvestate', - continueflag=True, stopflag=True, - statushint=_msg, - abortfunc=evolvecmd.hgabortevolve, - continuefunc=evolvecmd.hgcontinueevolve) - statemod.addunfinished(b'pick', fname=b'pickstate', continueflag=True, - abortfunc=cmdrewrite.hgabortpick, - continuefunc=cmdrewrite.hgcontinuepick) - _fixup_msg = _(b'To continue: hg fixup --continue\n' - b'To abort: hg fixup --abort\n') - statemod.addunfinished(b'fixup', fname=b'fixup-state', - continueflag=True, statushint=_fixup_msg, - abortfunc=cmdrewrite.hgabortfixup, - continuefunc=cmdrewrite.hgcontinuefixup) - else: - # hg <= 5.0 (5f2f6912c9e6) - # pytype: disable=module-attr - estate = (b'evolvestate', False, False, _(b'evolve in progress'), - _(b"use 'hg evolve --continue' or 'hg evolve --abort' to abort")) - cmdutil.unfinishedstates.append(estate) - pstate = (b'pickstate', False, False, _(b'pick in progress'), - _(b"use 'hg pick --continue' or 'hg pick --abort' to abort")) - cmdutil.unfinishedstates.append(pstate) - fstate = (b'fixup-state', False, False, _(b'fixup in progress'), - _(b"use 'hg fixup --continue' or 'hg fixup --abort' to abort")) - cmdutil.unfinishedstates.append(fstate) - - afterresolved = (b'evolvestate', _(b'hg evolve --continue')) - pickresolved = (b'pickstate', _(b'hg pick --continue')) - fixupresolved = (b'fixup-state', _(b'hg fixup --continue')) - cmdutil.afterresolvedstates.append(afterresolved) - cmdutil.afterresolvedstates.append(pickresolved) - cmdutil.afterresolvedstates.append(fixupresolved) - # pytype: enable=module-attr - - # hg <= 5.0 (12243f15d53e) - if util.safehasattr(cmdutil, 'STATES'): - # pytype: disable=module-attr - cmdutil.STATES = ( - (b'evolve', cmdutil.fileexistspredicate(b'evolvestate'), _evolvemessage), - (b'fixup', cmdutil.fileexistspredicate(b'fixup-state'), _fixupmessage), - ) + cmdutil.STATES - # pytype: enable=module-attr + statemod.addunfinished(b'evolve', fname=b'evolvestate', + continueflag=True, stopflag=True, + statushint=_msg, + abortfunc=evolvecmd.hgabortevolve, + continuefunc=evolvecmd.hgcontinueevolve) + statemod.addunfinished(b'pick', fname=b'pickstate', continueflag=True, + abortfunc=cmdrewrite.hgabortpick, + continuefunc=cmdrewrite.hgcontinuepick) + _fixup_msg = _(b'To continue: hg fixup --continue\n' + b'To abort: hg fixup --abort\n') + statemod.addunfinished(b'fixup', fname=b'fixup-state', + continueflag=True, statushint=_fixup_msg, + abortfunc=cmdrewrite.hgabortfixup, + continuefunc=cmdrewrite.hgcontinuefixup) @eh.wrapfunction(hg, 'clean') def clean(orig, repo, *args, **kwargs):