##// END OF EJS Templates
states: moved cmdutil.unfinishedstates to state.py...
Taapas Agrawal -
r42729:5f2f6912 default
parent child Browse files
Show More
@@ -2313,7 +2313,7 b' def summaryhook(ui, repo):'
2313
2313
2314 def extsetup(ui):
2314 def extsetup(ui):
2315 cmdutil.summaryhooks.add('histedit', summaryhook)
2315 cmdutil.summaryhooks.add('histedit', summaryhook)
2316 cmdutil.unfinishedstates.append(
2316 statemod.unfinishedstates.append(
2317 ['histedit-state', False, True, _('histedit in progress'),
2317 ['histedit-state', False, True, _('histedit in progress'),
2318 _("use 'hg histedit --continue' or 'hg histedit --abort'")])
2318 _("use 'hg histedit --continue' or 'hg histedit --abort'")])
2319 cmdutil.afterresolvedstates.append(
2319 cmdutil.afterresolvedstates.append(
@@ -1950,7 +1950,7 b' def uisetup(ui):'
1950 entry[1].append(('t', 'tool', '',
1950 entry[1].append(('t', 'tool', '',
1951 _("specify merge tool for rebase")))
1951 _("specify merge tool for rebase")))
1952 cmdutil.summaryhooks.add('rebase', summaryhook)
1952 cmdutil.summaryhooks.add('rebase', summaryhook)
1953 cmdutil.unfinishedstates.append(
1953 statemod.unfinishedstates.append(
1954 ['rebasestate', False, False, _('rebase in progress'),
1954 ['rebasestate', False, False, _('rebase in progress'),
1955 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1955 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1956 cmdutil.afterresolvedstates.append(
1956 cmdutil.afterresolvedstates.append(
@@ -48,6 +48,7 b' from mercurial import ('
48 registrar,
48 registrar,
49 repair,
49 repair,
50 scmutil,
50 scmutil,
51 state as statemod,
51 templatefilters,
52 templatefilters,
52 util,
53 util,
53 vfs as vfsmod,
54 vfs as vfsmod,
@@ -1139,9 +1140,10 b' def shelvecmd(ui, repo, *pats, **opts):'
1139 return createcmd(ui, repo, pats, opts)
1140 return createcmd(ui, repo, pats, opts)
1140
1141
1141 def extsetup(ui):
1142 def extsetup(ui):
1142 cmdutil.unfinishedstates.append(
1143 statemod.unfinishedstates.append(
1143 [shelvedstate._filename, False, False,
1144 [shelvedstate._filename, False, False,
1144 _('unshelve already in progress'),
1145 _('unshelve already in progress'),
1145 _("use 'hg unshelve --continue' or 'hg unshelve --abort'")])
1146 _("use 'hg unshelve --continue' or 'hg unshelve --abort'")])
1146 cmdutil.afterresolvedstates.append(
1147 cmdutil.afterresolvedstates.append(
1147 [shelvedstate._filename, _('hg unshelve --continue')])
1148 [shelvedstate._filename, _('hg unshelve --continue')])
1149
@@ -35,6 +35,7 b' from mercurial import ('
35 revset,
35 revset,
36 scmutil,
36 scmutil,
37 smartset,
37 smartset,
38 state as statemod,
38 util,
39 util,
39 vfs as vfsmod,
40 vfs as vfsmod,
40 )
41 )
@@ -757,7 +758,7 b' def kwtransplanted(context, mapping):'
757 return n and nodemod.hex(n) or ''
758 return n and nodemod.hex(n) or ''
758
759
759 def extsetup(ui):
760 def extsetup(ui):
760 cmdutil.unfinishedstates.append(
761 statemod.unfinishedstates.append(
761 ['transplant/journal', True, False, _('transplant in progress'),
762 ['transplant/journal', True, False, _('transplant in progress'),
762 _("use 'hg transplant --continue' or 'hg update' to abort")])
763 _("use 'hg transplant --continue' or 'hg update' to abort")])
763
764
@@ -42,6 +42,7 b' from . import ('
42 rewriteutil,
42 rewriteutil,
43 scmutil,
43 scmutil,
44 smartset,
44 smartset,
45 state as statemod,
45 subrepoutil,
46 subrepoutil,
46 templatekw,
47 templatekw,
47 templater,
48 templater,
@@ -3313,17 +3314,6 b' summaryhooks = util.hooks()'
3313 # - (desturl, destbranch, destpeer, outgoing)
3314 # - (desturl, destbranch, destpeer, outgoing)
3314 summaryremotehooks = util.hooks()
3315 summaryremotehooks = util.hooks()
3315
3316
3316 # A list of state files kept by multistep operations like graft.
3317 # Since graft cannot be aborted, it is considered 'clearable' by update.
3318 # note: bisect is intentionally excluded
3319 # (state file, clearable, allowcommit, error, hint)
3320 unfinishedstates = [
3321 ('graftstate', True, False, _('graft in progress'),
3322 _("use 'hg graft --continue' or 'hg graft --stop' to stop")),
3323 ('updatestate', True, False, _('last update was interrupted'),
3324 _("use 'hg update' to get a consistent checkout"))
3325 ]
3326
3327 def checkunfinished(repo, commit=False):
3317 def checkunfinished(repo, commit=False):
3328 '''Look for an unfinished multistep operation, like graft, and abort
3318 '''Look for an unfinished multistep operation, like graft, and abort
3329 if found. It's probably good to check this right before
3319 if found. It's probably good to check this right before
@@ -3331,13 +3321,13 b' def checkunfinished(repo, commit=False):'
3331 '''
3321 '''
3332 # Check for non-clearable states first, so things like rebase will take
3322 # Check for non-clearable states first, so things like rebase will take
3333 # precedence over update.
3323 # precedence over update.
3334 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3324 for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
3335 if clearable or (commit and allowcommit):
3325 if clearable or (commit and allowcommit):
3336 continue
3326 continue
3337 if repo.vfs.exists(f):
3327 if repo.vfs.exists(f):
3338 raise error.Abort(msg, hint=hint)
3328 raise error.Abort(msg, hint=hint)
3339
3329
3340 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3330 for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
3341 if not clearable or (commit and allowcommit):
3331 if not clearable or (commit and allowcommit):
3342 continue
3332 continue
3343 if repo.vfs.exists(f):
3333 if repo.vfs.exists(f):
@@ -3347,10 +3337,10 b' def clearunfinished(repo):'
3347 '''Check for unfinished operations (as above), and clear the ones
3337 '''Check for unfinished operations (as above), and clear the ones
3348 that are clearable.
3338 that are clearable.
3349 '''
3339 '''
3350 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3340 for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
3351 if not clearable and repo.vfs.exists(f):
3341 if not clearable and repo.vfs.exists(f):
3352 raise error.Abort(msg, hint=hint)
3342 raise error.Abort(msg, hint=hint)
3353 for f, clearable, allowcommit, msg, hint in unfinishedstates:
3343 for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
3354 if clearable and repo.vfs.exists(f):
3344 if clearable and repo.vfs.exists(f):
3355 util.unlink(repo.vfs.join(f))
3345 util.unlink(repo.vfs.join(f))
3356
3346
@@ -6148,7 +6148,6 b' def update(ui, repo, node=None, **opts):'
6148
6148
6149 with repo.wlock():
6149 with repo.wlock():
6150 cmdutil.clearunfinished(repo)
6150 cmdutil.clearunfinished(repo)
6151
6152 if date:
6151 if date:
6153 rev = cmdutil.finddate(ui, repo, date)
6152 rev = cmdutil.finddate(ui, repo, date)
6154
6153
@@ -19,6 +19,8 b' the data.'
19
19
20 from __future__ import absolute_import
20 from __future__ import absolute_import
21
21
22 from .i18n import _
23
22 from . import (
24 from . import (
23 error,
25 error,
24 util,
26 util,
@@ -85,3 +87,14 b' class cmdstate(object):'
85 def exists(self):
87 def exists(self):
86 """check whether the state file exists or not"""
88 """check whether the state file exists or not"""
87 return self._repo.vfs.exists(self.fname)
89 return self._repo.vfs.exists(self.fname)
90
91 # A list of state files kept by multistep operations like graft.
92 # Since graft cannot be aborted, it is considered 'clearable' by update.
93 # note: bisect is intentionally excluded
94 # (state file, clearable, allowcommit, error, hint)
95 unfinishedstates = [
96 ('graftstate', True, False, _('graft in progress'),
97 _("use 'hg graft --continue' or 'hg graft --stop' to stop")),
98 ('updatestate', True, False, _('last update was interrupted'),
99 _("use 'hg update' to get a consistent checkout"))
100 ]
General Comments 0
You need to be logged in to leave comments. Login now