test-rebase-scenario-global.t
676 lines
| 10.6 KiB
| text/troff
|
Tads3Lexer
/ tests / test-rebase-scenario-global.t
|
r12608 | $ cat >> $HGRCPATH <<EOF | ||
> [extensions] | ||||
> rebase= | ||||
> | ||||
|
r15742 | > [phases] | ||
> publish=False | ||||
> | ||||
|
r12608 | > [alias] | ||
> tglog = log -G --template "{rev}: '{desc}' {branches}\n" | ||||
> EOF | ||||
$ hg init a | ||||
$ cd a | ||||
|
r16350 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" | ||
|
r14118 | adding changesets | ||
adding manifests | ||||
adding file changes | ||||
|
r14119 | added 8 changesets with 7 changes to 7 files (+2 heads) | ||
|
r14118 | (run 'hg heads' to see heads, 'hg merge' to merge) | ||
$ hg up tip | ||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
|
r12608 | $ cd .. | ||
Rebasing | ||||
|
r14119 | D onto H - simple rebase: | ||
|
r12608 | |||
$ hg clone -q -u . a a1 | ||||
$ cd a1 | ||||
$ hg tglog | ||||
|
r14119 | @ 7: 'H' | ||
|
r12608 | | | ||
|
r14119 | | o 6: 'G' | ||
|/| | ||||
o | 5: 'F' | ||||
| | | ||||
|
r12608 | | o 4: 'E' | ||
|
r14119 | |/ | ||
| o 3: 'D' | ||||
|
r12608 | | | | ||
| o 2: 'C' | ||||
|
r14119 | | | | ||
|
r12608 | | o 1: 'B' | ||
|/ | ||||
o 0: 'A' | ||||
|
r14119 | |||
$ hg rebase -s 3 -d 7 | ||||
|
r12640 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob) | ||
|
r12608 | |||
$ hg tglog | ||||
|
r19925 | o 7: 'D' | ||
|
r17005 | | | ||
|
r19925 | @ 6: 'H' | ||
|
r17005 | | | ||
| o 5: 'G' | ||||
|/| | ||||
o | 4: 'F' | ||||
|
r12608 | | | | ||
|
r17005 | | o 3: 'E' | ||
|/ | ||||
| o 2: 'C' | ||||
|
r14119 | | | | ||
|
r17005 | | o 1: 'B' | ||
|
r12608 | |/ | ||
o 0: 'A' | ||||
$ cd .. | ||||
|
r14119 | D onto F - intermediate point: | ||
|
r12608 | |||
$ hg clone -q -u . a a2 | ||||
$ cd a2 | ||||
|
r14119 | $ hg rebase -s 3 -d 5 | ||
|
r12640 | saved backup bundle to $TESTTMP/a2/.hg/strip-backup/*-backup.hg (glob) | ||
|
r12608 | |||
$ hg tglog | ||||
|
r19925 | o 7: 'D' | ||
|
r17005 | | | ||
|
r19925 | | @ 6: 'H' | ||
|
r17005 | |/ | ||
| o 5: 'G' | ||||
|/| | ||||
o | 4: 'F' | ||||
|
r12608 | | | | ||
|
r17005 | | o 3: 'E' | ||
|/ | ||||
| o 2: 'C' | ||||
| | | ||||
| o 1: 'B' | ||||
|
r12608 | |/ | ||
o 0: 'A' | ||||
$ cd .. | ||||
|
r14119 | E onto H - skip of G: | ||
|
r12608 | |||
$ hg clone -q -u . a a3 | ||||
$ cd a3 | ||||
|
r14119 | $ hg rebase -s 4 -d 7 | ||
|
r12640 | saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob) | ||
|
r12608 | |||
$ hg tglog | ||||
|
r19925 | o 6: 'E' | ||
|
r14119 | | | ||
|
r19925 | @ 5: 'H' | ||
|
r12608 | | | ||
|
r14119 | o 4: 'F' | ||
|
r12608 | | | ||
|
r14119 | | o 3: 'D' | ||
| | | ||||
| o 2: 'C' | ||||
| | | ||||
|
r12608 | | o 1: 'B' | ||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
|
r14119 | F onto E - rebase of a branching point (skip G): | ||
|
r12608 | |||
$ hg clone -q -u . a a4 | ||||
$ cd a4 | ||||
|
r14119 | $ hg rebase -s 5 -d 4 | ||
|
r12640 | saved backup bundle to $TESTTMP/a4/.hg/strip-backup/*-backup.hg (glob) | ||
|
r12608 | |||
$ hg tglog | ||||
|
r14119 | @ 6: 'H' | ||
| | ||||
o 5: 'F' | ||||
|
r12608 | | | ||
|
r14119 | o 4: 'E' | ||
|
r12608 | | | ||
|
r14119 | | o 3: 'D' | ||
| | | ||||
| o 2: 'C' | ||||
| | | ||||
|
r12608 | | o 1: 'B' | ||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
|
r14119 | G onto H - merged revision having a parent in ancestors of target: | ||
|
r12608 | |||
$ hg clone -q -u . a a5 | ||||
$ cd a5 | ||||
|
r14119 | $ hg rebase -s 6 -d 7 | ||
|
r12640 | saved backup bundle to $TESTTMP/a5/.hg/strip-backup/*-backup.hg (glob) | ||
|
r12608 | |||
$ hg tglog | ||||
|
r19925 | o 7: 'G' | ||
|
r12608 | |\ | ||
|
r19925 | | @ 6: 'H' | ||
|
r12608 | | | | ||
|
r14119 | | o 5: 'F' | ||
| | | ||||
o | 4: 'E' | ||||
|/ | ||||
|
r12608 | | o 3: 'D' | ||
| | | ||||
|
r14119 | | o 2: 'C' | ||
| | | ||||
|
r12608 | | o 1: 'B' | ||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
|
r14119 | F onto B - G maintains E as parent: | ||
|
r12608 | |||
$ hg clone -q -u . a a6 | ||||
$ cd a6 | ||||
|
r14119 | $ hg rebase -s 5 -d 1 | ||
|
r12640 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob) | ||
|
r12608 | |||
$ hg tglog | ||||
|
r14119 | @ 7: 'H' | ||
|
r12608 | | | ||
|
r14119 | | o 6: 'G' | ||
|
r12608 | |/| | ||
|
r14119 | o | 5: 'F' | ||
| | | ||||
| o 4: 'E' | ||||
|
r12608 | | | | ||
|
r14119 | | | o 3: 'D' | ||
| | | | ||||
+---o 2: 'C' | ||||
|
r12608 | | | | ||
o | 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
These will fail (using --source): | ||||
|
r14119 | G onto F - rebase onto an ancestor: | ||
|
r12608 | |||
$ hg clone -q -u . a a7 | ||||
$ cd a7 | ||||
|
r14119 | $ hg rebase -s 6 -d 5 | ||
|
r15267 | nothing to rebase | ||
[1] | ||||
|
r12608 | |||
|
r14119 | F onto G - rebase onto a descendant: | ||
|
r12608 | |||
|
r14119 | $ hg rebase -s 5 -d 6 | ||
|
r12608 | abort: source is ancestor of destination | ||
[255] | ||||
|
r14119 | G onto B - merge revision with both parents not in ancestors of target: | ||
|
r12608 | |||
|
r14119 | $ hg rebase -s 6 -d 1 | ||
abort: cannot use revision 6 as base, result would have 3 parents | ||||
|
r12608 | [255] | ||
These will abort gracefully (using --base): | ||||
|
r14119 | G onto G - rebase onto same changeset: | ||
|
r12608 | |||
|
r14119 | $ hg rebase -b 6 -d 6 | ||
|
r20249 | nothing to rebase - eea13746799a is both "base" and destination | ||
|
r12608 | [1] | ||
|
r14119 | G onto F - rebase onto an ancestor: | ||
|
r12608 | |||
|
r14119 | $ hg rebase -b 6 -d 5 | ||
|
r12608 | nothing to rebase | ||
[1] | ||||
|
r14119 | F onto G - rebase onto a descendant: | ||
|
r12608 | |||
|
r14119 | $ hg rebase -b 5 -d 6 | ||
|
r20249 | nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a | ||
|
r12608 | [1] | ||
|
r15132 | C onto A - rebase onto an ancestor: | ||
$ hg rebase -d 0 -s 2 | ||||
|
r15447 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-backup.hg (glob) | ||
|
r15132 | $ hg tglog | ||
|
r19925 | o 7: 'D' | ||
|
r15132 | | | ||
o 6: 'C' | ||||
| | ||||
|
r19925 | | @ 5: 'H' | ||
|
r15132 | | | | ||
| | o 4: 'G' | ||||
| |/| | ||||
| o | 3: 'F' | ||||
|/ / | ||||
| o 2: 'E' | ||||
|/ | ||||
| o 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
|
r15742 | |||
Check rebasing public changeset | ||||
$ hg pull --config phases.publish=True -q -r 6 . # update phase of 6 | ||||
|
r19059 | $ hg rebase -d 0 -b 6 | ||
nothing to rebase | ||||
[1] | ||||
|
r15742 | $ hg rebase -d 5 -b 6 | ||
|
r15945 | abort: can't rebase immutable changeset e1c4361dd923 | ||
|
r15742 | (see hg help phases for details) | ||
[255] | ||||
$ hg rebase -d 5 -b 6 --keep | ||||
|
r15917 | |||
Check rebasing mutable changeset | ||||
Source phase greater or equal to destination phase: new changeset get the phase of source: | ||||
$ hg rebase -s9 -d0 | ||||
|
r16540 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-backup.hg (glob) | ||
|
r15917 | $ hg log --template "{phase}\n" -r 9 | ||
draft | ||||
$ hg rebase -s9 -d1 | ||||
|
r16540 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-backup.hg (glob) | ||
|
r15917 | $ hg log --template "{phase}\n" -r 9 | ||
draft | ||||
$ hg phase --force --secret 9 | ||||
$ hg rebase -s9 -d0 | ||||
|
r16540 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-backup.hg (glob) | ||
|
r15917 | $ hg log --template "{phase}\n" -r 9 | ||
secret | ||||
$ hg rebase -s9 -d1 | ||||
|
r16540 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-backup.hg (glob) | ||
|
r15917 | $ hg log --template "{phase}\n" -r 9 | ||
secret | ||||
Source phase lower than destination phase: new changeset get the phase of destination: | ||||
|
r17005 | $ hg rebase -s8 -d9 | ||
|
r17029 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-backup.hg (glob) | ||
|
r17005 | $ hg log --template "{phase}\n" -r 'rev(9)' | ||
|
r15917 | secret | ||
|
r15270 | $ cd .. | ||
|
r15132 | |||
|
r15270 | Test for revset | ||
We need a bit different graph | ||||
All destination are B | ||||
$ hg init ah | ||||
$ cd ah | ||||
|
r16350 | $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg" | ||
|
r15270 | adding changesets | ||
adding manifests | ||||
adding file changes | ||||
added 9 changesets with 9 changes to 9 files (+2 heads) | ||||
(run 'hg heads' to see heads, 'hg merge' to merge) | ||||
$ hg tglog | ||||
o 8: 'I' | ||||
| | ||||
o 7: 'H' | ||||
| | ||||
o 6: 'G' | ||||
| | ||||
| o 5: 'F' | ||||
| | | ||||
| o 4: 'E' | ||||
|/ | ||||
o 3: 'D' | ||||
| | ||||
o 2: 'C' | ||||
| | ||||
| o 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
Simple case with keep: | ||||
Source on have two descendant heads but ask for one | ||||
$ hg clone -q -u . ah ah1 | ||||
$ cd ah1 | ||||
$ hg rebase -r '2::8' -d 1 | ||||
abort: can't remove original changesets with unrebased descendants | ||||
(use --keep to keep original changesets) | ||||
[255] | ||||
$ hg rebase -r '2::8' -d 1 --keep | ||||
$ hg tglog | ||||
|
r19925 | o 13: 'I' | ||
|
r15270 | | | ||
o 12: 'H' | ||||
| | ||||
o 11: 'G' | ||||
| | ||||
o 10: 'D' | ||||
| | ||||
o 9: 'C' | ||||
| | ||||
| o 8: 'I' | ||||
| | | ||||
| o 7: 'H' | ||||
| | | ||||
| o 6: 'G' | ||||
| | | ||||
| | o 5: 'F' | ||||
| | | | ||||
| | o 4: 'E' | ||||
| |/ | ||||
| o 3: 'D' | ||||
| | | ||||
| o 2: 'C' | ||||
| | | ||||
o | 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
Base on have one descendant heads we ask for but common ancestor have two | ||||
$ hg clone -q -u . ah ah2 | ||||
$ cd ah2 | ||||
$ hg rebase -r '3::8' -d 1 | ||||
abort: can't remove original changesets with unrebased descendants | ||||
(use --keep to keep original changesets) | ||||
[255] | ||||
$ hg rebase -r '3::8' -d 1 --keep | ||||
$ hg tglog | ||||
|
r19925 | o 12: 'I' | ||
|
r15270 | | | ||
o 11: 'H' | ||||
| | ||||
o 10: 'G' | ||||
| | ||||
|
r17005 | o 9: 'D' | ||
| | ||||
| o 8: 'I' | ||||
| | | ||||
| o 7: 'H' | ||||
| | | ||||
| o 6: 'G' | ||||
| | | ||||
| | o 5: 'F' | ||||
|
r15270 | | | | | ||
|
r17005 | | | o 4: 'E' | ||
|
r15270 | | |/ | ||
|
r17005 | | o 3: 'D' | ||
| | | ||||
|
r15270 | | o 2: 'C' | ||
| | | ||||
o | 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
rebase subset | ||||
$ hg clone -q -u . ah ah3 | ||||
$ cd ah3 | ||||
$ hg rebase -r '3::7' -d 1 | ||||
abort: can't remove original changesets with unrebased descendants | ||||
(use --keep to keep original changesets) | ||||
[255] | ||||
$ hg rebase -r '3::7' -d 1 --keep | ||||
$ hg tglog | ||||
|
r19925 | o 11: 'H' | ||
|
r15270 | | | ||
o 10: 'G' | ||||
| | ||||
|
r17005 | o 9: 'D' | ||
| | ||||
| o 8: 'I' | ||||
| | | ||||
| o 7: 'H' | ||||
| | | ||||
| o 6: 'G' | ||||
| | | ||||
| | o 5: 'F' | ||||
|
r15270 | | | | | ||
|
r17005 | | | o 4: 'E' | ||
|
r15270 | | |/ | ||
|
r17005 | | o 3: 'D' | ||
| | | ||||
|
r15270 | | o 2: 'C' | ||
| | | ||||
o | 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
rebase subset with multiple head | ||||
$ hg clone -q -u . ah ah4 | ||||
$ cd ah4 | ||||
$ hg rebase -r '3::(7+5)' -d 1 | ||||
abort: can't remove original changesets with unrebased descendants | ||||
(use --keep to keep original changesets) | ||||
[255] | ||||
$ hg rebase -r '3::(7+5)' -d 1 --keep | ||||
$ hg tglog | ||||
|
r19925 | o 13: 'H' | ||
|
r15270 | | | ||
o 12: 'G' | ||||
| | ||||
| o 11: 'F' | ||||
| | | ||||
| o 10: 'E' | ||||
|/ | ||||
|
r17005 | o 9: 'D' | ||
| | ||||
| o 8: 'I' | ||||
| | | ||||
| o 7: 'H' | ||||
| | | ||||
| o 6: 'G' | ||||
| | | ||||
| | o 5: 'F' | ||||
|
r15270 | | | | | ||
|
r17005 | | | o 4: 'E' | ||
|
r15270 | | |/ | ||
|
r17005 | | o 3: 'D' | ||
| | | ||||
|
r15270 | | o 2: 'C' | ||
| | | ||||
o | 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
More advanced tests | ||||
rebase on ancestor with revset | ||||
$ hg clone -q -u . ah ah5 | ||||
$ cd ah5 | ||||
$ hg rebase -r '6::' -d 2 | ||||
|
r15447 | saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-backup.hg (glob) | ||
|
r15270 | $ hg tglog | ||
|
r19925 | o 8: 'I' | ||
|
r15270 | | | ||
o 7: 'H' | ||||
| | ||||
o 6: 'G' | ||||
| | ||||
| o 5: 'F' | ||||
| | | ||||
| o 4: 'E' | ||||
| | | ||||
| o 3: 'D' | ||||
|/ | ||||
o 2: 'C' | ||||
| | ||||
| o 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
$ cd .. | ||||
rebase with multiple root. | ||||
We rebase E and G on B | ||||
We would expect heads are I, F if it was supported | ||||
$ hg clone -q -u . ah ah6 | ||||
$ cd ah6 | ||||
$ hg rebase -r '(4+6)::' -d 1 | ||||
|
r18424 | saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-backup.hg (glob) | ||
$ hg tglog | ||||
|
r19925 | o 8: 'I' | ||
|
r18424 | | | ||
o 7: 'H' | ||||
| | ||||
o 6: 'G' | ||||
| | ||||
| o 5: 'F' | ||||
| | | ||||
| o 4: 'E' | ||||
|/ | ||||
| o 3: 'D' | ||||
| | | ||||
| o 2: 'C' | ||||
| | | ||||
o | 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
|
r15270 | $ cd .. | ||
|
r18424 | |||
|
r18644 | More complex rebase with multiple roots | ||
|
r18424 | each root have a different common ancestor with the destination and this is a detach | ||
(setup) | ||||
$ hg clone -q -u . a a8 | ||||
$ cd a8 | ||||
$ echo I > I | ||||
$ hg add I | ||||
$ hg commit -m I | ||||
$ hg up 4 | ||||
1 files updated, 0 files merged, 3 files removed, 0 files unresolved | ||||
$ echo I > J | ||||
$ hg add J | ||||
$ hg commit -m J | ||||
created new head | ||||
$ echo I > K | ||||
$ hg add K | ||||
$ hg commit -m K | ||||
$ hg tglog | ||||
@ 10: 'K' | ||||
| | ||||
o 9: 'J' | ||||
| | ||||
| o 8: 'I' | ||||
| | | ||||
| o 7: 'H' | ||||
| | | ||||
+---o 6: 'G' | ||||
| |/ | ||||
| o 5: 'F' | ||||
| | | ||||
o | 4: 'E' | ||||
|/ | ||||
| o 3: 'D' | ||||
| | | ||||
| o 2: 'C' | ||||
| | | ||||
| o 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
(actual test) | ||||
$ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)' | ||||
saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-backup.hg (glob) | ||||
$ hg log --rev 'children(desc(G))' | ||||
changeset: 9:adb617877056 | ||||
parent: 6:eea13746799a | ||||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: I | ||||
changeset: 10:882431a34a0e | ||||
tag: tip | ||||
parent: 6:eea13746799a | ||||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
summary: K | ||||
$ hg tglog | ||||
@ 10: 'K' | ||||
| | ||||
| o 9: 'I' | ||||
|/ | ||||
| o 8: 'J' | ||||
| | | ||||
| | o 7: 'H' | ||||
| | | | ||||
o---+ 6: 'G' | ||||
|/ / | ||||
| o 5: 'F' | ||||
| | | ||||
o | 4: 'E' | ||||
|/ | ||||
| o 3: 'D' | ||||
| | | ||||
| o 2: 'C' | ||||
| | | ||||
| o 1: 'B' | ||||
|/ | ||||
o 0: 'A' | ||||
|
r20335 | |||
Test that rebase is not confused by $CWD disapearing during rebase (issue 4121) | ||||
$ cd .. | ||||
$ hg init cwd-vanish | ||||
$ cd cwd-vanish | ||||
$ touch initial-file | ||||
$ hg add initial-file | ||||
$ hg commit -m 'initial commit' | ||||
$ touch dest-file | ||||
$ hg add dest-file | ||||
$ hg commit -m 'dest commit' | ||||
$ hg up 0 | ||||
0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
$ touch other-file | ||||
$ hg add other-file | ||||
$ hg commit -m 'first source commit' | ||||
created new head | ||||
$ mkdir subdir | ||||
$ cd subdir | ||||
$ touch subfile | ||||
$ hg add subfile | ||||
$ hg commit -m 'second source with subdir' | ||||
$ hg rebase -b . -d 1 --traceback | ||||
saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-backup.hg (glob) | ||||