129 subrepoopts = cmdutil.subrepoopts |
129 subrepoopts = cmdutil.subrepoopts |
130 debugrevlogopts = cmdutil.debugrevlogopts |
130 debugrevlogopts = cmdutil.debugrevlogopts |
131 |
131 |
132 # Commands start here, listed alphabetically |
132 # Commands start here, listed alphabetically |
133 |
133 |
|
134 @command('abort', |
|
135 dryrunopts, helpcategory=command.CATEGORY_CHANGE_MANAGEMENT, |
|
136 helpbasic=True) |
|
137 def abort(ui, repo, **opts): |
|
138 """abort an unfinished operation (EXPERIMENTAL) |
|
139 |
|
140 Aborts a multistep operation like graft, histedit, rebase, merge, |
|
141 and unshelve if they are in an unfinished state. |
|
142 |
|
143 use --dry-run/-n to dry run the command. |
|
144 A new operation can be added to this by registering the operation and |
|
145 abort logic in the unfinishedstates list under statemod. |
|
146 """ |
|
147 dryrun = opts.get(r'dry_run') |
|
148 abortstate = cmdutil.getunfinishedstate(repo) |
|
149 if not abortstate: |
|
150 raise error.Abort(_('no operation in progress')) |
|
151 if not abortstate.abortfunc: |
|
152 raise error.Abort((_("%s in progress but does not support 'hg abort'") % |
|
153 (abortstate._opname)), hint=abortstate.hint()) |
|
154 if dryrun: |
|
155 ui.status(_('%s in progress, will be aborted\n') % (abortstate._opname)) |
|
156 return |
|
157 return abortstate.abortfunc(ui, repo) |
|
158 |
134 @command('add', |
159 @command('add', |
135 walkopts + subrepoopts + dryrunopts, |
160 walkopts + subrepoopts + dryrunopts, |
136 _('[OPTION]... [FILE]...'), |
161 _('[OPTION]... [FILE]...'), |
137 helpcategory=command.CATEGORY_WORKING_DIRECTORY, |
162 helpcategory=command.CATEGORY_WORKING_DIRECTORY, |
138 helpbasic=True, inferrepo=True) |
163 helpbasic=True, inferrepo=True) |