Show More
@@ -305,31 +305,9 b' def rebase(ui, repo, **opts):' | |||
|
305 | 305 | rebaseobsrevs, |
|
306 | 306 | dest) |
|
307 | 307 | rebaseobsskipped = set(obsoletenotrebased) |
|
308 | ||
|
309 | # Obsolete node with successors not in dest leads to divergence | |
|
310 | divergenceok = ui.configbool('experimental', | |
|
311 | 'allowdivergence') | |
|
312 | divergencebasecandidates = rebaseobsrevs - rebaseobsskipped | |
|
313 | ||
|
314 | if divergencebasecandidates and not divergenceok: | |
|
315 | divhashes = (str(repo[r]) | |
|
316 | for r in divergencebasecandidates) | |
|
317 | msg = _("this rebase will cause " | |
|
318 | "divergences from: %s") | |
|
319 | h = _("to force the rebase please set " | |
|
320 | "experimental.allowdivergence=True") | |
|
321 | raise error.Abort(msg % (",".join(divhashes),), hint=h) | |
|
322 | ||
|
323 | # - plain prune (no successor) changesets are rebased | |
|
324 | # - split changesets are not rebased if at least one of the | |
|
325 | # changeset resulting from the split is an ancestor of dest | |
|
326 | rebaseset = rebasesetrevs - rebaseobsskipped | |
|
327 | if rebasesetrevs and not rebaseset: | |
|
328 | msg = _('all requested changesets have equivalents ' | |
|
329 | 'or were marked as obsolete') | |
|
330 | hint = _('to force the rebase, set the config ' | |
|
331 | 'experimental.rebaseskipobsolete to False') | |
|
332 | raise error.Abort(msg, hint=hint) | |
|
308 | _checkobsrebase(repo, ui, rebaseobsrevs, | |
|
309 | rebasesetrevs, | |
|
310 | rebaseobsskipped) | |
|
333 | 311 | |
|
334 | 312 | result = buildstate(repo, dest, rebaseset, collapsef, |
|
335 | 313 | obsoletenotrebased) |
@@ -709,6 +687,43 b' def nearestrebased(repo, rev, state):' | |||
|
709 | 687 | else: |
|
710 | 688 | return None |
|
711 | 689 | |
|
690 | def _checkobsrebase(repo, ui, | |
|
691 | rebaseobsrevs, | |
|
692 | rebasesetrevs, | |
|
693 | rebaseobsskipped): | |
|
694 | """ | |
|
695 | Abort if rebase will create divergence or rebase is noop because of markers | |
|
696 | ||
|
697 | `rebaseobsrevs`: set of obsolete revision in source | |
|
698 | `rebasesetrevs`: set of revisions to be rebased from source | |
|
699 | `rebaseobsskipped`: set of revisions from source skipped because they have | |
|
700 | successors in destination | |
|
701 | """ | |
|
702 | # Obsolete node with successors not in dest leads to divergence | |
|
703 | divergenceok = ui.configbool('experimental', | |
|
704 | 'allowdivergence') | |
|
705 | divergencebasecandidates = rebaseobsrevs - rebaseobsskipped | |
|
706 | ||
|
707 | if divergencebasecandidates and not divergenceok: | |
|
708 | divhashes = (str(repo[r]) | |
|
709 | for r in divergencebasecandidates) | |
|
710 | msg = _("this rebase will cause " | |
|
711 | "divergences from: %s") | |
|
712 | h = _("to force the rebase please set " | |
|
713 | "experimental.allowdivergence=True") | |
|
714 | raise error.Abort(msg % (",".join(divhashes),), hint=h) | |
|
715 | ||
|
716 | # - plain prune (no successor) changesets are rebased | |
|
717 | # - split changesets are not rebased if at least one of the | |
|
718 | # changeset resulting from the split is an ancestor of dest | |
|
719 | rebaseset = rebasesetrevs - rebaseobsskipped | |
|
720 | if rebasesetrevs and not rebaseset: | |
|
721 | msg = _('all requested changesets have equivalents ' | |
|
722 | 'or were marked as obsolete') | |
|
723 | hint = _('to force the rebase, set the config ' | |
|
724 | 'experimental.rebaseskipobsolete to False') | |
|
725 | raise error.Abort(msg, hint=hint) | |
|
726 | ||
|
712 | 727 | def defineparents(repo, rev, target, state, targetancestors): |
|
713 | 728 | 'Return the new parent relationship of the revision that will be rebased' |
|
714 | 729 | parents = repo[rev].parents() |
General Comments 0
You need to be logged in to leave comments.
Login now