##// END OF EJS Templates
rebase: move abort/continue prep to be a method of the RR class...
Kostia Balytskyi -
r29472:f585ce68 default
parent child Browse files
Show More
@@ -227,6 +227,37 class rebaseruntime(object):
227 self.external = external
227 self.external = external
228 self.activebookmark = activebookmark
228 self.activebookmark = activebookmark
229
229
230 def _prepareabortorcontinue(self, isabort):
231 try:
232 self.restorestatus()
233 self.collapsemsg = restorecollapsemsg(self.repo)
234 except error.RepoLookupError:
235 if isabort:
236 clearstatus(self.repo)
237 clearcollapsemsg(self.repo)
238 self.repo.ui.warn(_('rebase aborted (no revision is removed,'
239 ' only broken state is cleared)\n'))
240 return 0
241 else:
242 msg = _('cannot continue inconsistent rebase')
243 hint = _('use "hg rebase --abort" to clear broken state')
244 raise error.Abort(msg, hint=hint)
245 if isabort:
246 return abort(self.repo, self.originalwd, self.target,
247 self.state, activebookmark=self.activebookmark)
248
249 self.obsoletenotrebased = {}
250 if self.ui.configbool('experimental', 'rebaseskipobsolete',
251 default=True):
252 rebaseobsrevs = set([r for r, st in self.state.items()
253 if st == revprecursor])
254 rebasesetrevs = set(self.state.keys())
255 self.obsoletenotrebased = _computeobsoletenotrebased(self.repo,
256 rebaseobsrevs, self.target)
257 rebaseobsskipped = set(self.obsoletenotrebased)
258 _checkobsrebase(self.repo, self.ui, rebaseobsrevs, rebasesetrevs,
259 rebaseobsskipped)
260
230 @command('rebase',
261 @command('rebase',
231 [('s', 'source', '',
262 [('s', 'source', '',
232 _('rebase the specified changeset and descendants'), _('REV')),
263 _('rebase the specified changeset and descendants'), _('REV')),
@@ -381,36 +412,9 def rebase(ui, repo, **opts):
381 if abortf and opts.get('tool', False):
412 if abortf and opts.get('tool', False):
382 ui.warn(_('tool option will be ignored\n'))
413 ui.warn(_('tool option will be ignored\n'))
383
414
384 try:
415 retcode = rbsrt._prepareabortorcontinue(abortf)
385 rbsrt.restorestatus()
416 if retcode is not None:
386 rbsrt.collapsemsg = restorecollapsemsg(repo)
417 return retcode
387 except error.RepoLookupError:
388 if abortf:
389 clearstatus(repo)
390 clearcollapsemsg(repo)
391 repo.ui.warn(_('rebase aborted (no revision is removed,'
392 ' only broken state is cleared)\n'))
393 return 0
394 else:
395 msg = _('cannot continue inconsistent rebase')
396 hint = _('use "hg rebase --abort" to clear broken state')
397 raise error.Abort(msg, hint=hint)
398 if abortf:
399 return abort(repo, rbsrt.originalwd, rbsrt.target,
400 rbsrt.state,
401 activebookmark=rbsrt.activebookmark)
402
403 rbsrt.obsoletenotrebased = {}
404 if ui.configbool('experimental', 'rebaseskipobsolete',
405 default=True):
406 rebaseobsrevs = set([r for r, st in rbsrt.state.items()
407 if st == revprecursor])
408 rebasesetrevs = set(rbsrt.state.keys())
409 rbsrt.obsoletenotrebased = _computeobsoletenotrebased(repo,
410 rebaseobsrevs, rbsrt.target)
411 rebaseobsskipped = set(rbsrt.obsoletenotrebased)
412 _checkobsrebase(repo, ui, rebaseobsrevs, rebasesetrevs,
413 rebaseobsskipped)
414 else:
418 else:
415 dest, rebaseset = _definesets(ui, repo, destf, srcf, basef, revf,
419 dest, rebaseset = _definesets(ui, repo, destf, srcf, basef, revf,
416 destspace=destspace)
420 destspace=destspace)
General Comments 0
You need to be logged in to leave comments. Login now