##// END OF EJS Templates
rebase: prevent creating divergence...
Laurent Charignon -
r27746:f0e9f38d default
parent child Browse files
Show More
@@ -350,6 +350,17 b' def rebase(ui, repo, **opts):'
350 dest)
350 dest)
351 rebaseobsskipped = set(obsoletenotrebased)
351 rebaseobsskipped = set(obsoletenotrebased)
352
352
353 # Obsolete node with successors not in dest leads to divergence
354 divergenceok = ui.configbool('rebase',
355 'allowdivergence')
356 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
357
358 if divergencebasecandidates and not divergenceok:
359 msg = _("this rebase will cause divergence")
360 h = _("to force the rebase please set "
361 "rebase.allowdivergence=True")
362 raise error.Abort(msg, hint=h)
363
353 # - plain prune (no successor) changesets are rebased
364 # - plain prune (no successor) changesets are rebased
354 # - split changesets are not rebased if at least one of the
365 # - split changesets are not rebased if at least one of the
355 # changeset resulting from the split is an ancestor of dest
366 # changeset resulting from the split is an ancestor of dest
@@ -1323,6 +1323,13 b' have a definite end point.'
1323 ``assume-tty``
1323 ``assume-tty``
1324 If true, ALWAYS show a progress bar, unless disable is given.
1324 If true, ALWAYS show a progress bar, unless disable is given.
1325
1325
1326 ``rebase``
1327 ----------
1328
1329 ``allowdivergence``
1330 Default to False, when True allow creating divergence when performing
1331 rebase of obsolete changesets.
1332
1326 ``revsetalias``
1333 ``revsetalias``
1327 ---------------
1334 ---------------
1328
1335
@@ -712,3 +712,96 b' should display a friendly error message'
712 abort: all requested changesets have equivalents or were marked as obsolete
712 abort: all requested changesets have equivalents or were marked as obsolete
713 (to force the rebase, set the config experimental.rebaseskipobsolete to False)
713 (to force the rebase, set the config experimental.rebaseskipobsolete to False)
714 [255]
714 [255]
715
716 If a rebase is going to create divergence, it should abort
717
718 $ hg log -G
719 @ 11:f44da1f4954c nonrelevant
720 |
721 | o 10:121d9e3bc4c6 P
722 |/
723 o 9:4be60e099a77 C
724 |
725 o 6:9c48361117de D
726 |
727 o 2:261e70097290 B2
728 |
729 o 0:4a2df7238c3b A
730
731
732 $ hg up 9
733 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
734 $ echo "john" > doe
735 $ hg add doe
736 $ hg commit -m "john doe"
737 created new head
738 $ hg up 10
739 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
740 $ echo "foo" > bar
741 $ hg add bar
742 $ hg commit --amend -m "10'"
743 $ hg up 10 --hidden
744 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
745 $ echo "bar" > foo
746 $ hg add foo
747 $ hg commit -m "bar foo"
748 $ hg log -G
749 @ 15:73568ab6879d bar foo
750 |
751 | o 14:77d874d096a2 10'
752 | |
753 | | o 12:3eb461388009 john doe
754 | |/
755 x | 10:121d9e3bc4c6 P
756 |/
757 o 9:4be60e099a77 C
758 |
759 o 6:9c48361117de D
760 |
761 o 2:261e70097290 B2
762 |
763 o 0:4a2df7238c3b A
764
765 $ hg summary
766 parent: 15:73568ab6879d tip
767 bar foo
768 branch: default
769 commit: (clean)
770 update: 2 new changesets, 3 branch heads (merge)
771 phases: 8 draft
772 unstable: 1 changesets
773 $ hg rebase -s 10 -d 12
774 abort: this rebase will cause divergence
775 (to force the rebase please set rebase.allowdivergence=True)
776 [255]
777 $ hg log -G
778 @ 15:73568ab6879d bar foo
779 |
780 | o 14:77d874d096a2 10'
781 | |
782 | | o 12:3eb461388009 john doe
783 | |/
784 x | 10:121d9e3bc4c6 P
785 |/
786 o 9:4be60e099a77 C
787 |
788 o 6:9c48361117de D
789 |
790 o 2:261e70097290 B2
791 |
792 o 0:4a2df7238c3b A
793
794 With rebase.allowdivergence=True, rebase can create divergence
795
796 $ hg rebase -s 10 -d 12 --config rebase.allowdivergence=True
797 rebasing 10:121d9e3bc4c6 "P"
798 rebasing 15:73568ab6879d "bar foo" (tip)
799 $ hg summary
800 parent: 17:61bd55f69bc4 tip
801 bar foo
802 branch: default
803 commit: (clean)
804 update: 1 new changesets, 2 branch heads (merge)
805 phases: 8 draft
806 divergent: 2 changesets
807
General Comments 0
You need to be logged in to leave comments. Login now