##// END OF EJS Templates
statecheck: added support for cmdutil.afterresolvedstates...
Taapas Agrawal -
r42733:02310327 default
parent child Browse files
Show More
@@ -2313,6 +2313,6 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 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True)
2316 statemod.addunfinished('histedit', fname='histedit-state', allowcommit=True,
2317 cmdutil.afterresolvedstates.append(
2317 continueflag=True)
2318 ['histedit-state', _('hg histedit --continue')])
2318
@@ -1950,6 +1950,5 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 statemod.addunfinished('rebase', fname='rebasestate', stopflag=True)
1953 statemod.addunfinished('rebase', fname='rebasestate', stopflag=True,
1954 cmdutil.afterresolvedstates.append(
1954 continueflag=True)
1955 ['rebasestate', _('hg rebase --continue')])
@@ -1141,8 +1141,7 b' def shelvecmd(ui, repo, *pats, **opts):'
1141
1141
1142 def extsetup(ui):
1142 def extsetup(ui):
1143 statemod.addunfinished(
1143 statemod.addunfinished(
1144 'unshelve', fname=shelvedstate._filename,
1144 'unshelve', fname=shelvedstate._filename, continueflag=True,
1145 cmdmsg=_('unshelve already in progress')
1145 cmdmsg=_('unshelve already in progress')
1146 )
1146 )
1147 cmdutil.afterresolvedstates.append(
1147
1148 [shelvedstate._filename, _('hg unshelve --continue')])
@@ -3296,11 +3296,6 b' def clearunfinished(repo):'
3296 if s._clearable and s.isunfinished(repo):
3296 if s._clearable and s.isunfinished(repo):
3297 util.unlink(repo.vfs.join(s._fname))
3297 util.unlink(repo.vfs.join(s._fname))
3298
3298
3299 afterresolvedstates = [
3300 ('graftstate',
3301 _('hg graft --continue')),
3302 ]
3303
3304 def howtocontinue(repo):
3299 def howtocontinue(repo):
3305 '''Check for an unfinished operation and return the command to finish
3300 '''Check for an unfinished operation and return the command to finish
3306 it.
3301 it.
@@ -3312,9 +3307,11 b' def howtocontinue(repo):'
3312 a boolean.
3307 a boolean.
3313 '''
3308 '''
3314 contmsg = _("continue: %s")
3309 contmsg = _("continue: %s")
3315 for f, msg in afterresolvedstates:
3310 for state in statemod._unfinishedstates:
3316 if repo.vfs.exists(f):
3311 if not state._continueflag:
3317 return contmsg % msg, True
3312 continue
3313 if state.isunfinished(repo):
3314 return contmsg % state.continuemsg(), True
3318 if repo[None].dirty(missing=True, merge=False, branch=False):
3315 if repo[None].dirty(missing=True, merge=False, branch=False):
3319 return contmsg % _("hg commit"), False
3316 return contmsg % _("hg commit"), False
3320 return None, None
3317 return None, None
@@ -98,8 +98,8 b' class _statecheck(object):'
98 """
98 """
99
99
100 def __init__(self, opname, fname, clearable=False, allowcommit=False,
100 def __init__(self, opname, fname, clearable=False, allowcommit=False,
101 reportonly=False, stopflag=False, cmdmsg="", cmdhint="",
101 reportonly=False, continueflag=False, stopflag=False ,
102 statushint=""):
102 cmdmsg="", cmdhint="", statushint=""):
103 """opname is the name the command or operation
103 """opname is the name the command or operation
104 fname is the file name in which data should be stored in .hg directory.
104 fname is the file name in which data should be stored in .hg directory.
105 It is None for merge command.
105 It is None for merge command.
@@ -110,6 +110,8 b' class _statecheck(object):'
110 state or not.
110 state or not.
111 reportonly flag is used for operations like bisect where we just
111 reportonly flag is used for operations like bisect where we just
112 need to detect the operation using 'hg status --verbose'
112 need to detect the operation using 'hg status --verbose'
113 continueflag is a boolean determines whether or not a command supports
114 `--continue` option or not.
113 stopflag is a boolean that determines whether or not a command supports
115 stopflag is a boolean that determines whether or not a command supports
114 --stop flag
116 --stop flag
115 cmdmsg is used to pass a different status message in case standard
117 cmdmsg is used to pass a different status message in case standard
@@ -130,6 +132,7 b' class _statecheck(object):'
130 self._cmdmsg = cmdmsg
132 self._cmdmsg = cmdmsg
131 self._stopflag = stopflag
133 self._stopflag = stopflag
132 self._reportonly = reportonly
134 self._reportonly = reportonly
135 self._continueflag = continueflag
133
136
134 def statusmsg(self):
137 def statusmsg(self):
135 """returns the hint message corresponding to the command for
138 """returns the hint message corresponding to the command for
@@ -160,6 +163,10 b' class _statecheck(object):'
160 return _('%s in progress') % (self._opname)
163 return _('%s in progress') % (self._opname)
161 return self._cmdmsg
164 return self._cmdmsg
162
165
166 def continuemsg(self):
167 """ returns appropriate continue message corresponding to command"""
168 return _('hg %s --continue') % (self._opname)
169
163 def isunfinished(self, repo):
170 def isunfinished(self, repo):
164 """determines whether a multi-step operation is in progress
171 """determines whether a multi-step operation is in progress
165 or not
172 or not
@@ -183,7 +190,8 b' def addunfinished(opname, **kwargs):'
183
190
184 addunfinished(
191 addunfinished(
185 'graft', fname='graftstate', clearable=True, stopflag=True,
192 'graft', fname='graftstate', clearable=True, stopflag=True,
186 cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop"),
193 continueflag=True,
194 cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
187 )
195 )
188 addunfinished(
196 addunfinished(
189 'update', fname='updatestate', clearable=True,
197 'update', fname='updatestate', clearable=True,
General Comments 0
You need to be logged in to leave comments. Login now