Show More
@@ -390,7 +390,8 b' def rebase(ui, repo, **opts):' | |||||
390 | ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)), |
|
390 | ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)), | |
391 | _('changesets'), total) |
|
391 | _('changesets'), total) | |
392 | p1, p2, base = defineparents(repo, rev, target, state, |
|
392 | p1, p2, base = defineparents(repo, rev, target, state, | |
393 |
targetancestors |
|
393 | targetancestors, | |
|
394 | obsoletenotrebased) | |||
394 | storestatus(repo, originalwd, target, state, collapsef, keepf, |
|
395 | storestatus(repo, originalwd, target, state, collapsef, keepf, | |
395 | keepbranchesf, external, activebookmark) |
|
396 | keepbranchesf, external, activebookmark) | |
396 | storecollapsemsg(repo, collapsemsg) |
|
397 | storecollapsemsg(repo, collapsemsg) | |
@@ -455,7 +456,8 b' def rebase(ui, repo, **opts):' | |||||
455 |
|
456 | |||
456 | if collapsef and not keepopen: |
|
457 | if collapsef and not keepopen: | |
457 | p1, p2, _base = defineparents(repo, min(state), target, |
|
458 | p1, p2, _base = defineparents(repo, min(state), target, | |
458 |
state, targetancestors |
|
459 | state, targetancestors, | |
|
460 | obsoletenotrebased) | |||
459 | editopt = opts.get('edit') |
|
461 | editopt = opts.get('edit') | |
460 | editform = 'rebase.collapse' |
|
462 | editform = 'rebase.collapse' | |
461 | if collapsemsg: |
|
463 | if collapsemsg: | |
@@ -744,10 +746,12 b' def _checkobsrebase(repo, ui,' | |||||
744 | 'experimental.rebaseskipobsolete to False') |
|
746 | 'experimental.rebaseskipobsolete to False') | |
745 | raise error.Abort(msg, hint=hint) |
|
747 | raise error.Abort(msg, hint=hint) | |
746 |
|
748 | |||
747 |
def defineparents(repo, rev, target, state, targetancestors |
|
749 | def defineparents(repo, rev, target, state, targetancestors, | |
|
750 | obsoletenotrebased): | |||
748 | 'Return the new parent relationship of the revision that will be rebased' |
|
751 | 'Return the new parent relationship of the revision that will be rebased' | |
749 | parents = repo[rev].parents() |
|
752 | parents = repo[rev].parents() | |
750 | p1 = p2 = nullrev |
|
753 | p1 = p2 = nullrev | |
|
754 | rp1 = None | |||
751 |
|
755 | |||
752 | p1n = parents[0].rev() |
|
756 | p1n = parents[0].rev() | |
753 | if p1n in targetancestors: |
|
757 | if p1n in targetancestors: | |
@@ -771,6 +775,8 b' def defineparents(repo, rev, target, sta' | |||||
771 | if p2n in state: |
|
775 | if p2n in state: | |
772 | if p1 == target: # p1n in targetancestors or external |
|
776 | if p1 == target: # p1n in targetancestors or external | |
773 | p1 = state[p2n] |
|
777 | p1 = state[p2n] | |
|
778 | if p1 == revprecursor: | |||
|
779 | rp1 = obsoletenotrebased[p2n] | |||
774 | elif state[p2n] in revskipped: |
|
780 | elif state[p2n] in revskipped: | |
775 | p2 = nearestrebased(repo, p2n, state) |
|
781 | p2 = nearestrebased(repo, p2n, state) | |
776 | if p2 is None: |
|
782 | if p2 is None: | |
@@ -784,7 +790,7 b' def defineparents(repo, rev, target, sta' | |||||
784 | 'would have 3 parents') % rev) |
|
790 | 'would have 3 parents') % rev) | |
785 | p2 = p2n |
|
791 | p2 = p2n | |
786 | repo.ui.debug(" future parents are %d and %d\n" % |
|
792 | repo.ui.debug(" future parents are %d and %d\n" % | |
787 | (repo[p1].rev(), repo[p2].rev())) |
|
793 | (repo[rp1 or p1].rev(), repo[p2].rev())) | |
788 |
|
794 | |||
789 | if not any(p.rev() in state for p in parents): |
|
795 | if not any(p.rev() in state for p in parents): | |
790 | # Case (1) root changeset of a non-detaching rebase set. |
|
796 | # Case (1) root changeset of a non-detaching rebase set. | |
@@ -828,6 +834,8 b' def defineparents(repo, rev, target, sta' | |||||
828 | # make it feasible to consider different cases separately. In these |
|
834 | # make it feasible to consider different cases separately. In these | |
829 | # other cases we currently just leave it to the user to correctly |
|
835 | # other cases we currently just leave it to the user to correctly | |
830 | # resolve an impossible merge using a wrong ancestor. |
|
836 | # resolve an impossible merge using a wrong ancestor. | |
|
837 | # | |||
|
838 | # xx, p1 could be -4, and both parents could probably be -4... | |||
831 | for p in repo[rev].parents(): |
|
839 | for p in repo[rev].parents(): | |
832 | if state.get(p.rev()) == p1: |
|
840 | if state.get(p.rev()) == p1: | |
833 | base = p.rev() |
|
841 | base = p.rev() | |
@@ -838,7 +846,7 b' def defineparents(repo, rev, target, sta' | |||||
838 | # Raise because this function is called wrong (see issue 4106) |
|
846 | # Raise because this function is called wrong (see issue 4106) | |
839 | raise AssertionError('no base found to rebase on ' |
|
847 | raise AssertionError('no base found to rebase on ' | |
840 | '(defineparents called wrong)') |
|
848 | '(defineparents called wrong)') | |
841 | return p1, p2, base |
|
849 | return rp1 or p1, p2, base | |
842 |
|
850 | |||
843 | def isagitpatch(repo, patchname): |
|
851 | def isagitpatch(repo, patchname): | |
844 | 'Return true if the given patch is in git format' |
|
852 | 'Return true if the given patch is in git format' |
@@ -863,3 +863,56 b' Create the changes that we will rebase' | |||||
863 | rebasing 20:b82fb57ea638 "willconflict second version" |
|
863 | rebasing 20:b82fb57ea638 "willconflict second version" | |
864 | note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor" |
|
864 | note: not rebasing 21:8b31da3c4919 "dummy change", already in destination as 19:601db7a18f51 "dummy change successor" | |
865 | rebasing 22:7bdc8a87673d "dummy change" (tip) |
|
865 | rebasing 22:7bdc8a87673d "dummy change" (tip) | |
|
866 | $ cd .. | |||
|
867 | ||||
|
868 | rebase source is obsoleted (issue5198) | |||
|
869 | --------------------------------- | |||
|
870 | ||||
|
871 | $ hg clone base amended | |||
|
872 | updating to branch default | |||
|
873 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
874 | $ cd amended | |||
|
875 | $ hg up 9520eea781bc | |||
|
876 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
877 | $ echo 1 >> E | |||
|
878 | $ hg commit --amend -m "E'" | |||
|
879 | $ hg log -G | |||
|
880 | @ 9:69abe8906104 E' | |||
|
881 | | | |||
|
882 | | o 7:02de42196ebe H | |||
|
883 | | | | |||
|
884 | | | o 6:eea13746799a G | |||
|
885 | | |/| | |||
|
886 | | o | 5:24b6387c8c8c F | |||
|
887 | |/ / | |||
|
888 | | x 4:9520eea781bc E | |||
|
889 | |/ | |||
|
890 | | o 3:32af7686d403 D | |||
|
891 | | | | |||
|
892 | | o 2:5fddd98957c8 C | |||
|
893 | | | | |||
|
894 | | o 1:42ccdea3bb16 B | |||
|
895 | |/ | |||
|
896 | o 0:cd010b8cd998 A | |||
|
897 | ||||
|
898 | $ hg rebase -d . -s 9520eea781bc | |||
|
899 | note: not rebasing 4:9520eea781bc "E", already in destination as 9:69abe8906104 "E'" | |||
|
900 | rebasing 6:eea13746799a "G" | |||
|
901 | $ hg log -G | |||
|
902 | o 10:17be06e82e95 G | |||
|
903 | |\ | |||
|
904 | | @ 9:69abe8906104 E' | |||
|
905 | | | | |||
|
906 | +---o 7:02de42196ebe H | |||
|
907 | | | | |||
|
908 | o | 5:24b6387c8c8c F | |||
|
909 | |/ | |||
|
910 | | o 3:32af7686d403 D | |||
|
911 | | | | |||
|
912 | | o 2:5fddd98957c8 C | |||
|
913 | | | | |||
|
914 | | o 1:42ccdea3bb16 B | |||
|
915 | |/ | |||
|
916 | o 0:cd010b8cd998 A | |||
|
917 | ||||
|
918 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now