96 It also has the ability to register and determine the states of any new |
96 It also has the ability to register and determine the states of any new |
97 multistep operation or multistep command extension. |
97 multistep operation or multistep command extension. |
98 """ |
98 """ |
99 |
99 |
100 def __init__(self, opname, fname, clearable, allowcommit, reportonly, |
100 def __init__(self, opname, fname, clearable, allowcommit, reportonly, |
101 continueflag, stopflag, cmdmsg, cmdhint, statushint): |
101 continueflag, stopflag, cmdmsg, cmdhint, statushint, |
|
102 abortfunc): |
102 self._opname = opname |
103 self._opname = opname |
103 self._fname = fname |
104 self._fname = fname |
104 self._clearable = clearable |
105 self._clearable = clearable |
105 self._allowcommit = allowcommit |
106 self._allowcommit = allowcommit |
106 self._reportonly = reportonly |
107 self._reportonly = reportonly |
107 self._continueflag = continueflag |
108 self._continueflag = continueflag |
108 self._stopflag = stopflag |
109 self._stopflag = stopflag |
109 self._cmdmsg = cmdmsg |
110 self._cmdmsg = cmdmsg |
110 self._cmdhint = cmdhint |
111 self._cmdhint = cmdhint |
111 self._statushint = statushint |
112 self._statushint = statushint |
|
113 self.abortfunc = abortfunc |
112 |
114 |
113 def statusmsg(self): |
115 def statusmsg(self): |
114 """returns the hint message corresponding to the command for |
116 """returns the hint message corresponding to the command for |
115 hg status --verbose |
117 hg status --verbose |
116 """ |
118 """ |
155 # A list of statecheck objects for multistep operations like graft. |
157 # A list of statecheck objects for multistep operations like graft. |
156 _unfinishedstates = [] |
158 _unfinishedstates = [] |
157 |
159 |
158 def addunfinished(opname, fname, clearable=False, allowcommit=False, |
160 def addunfinished(opname, fname, clearable=False, allowcommit=False, |
159 reportonly=False, continueflag=False, stopflag=False, |
161 reportonly=False, continueflag=False, stopflag=False, |
160 cmdmsg="", cmdhint="", statushint=""): |
162 cmdmsg="", cmdhint="", statushint="", abortfunc=None): |
161 """this registers a new command or operation to unfinishedstates |
163 """this registers a new command or operation to unfinishedstates |
162 opname is the name the command or operation |
164 opname is the name the command or operation |
163 fname is the file name in which data should be stored in .hg directory. |
165 fname is the file name in which data should be stored in .hg directory. |
164 It is None for merge command. |
166 It is None for merge command. |
165 clearable boolean determines whether or not interrupted states can be |
167 clearable boolean determines whether or not interrupted states can be |
179 message of the format "To continue: hg cmdname --continue |
181 message of the format "To continue: hg cmdname --continue |
180 To abort: hg cmdname --abort" is not desired. |
182 To abort: hg cmdname --abort" is not desired. |
181 statushint is used to pass a different status message in case standard |
183 statushint is used to pass a different status message in case standard |
182 message of the format ('To continue: hg cmdname --continue' |
184 message of the format ('To continue: hg cmdname --continue' |
183 'To abort: hg cmdname --abort') is not desired |
185 'To abort: hg cmdname --abort') is not desired |
|
186 abortfunc stores the function required to abort an unfinished state. |
184 """ |
187 """ |
185 statecheckobj = _statecheck(opname, fname, clearable, allowcommit, |
188 statecheckobj = _statecheck(opname, fname, clearable, allowcommit, |
186 reportonly, continueflag, stopflag, cmdmsg, |
189 reportonly, continueflag, stopflag, cmdmsg, |
187 cmdhint, statushint) |
190 cmdhint, statushint, abortfunc) |
188 if opname == 'merge': |
191 if opname == 'merge': |
189 _unfinishedstates.append(statecheckobj) |
192 _unfinishedstates.append(statecheckobj) |
190 else: |
193 else: |
191 _unfinishedstates.insert(0, statecheckobj) |
194 _unfinishedstates.insert(0, statecheckobj) |
192 |
195 |