This removes afterresolvedstates from cmdutil and adds
support for it in _statecheck class.
A new flag continueflag is added to the class to check whether an
operation supports --continue option or not.
Tests remain unchanged.
| durin42 | |
| martinvonz |
| hg-reviewers |
This removes afterresolvedstates from cmdutil and adds
support for it in _statecheck class.
A new flag continueflag is added to the class to check whether an
operation supports --continue option or not.
Tests remain unchanged.
| Lint Skipped |
| Unit Tests Skipped |
| mercurial/state.py | ||
|---|---|---|
| 135 | I'll move this up two lines in flight so it's consistent with the order above | |
| mercurial/state.py | ||
|---|---|---|
| 135 | Oh, it still won't be consistent... Can you send a follow-up to reorder these assignments to be consistent? | |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/histedit.py (2 lines) | |||
| M | hgext/rebase.py (2 lines) | |||
| M | hgext/shelve.py (2 lines) | |||
| M | mercurial/cmdutil.py (27 lines) | |||
| M | mercurial/state.py (23 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| ad7f82ce2038 | b5efa19594b4 | Taapas Agrawal | Jun 20 2019, 1:06 AM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | taapas1128 | ||
| Closed | taapas1128 | ||
| Closed | taapas1128 | ||
| Closed | taapas1128 | ||
| Closed | taapas1128 | ||
| Closed | taapas1128 | ||
| Closed | taapas1128 | ||
| Closed | taapas1128 |
| # i18n: column positioning for "hg summary" | # i18n: column positioning for "hg summary" | ||||
| ui.write(_('hist: %s (histedit --continue)\n') % | ui.write(_('hist: %s (histedit --continue)\n') % | ||||
| (ui.label(_('%d remaining'), 'histedit.remaining') % | (ui.label(_('%d remaining'), 'histedit.remaining') % | ||||
| len(state.actions))) | len(state.actions))) | ||||
| def extsetup(ui): | def extsetup(ui): | ||||
| cmdutil.summaryhooks.add('histedit', summaryhook) | cmdutil.summaryhooks.add('histedit', summaryhook) | ||||
| statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True) | statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True) | ||||
| cmdutil.afterresolvedstates.append( | statemod.afterresolvedstates.append( | ||||
| ['histedit-state', _('hg histedit --continue')]) | ['histedit-state', _('hg histedit --continue')]) | ||||
| #Replace pull with a decorator to provide --rebase option | #Replace pull with a decorator to provide --rebase option | ||||
| entry = extensions.wrapcommand(commands.table, 'pull', pullrebase) | entry = extensions.wrapcommand(commands.table, 'pull', pullrebase) | ||||
| entry[1].append(('', 'rebase', None, | entry[1].append(('', 'rebase', None, | ||||
| _("rebase working directory to branch head"))) | _("rebase working directory to branch head"))) | ||||
| entry[1].append(('t', 'tool', '', | entry[1].append(('t', 'tool', '', | ||||
| _("specify merge tool for rebase"))) | _("specify merge tool for rebase"))) | ||||
| cmdutil.summaryhooks.add('rebase', summaryhook) | cmdutil.summaryhooks.add('rebase', summaryhook) | ||||
| statemod.addunfinished('rebase', fname='rebasestate', stopflag=True) | statemod.addunfinished('rebase', fname='rebasestate', stopflag=True) | ||||
| cmdutil.afterresolvedstates.append( | statemod.afterresolvedstates.append( | ||||
| ['rebasestate', _('hg rebase --continue')]) | ['rebasestate', _('hg rebase --continue')]) | ||||
| else: | else: | ||||
| return createcmd(ui, repo, pats, opts) | return createcmd(ui, repo, pats, opts) | ||||
| def extsetup(ui): | def extsetup(ui): | ||||
| statemod.addunfinished( | statemod.addunfinished( | ||||
| 'unshelve', fname=shelvedstate._filename, | 'unshelve', fname=shelvedstate._filename, | ||||
| cmdmsg=_('unshelve already in progress') | cmdmsg=_('unshelve already in progress') | ||||
| ) | ) | ||||
| cmdutil.afterresolvedstates.append( | statemod.afterresolvedstates.append( | ||||
| [shelvedstate._filename, _('hg unshelve --continue')]) | [shelvedstate._filename, _('hg unshelve --continue')]) | ||||
| self._fname = fname | self._fname = fname | ||||
| self._clearable = clearable | self._clearable = clearable | ||||
| self._allowcommit = allowcommit | self._allowcommit = allowcommit | ||||
| self._cmdhint = cmdhint | self._cmdhint = cmdhint | ||||
| self._statushint = statushint | self._statushint = statushint | ||||
| self._cmdmsg = cmdmsg | self._cmdmsg = cmdmsg | ||||
| self._stopflag = stopflag | self._stopflag = stopflag | ||||
| self._reportonly = reportonly | self._reportonly = reportonly | ||||
I'll move this up two lines in flight so it's consistent with the order above martinvonz: I'll move this up two lines in flight so it's consistent with the order above | |||||
Oh, it still won't be consistent... Can you send a follow-up to reorder these assignments to be consistent? martinvonz: Oh, it still won't be consistent... Can you send a follow-up to reorder these assignments to be… | |||||
taapas1128: sure. | |||||
resolved in D6583 taapas1128: resolved in D6583 | |||||
| def statusmsg(self): | def statusmsg(self): | ||||
| """returns the hint message corresponding to the command for | """returns the hint message corresponding to the command for | ||||
| hg status --verbose | hg status --verbose | ||||
| """ | """ | ||||
| if not self._statushint: | if not self._statushint: | ||||
| hint = (_('To continue: hg %s --continue\n' | hint = (_('To continue: hg %s --continue\n' | ||||
| 'To abort: hg %s --abort') % (self._opname, | 'To abort: hg %s --abort') % (self._opname, | ||||
| self._opname)) | self._opname)) | ||||
| def getrepostate(repo): | def getrepostate(repo): | ||||
| # experimental config: commands.status.skipstates | # experimental config: commands.status.skipstates | ||||
| skip = set(repo.ui.configlist('commands', 'status.skipstates')) | skip = set(repo.ui.configlist('commands', 'status.skipstates')) | ||||
| for state in _unfinishedstates: | for state in _unfinishedstates: | ||||
| if state._opname in skip: | if state._opname in skip: | ||||
| continue | continue | ||||
| if state.isunfinished(repo): | if state.isunfinished(repo): | ||||
| return (state._opname, state.statusmsg()) | return (state._opname, state.statusmsg()) | ||||
| afterresolvedstates = [ | |||||
| ('graftstate', | |||||
| _('hg graft --continue')), | |||||
| ] | |||||
| def howtocontinue(repo): | |||||
| '''Check for an unfinished operation and return the command to finish | |||||
| it. | |||||
| afterresolvedstates tuples define a .hg/{file} and the corresponding | |||||
| command needed to finish it. | |||||
| Returns a (msg, warning) tuple. 'msg' is a string and 'warning' is | |||||
| a boolean. | |||||
| ''' | |||||
| contmsg = _("continue: %s") | |||||
| for f, msg in afterresolvedstates: | |||||
| if repo.vfs.exists(f): | |||||
| return contmsg % msg, True | |||||
| if repo[None].dirty(missing=True, merge=False, branch=False): | |||||
| return contmsg % _("hg commit"), False | |||||
| return None, None | |||||
Now that afterresolvedstates has been removed, you need to update this docstring.