##// END OF EJS Templates
continue: added logic for hg continue...
Taapas Agrawal -
r42831:3c16b9c0 default
parent child Browse files
Show More
@@ -1893,6 +1893,32 b' def config(ui, repo, *values, **opts):'
1893 return 0
1893 return 0
1894 return 1
1894 return 1
1895
1895
1896 @command('continue',
1897 dryrunopts, helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
1898 helpbasic=True)
1899 def continuecmd(ui, repo, **opts):
1900 """resumes an interrupted operation (EXPERIMENTAL)
1901
1902 Finishes a multistep operation like graft, histedit, rebase, merge,
1903 and unshelve if they are in an interrupted state.
1904
1905 use --dry-run/-n to dry run the command.
1906 A new operation can be added to this by registering the operation and
1907 continue logic in the unfinishedstates list under statemod.
1908 """
1909 dryrun = opts.get(r'dry_run')
1910 contstate = cmdutil.getunfinishedstate(repo)
1911 if not contstate:
1912 raise error.Abort(_('no operation in progress'))
1913 if not contstate.continuefunc:
1914 raise error.Abort((_("%s in progress but does not support "
1915 "'hg continue'") % (contstate._opname)),
1916 hint=contstate.continuemsg())
1917 if dryrun:
1918 ui.status(_('%s in progress, will be resumed\n') % (contstate._opname))
1919 return
1920 return contstate.continuefunc(ui, repo)
1921
1896 @command('copy|cp',
1922 @command('copy|cp',
1897 [('A', 'after', None, _('record a copy that has already occurred')),
1923 [('A', 'after', None, _('record a copy that has already occurred')),
1898 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1924 ('f', 'force', None, _('forcibly copy over an existing managed file')),
@@ -99,7 +99,7 b' class _statecheck(object):'
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 abortfunc, continuefunc):
103 self._opname = opname
103 self._opname = opname
104 self._fname = fname
104 self._fname = fname
105 self._clearable = clearable
105 self._clearable = clearable
@@ -111,6 +111,7 b' class _statecheck(object):'
111 self._cmdhint = cmdhint
111 self._cmdhint = cmdhint
112 self._statushint = statushint
112 self._statushint = statushint
113 self.abortfunc = abortfunc
113 self.abortfunc = abortfunc
114 self.continuefunc = continuefunc
114
115
115 def statusmsg(self):
116 def statusmsg(self):
116 """returns the hint message corresponding to the command for
117 """returns the hint message corresponding to the command for
@@ -159,7 +160,8 b' class _statecheck(object):'
159
160
160 def addunfinished(opname, fname, clearable=False, allowcommit=False,
161 def addunfinished(opname, fname, clearable=False, allowcommit=False,
161 reportonly=False, continueflag=False, stopflag=False,
162 reportonly=False, continueflag=False, stopflag=False,
162 cmdmsg="", cmdhint="", statushint="", abortfunc=None):
163 cmdmsg="", cmdhint="", statushint="", abortfunc=None,
164 continuefunc=None):
163 """this registers a new command or operation to unfinishedstates
165 """this registers a new command or operation to unfinishedstates
164 opname is the name the command or operation
166 opname is the name the command or operation
165 fname is the file name in which data should be stored in .hg directory.
167 fname is the file name in which data should be stored in .hg directory.
@@ -184,10 +186,12 b' def addunfinished(opname, fname, clearab'
184 message of the format ('To continue: hg cmdname --continue'
186 message of the format ('To continue: hg cmdname --continue'
185 'To abort: hg cmdname --abort') is not desired
187 'To abort: hg cmdname --abort') is not desired
186 abortfunc stores the function required to abort an unfinished state.
188 abortfunc stores the function required to abort an unfinished state.
189 continuefunc stores the function required to finish an interrupted
190 operation.
187 """
191 """
188 statecheckobj = _statecheck(opname, fname, clearable, allowcommit,
192 statecheckobj = _statecheck(opname, fname, clearable, allowcommit,
189 reportonly, continueflag, stopflag, cmdmsg,
193 reportonly, continueflag, stopflag, cmdmsg,
190 cmdhint, statushint, abortfunc)
194 cmdhint, statushint, abortfunc, continuefunc)
191 if opname == 'merge':
195 if opname == 'merge':
192 _unfinishedstates.append(statecheckobj)
196 _unfinishedstates.append(statecheckobj)
193 else:
197 else:
@@ -15,6 +15,7 b' Show all commands except debug commands'
15 clone
15 clone
16 commit
16 commit
17 config
17 config
18 continue
18 copy
19 copy
19 diff
20 diff
20 export
21 export
@@ -252,6 +253,7 b' Show all commands + options'
252 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
253 clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure
253 commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos
254 commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos
254 config: untrusted, edit, local, global, template
255 config: untrusted, edit, local, global, template
256 continue: dry-run
255 copy: after, force, include, exclude, dry-run
257 copy: after, force, include, exclude, dry-run
256 debugancestor:
258 debugancestor:
257 debugapplystreamclonebundle:
259 debugapplystreamclonebundle:
@@ -408,6 +408,7 b' Test short command list with verbose opt'
408 show changeset information by line for each file
408 show changeset information by line for each file
409 clone make a copy of an existing repository
409 clone make a copy of an existing repository
410 commit, ci commit the specified files or all outstanding changes
410 commit, ci commit the specified files or all outstanding changes
411 continue resumes an interrupted operation (EXPERIMENTAL)
411 diff diff repository (or selected files)
412 diff diff repository (or selected files)
412 export dump the header and diffs for one or more changesets
413 export dump the header and diffs for one or more changesets
413 forget forget the specified files on the next commit
414 forget forget the specified files on the next commit
@@ -2389,6 +2390,13 b' Dish up an empty repo; serve it cold.'
2389 commit the specified files or all outstanding changes
2390 commit the specified files or all outstanding changes
2390 </td></tr>
2391 </td></tr>
2391 <tr><td>
2392 <tr><td>
2393 <a href="/help/continue">
2394 continue
2395 </a>
2396 </td><td>
2397 resumes an interrupted operation (EXPERIMENTAL)
2398 </td></tr>
2399 <tr><td>
2392 <a href="/help/diff">
2400 <a href="/help/diff">
2393 diff
2401 diff
2394 </a>
2402 </a>
@@ -1895,6 +1895,10 b' help/ shows help topics'
1895 "topic": "commit"
1895 "topic": "commit"
1896 },
1896 },
1897 {
1897 {
1898 "summary": "resumes an interrupted operation (EXPERIMENTAL)",
1899 "topic": "continue"
1900 },
1901 {
1898 "summary": "diff repository (or selected files)",
1902 "summary": "diff repository (or selected files)",
1899 "topic": "diff"
1903 "topic": "diff"
1900 },
1904 },
General Comments 0
You need to be logged in to leave comments. Login now