Show More
@@ -258,6 +258,57 b' class rebaseruntime(object):' | |||||
258 | _checkobsrebase(self.repo, self.ui, rebaseobsrevs, rebasesetrevs, |
|
258 | _checkobsrebase(self.repo, self.ui, rebaseobsrevs, rebasesetrevs, | |
259 | rebaseobsskipped) |
|
259 | rebaseobsskipped) | |
260 |
|
260 | |||
|
261 | def _preparenewrebase(self, dest, rebaseset): | |||
|
262 | if dest is None: | |||
|
263 | return _nothingtorebase() | |||
|
264 | ||||
|
265 | allowunstable = obsolete.isenabled(self.repo, obsolete.allowunstableopt) | |||
|
266 | if (not (self.keepf or allowunstable) | |||
|
267 | and self.repo.revs('first(children(%ld) - %ld)', | |||
|
268 | rebaseset, rebaseset)): | |||
|
269 | raise error.Abort( | |||
|
270 | _("can't remove original changesets with" | |||
|
271 | " unrebased descendants"), | |||
|
272 | hint=_('use --keep to keep original changesets')) | |||
|
273 | ||||
|
274 | self.obsoletenotrebased = {} | |||
|
275 | if self.ui.configbool('experimental', 'rebaseskipobsolete', | |||
|
276 | default=True): | |||
|
277 | rebasesetrevs = set(rebaseset) | |||
|
278 | rebaseobsrevs = _filterobsoleterevs(self.repo, rebasesetrevs) | |||
|
279 | self.obsoletenotrebased = _computeobsoletenotrebased(self.repo, | |||
|
280 | rebaseobsrevs, | |||
|
281 | dest) | |||
|
282 | rebaseobsskipped = set(self.obsoletenotrebased) | |||
|
283 | _checkobsrebase(self.repo, self.ui, rebaseobsrevs, | |||
|
284 | rebasesetrevs, | |||
|
285 | rebaseobsskipped) | |||
|
286 | ||||
|
287 | result = buildstate(self.repo, dest, rebaseset, self.collapsef, | |||
|
288 | self.obsoletenotrebased) | |||
|
289 | ||||
|
290 | if not result: | |||
|
291 | # Empty state built, nothing to rebase | |||
|
292 | self.ui.status(_('nothing to rebase\n')) | |||
|
293 | return _nothingtorebase() | |||
|
294 | ||||
|
295 | root = min(rebaseset) | |||
|
296 | if not self.keepf and not self.repo[root].mutable(): | |||
|
297 | raise error.Abort(_("can't rebase public changeset %s") | |||
|
298 | % self.repo[root], | |||
|
299 | hint=_('see "hg help phases" for details')) | |||
|
300 | ||||
|
301 | (self.originalwd, self.target, self.state) = result | |||
|
302 | if self.collapsef: | |||
|
303 | self.targetancestors = self.repo.changelog.ancestors( | |||
|
304 | [self.target], | |||
|
305 | inclusive=True) | |||
|
306 | self.external = externalparent(self.repo, self.state, | |||
|
307 | self.targetancestors) | |||
|
308 | ||||
|
309 | if dest.closesbranch() and not self.keepbranchesf: | |||
|
310 | self.ui.status(_('reopening closed branch head %s\n') % dest) | |||
|
311 | ||||
261 | @command('rebase', |
|
312 | @command('rebase', | |
262 | [('s', 'source', '', |
|
313 | [('s', 'source', '', | |
263 | _('rebase the specified changeset and descendants'), _('REV')), |
|
314 | _('rebase the specified changeset and descendants'), _('REV')), | |
@@ -418,54 +469,9 b' def rebase(ui, repo, **opts):' | |||||
418 | else: |
|
469 | else: | |
419 | dest, rebaseset = _definesets(ui, repo, destf, srcf, basef, revf, |
|
470 | dest, rebaseset = _definesets(ui, repo, destf, srcf, basef, revf, | |
420 | destspace=destspace) |
|
471 | destspace=destspace) | |
421 | if dest is None: |
|
472 | retcode = rbsrt._preparenewrebase(dest, rebaseset) | |
422 | return _nothingtorebase() |
|
473 | if retcode is not None: | |
423 |
|
474 | return retcode | ||
424 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) |
|
|||
425 | if (not (rbsrt.keepf or allowunstable) |
|
|||
426 | and repo.revs('first(children(%ld) - %ld)', |
|
|||
427 | rebaseset, rebaseset)): |
|
|||
428 | raise error.Abort( |
|
|||
429 | _("can't remove original changesets with" |
|
|||
430 | " unrebased descendants"), |
|
|||
431 | hint=_('use --keep to keep original changesets')) |
|
|||
432 |
|
||||
433 | rbsrt.obsoletenotrebased = {} |
|
|||
434 | if ui.configbool('experimental', 'rebaseskipobsolete', |
|
|||
435 | default=True): |
|
|||
436 | rebasesetrevs = set(rebaseset) |
|
|||
437 | rebaseobsrevs = _filterobsoleterevs(repo, rebasesetrevs) |
|
|||
438 | rbsrt.obsoletenotrebased = _computeobsoletenotrebased(repo, |
|
|||
439 | rebaseobsrevs, |
|
|||
440 | dest) |
|
|||
441 | rebaseobsskipped = set(rbsrt.obsoletenotrebased) |
|
|||
442 | _checkobsrebase(repo, ui, rebaseobsrevs, |
|
|||
443 | rebasesetrevs, |
|
|||
444 | rebaseobsskipped) |
|
|||
445 |
|
||||
446 | result = buildstate(repo, dest, rebaseset, rbsrt.collapsef, |
|
|||
447 | rbsrt.obsoletenotrebased) |
|
|||
448 |
|
||||
449 | if not result: |
|
|||
450 | # Empty state built, nothing to rebase |
|
|||
451 | ui.status(_('nothing to rebase\n')) |
|
|||
452 | return _nothingtorebase() |
|
|||
453 |
|
||||
454 | root = min(rebaseset) |
|
|||
455 | if not rbsrt.keepf and not repo[root].mutable(): |
|
|||
456 | raise error.Abort(_("can't rebase public changeset %s") |
|
|||
457 | % repo[root], |
|
|||
458 | hint=_('see "hg help phases" for details')) |
|
|||
459 |
|
||||
460 | (rbsrt.originalwd, rbsrt.target, rbsrt.state) = result |
|
|||
461 | if rbsrt.collapsef: |
|
|||
462 | rbsrt.targetancestors = repo.changelog.ancestors([rbsrt.target], |
|
|||
463 | inclusive=True) |
|
|||
464 | rbsrt.external = externalparent(repo, rbsrt.state, |
|
|||
465 | rbsrt.targetancestors) |
|
|||
466 |
|
||||
467 | if dest.closesbranch() and not rbsrt.keepbranchesf: |
|
|||
468 | ui.status(_('reopening closed branch head %s\n') % dest) |
|
|||
469 |
|
475 | |||
470 | if rbsrt.keepbranchesf: |
|
476 | if rbsrt.keepbranchesf: | |
471 | # insert _savebranch at the start of extrafns so if |
|
477 | # insert _savebranch at the start of extrafns so if |
General Comments 0
You need to be logged in to leave comments.
Login now