test-rebase-rename.t
388 lines
| 9.1 KiB
| text/troff
|
Tads3Lexer
/ tests / test-rebase-rename.t
Adrian Buehlmann
|
r12608 | $ cat >> $HGRCPATH <<EOF | ||
> [extensions] | ||||
> rebase= | ||||
> | ||||
> [alias] | ||||
Phil Cohen
|
r35386 | > tlog = log --template "{rev}: {node|short} '{desc}' {branches}\n" | ||
Adrian Buehlmann
|
r12608 | > tglog = tlog --graph | ||
> EOF | ||||
$ hg init a | ||||
$ cd a | ||||
Matt Mackall
|
r18739 | $ mkdir d | ||
Adrian Buehlmann
|
r12608 | $ echo a > a | ||
$ hg ci -Am A | ||||
adding a | ||||
Matt Mackall
|
r18739 | $ echo b > d/b | ||
Adrian Buehlmann
|
r12608 | $ hg ci -Am B | ||
Matt Mackall
|
r18739 | adding d/b | ||
Adrian Buehlmann
|
r12608 | |||
Matt Mackall
|
r18739 | $ hg mv d d-renamed | ||
Matt Harbison
|
r35394 | moving d/b to d-renamed/b | ||
Siddharth Agarwal
|
r18136 | $ hg ci -m 'rename B' | ||
$ hg up -q -C 1 | ||||
Adrian Buehlmann
|
r12608 | |||
$ hg mv a a-renamed | ||||
Matt Mackall
|
r18739 | $ echo x > d/x | ||
$ hg add d/x | ||||
Adrian Buehlmann
|
r12608 | |||
$ hg ci -m 'rename A' | ||||
created new head | ||||
$ hg tglog | ||||
Phil Cohen
|
r35386 | @ 3: 73a3ee40125d 'rename A' | ||
Adrian Buehlmann
|
r12608 | | | ||
Phil Cohen
|
r35386 | | o 2: 220d0626d185 'rename B' | ||
Adrian Buehlmann
|
r12608 | |/ | ||
Phil Cohen
|
r35386 | o 1: 3ab5da9a5c01 'B' | ||
Siddharth Agarwal
|
r18136 | | | ||
Phil Cohen
|
r35386 | o 0: 1994f17a630e 'A' | ||
Adrian Buehlmann
|
r12608 | |||
Rename is tracked: | ||||
$ hg tlog -p --git -r tip | ||||
Phil Cohen
|
r35386 | 3: 73a3ee40125d 'rename A' | ||
Adrian Buehlmann
|
r12608 | diff --git a/a b/a-renamed | ||
rename from a | ||||
rename to a-renamed | ||||
Matt Mackall
|
r18739 | diff --git a/d/x b/d/x | ||
new file mode 100644 | ||||
--- /dev/null | ||||
+++ b/d/x | ||||
@@ -0,0 +1,1 @@ | ||||
+x | ||||
Adrian Buehlmann
|
r12608 | |||
Rebase the revision containing the rename: | ||||
Siddharth Agarwal
|
r18136 | $ hg rebase -s 3 -d 2 | ||
Mads Kiilerich
|
r23517 | rebasing 3:73a3ee40125d "rename A" (tip) | ||
Matt Harbison
|
r35394 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/73a3ee40125d-1d78ebcf-rebase.hg | ||
Adrian Buehlmann
|
r12608 | |||
$ hg tglog | ||||
Phil Cohen
|
r35386 | @ 3: 032a9b75e83b 'rename A' | ||
Siddharth Agarwal
|
r18136 | | | ||
Phil Cohen
|
r35386 | o 2: 220d0626d185 'rename B' | ||
Adrian Buehlmann
|
r12608 | | | ||
Phil Cohen
|
r35386 | o 1: 3ab5da9a5c01 'B' | ||
Adrian Buehlmann
|
r12608 | | | ||
Phil Cohen
|
r35386 | o 0: 1994f17a630e 'A' | ||
Adrian Buehlmann
|
r12608 | |||
Rename is not lost: | ||||
$ hg tlog -p --git -r tip | ||||
Phil Cohen
|
r35386 | 3: 032a9b75e83b 'rename A' | ||
Adrian Buehlmann
|
r12608 | diff --git a/a b/a-renamed | ||
rename from a | ||||
rename to a-renamed | ||||
Matt Mackall
|
r18739 | diff --git a/d-renamed/x b/d-renamed/x | ||
new file mode 100644 | ||||
--- /dev/null | ||||
+++ b/d-renamed/x | ||||
@@ -0,0 +1,1 @@ | ||||
+x | ||||
Adrian Buehlmann
|
r12608 | |||
Siddharth Agarwal
|
r18136 | |||
Rebased revision does not contain information about b (issue3739) | ||||
$ hg log -r 3 --debug | ||||
Matt Mackall
|
r18739 | changeset: 3:032a9b75e83bff1dcfb6cbfa4ef50a704bf1b569 | ||
Siddharth Agarwal
|
r18136 | tag: tip | ||
phase: draft | ||||
Matt Mackall
|
r18739 | parent: 2:220d0626d185f372d9d8f69d9c73b0811d7725f7 | ||
Siddharth Agarwal
|
r18136 | parent: -1:0000000000000000000000000000000000000000 | ||
Matt Mackall
|
r18739 | manifest: 3:035d66b27a1b06b2d12b46d41a39adb7a200c370 | ||
Siddharth Agarwal
|
r18136 | user: test | ||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
Matt Mackall
|
r18739 | files+: a-renamed d-renamed/x | ||
Siddharth Agarwal
|
r18136 | files-: a | ||
extra: branch=default | ||||
Matt Mackall
|
r18739 | extra: rebase_source=73a3ee40125d6f0f347082e5831ceccb3f005f8a | ||
Siddharth Agarwal
|
r18136 | description: | ||
rename A | ||||
Martin von Zweigbergk
|
r44604 | $ repeatchange() { | ||
> hg checkout $1 | ||||
> hg cp a z | ||||
> echo blah >> z | ||||
> hg commit -Am "$2" --user "$3" | ||||
> } | ||||
$ repeatchange 1 "E" "user1" | ||||
2 files updated, 0 files merged, 3 files removed, 0 files unresolved | ||||
created new head | ||||
$ repeatchange 1 "E" "user2" | ||||
0 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
created new head | ||||
$ hg tglog | ||||
@ 5: af8ad1f97097 'E' | ||||
| | ||||
| o 4: 60f545c27784 'E' | ||||
|/ | ||||
| o 3: 032a9b75e83b 'rename A' | ||||
| | | ||||
| o 2: 220d0626d185 'rename B' | ||||
|/ | ||||
o 1: 3ab5da9a5c01 'B' | ||||
| | ||||
o 0: 1994f17a630e 'A' | ||||
$ hg rebase -s 5 -d 4 | ||||
rebasing 5:af8ad1f97097 "E" (tip) | ||||
note: not rebasing 5:af8ad1f97097 "E" (tip), its destination already has all its changes | ||||
saved backup bundle to $TESTTMP/a/.hg/strip-backup/af8ad1f97097-c3e90708-rebase.hg | ||||
$ hg tglog | ||||
@ 4: 60f545c27784 'E' | ||||
| | ||||
| o 3: 032a9b75e83b 'rename A' | ||||
| | | ||||
| o 2: 220d0626d185 'rename B' | ||||
|/ | ||||
o 1: 3ab5da9a5c01 'B' | ||||
| | ||||
o 0: 1994f17a630e 'A' | ||||
$ hg export tip | ||||
# HG changeset patch | ||||
# User user1 | ||||
# Date 0 0 | ||||
# Thu Jan 01 00:00:00 1970 +0000 | ||||
# Node ID 60f545c277846e6bad309919bae3ae106f59cb39 | ||||
# Parent 3ab5da9a5c01faa02c20f2ec4870a4f689c92da6 | ||||
E | ||||
diff -r 3ab5da9a5c01 -r 60f545c27784 z | ||||
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | ||||
+++ b/z Thu Jan 01 00:00:00 1970 +0000 | ||||
@@ -0,0 +1,2 @@ | ||||
+a | ||||
+blah | ||||
Adrian Buehlmann
|
r12608 | $ cd .. | ||
$ hg init b | ||||
$ cd b | ||||
$ echo a > a | ||||
$ hg ci -Am A | ||||
adding a | ||||
$ echo b > b | ||||
$ hg ci -Am B | ||||
adding b | ||||
Siddharth Agarwal
|
r18136 | $ hg cp b b-copied | ||
$ hg ci -Am 'copy B' | ||||
$ hg up -q -C 1 | ||||
Adrian Buehlmann
|
r12608 | |||
$ hg cp a a-copied | ||||
$ hg ci -m 'copy A' | ||||
created new head | ||||
$ hg tglog | ||||
Phil Cohen
|
r35386 | @ 3: 0a8162ff18a8 'copy A' | ||
Adrian Buehlmann
|
r12608 | | | ||
Phil Cohen
|
r35386 | | o 2: 39e588434882 'copy B' | ||
Adrian Buehlmann
|
r12608 | |/ | ||
Phil Cohen
|
r35386 | o 1: 6c81ed0049f8 'B' | ||
Siddharth Agarwal
|
r18136 | | | ||
Phil Cohen
|
r35386 | o 0: 1994f17a630e 'A' | ||
Adrian Buehlmann
|
r12608 | |||
Copy is tracked: | ||||
$ hg tlog -p --git -r tip | ||||
Phil Cohen
|
r35386 | 3: 0a8162ff18a8 'copy A' | ||
Adrian Buehlmann
|
r12608 | diff --git a/a b/a-copied | ||
copy from a | ||||
copy to a-copied | ||||
Rebase the revision containing the copy: | ||||
Siddharth Agarwal
|
r18136 | $ hg rebase -s 3 -d 2 | ||
Mads Kiilerich
|
r23517 | rebasing 3:0a8162ff18a8 "copy A" (tip) | ||
Matt Harbison
|
r35394 | saved backup bundle to $TESTTMP/b/.hg/strip-backup/0a8162ff18a8-dd06302a-rebase.hg | ||
Adrian Buehlmann
|
r12608 | |||
$ hg tglog | ||||
Phil Cohen
|
r35386 | @ 3: 98f6e6dbf45a 'copy A' | ||
Siddharth Agarwal
|
r18136 | | | ||
Phil Cohen
|
r35386 | o 2: 39e588434882 'copy B' | ||
Adrian Buehlmann
|
r12608 | | | ||
Phil Cohen
|
r35386 | o 1: 6c81ed0049f8 'B' | ||
Adrian Buehlmann
|
r12608 | | | ||
Phil Cohen
|
r35386 | o 0: 1994f17a630e 'A' | ||
Adrian Buehlmann
|
r12608 | |||
Siddharth Agarwal
|
r18136 | |||
Adrian Buehlmann
|
r12608 | Copy is not lost: | ||
$ hg tlog -p --git -r tip | ||||
Phil Cohen
|
r35386 | 3: 98f6e6dbf45a 'copy A' | ||
Adrian Buehlmann
|
r12608 | diff --git a/a b/a-copied | ||
copy from a | ||||
copy to a-copied | ||||
Siddharth Agarwal
|
r18136 | |||
Rebased revision does not contain information about b (issue3739) | ||||
$ hg log -r 3 --debug | ||||
changeset: 3:98f6e6dbf45ab54079c2237fbd11066a5c41a11d | ||||
tag: tip | ||||
phase: draft | ||||
parent: 2:39e588434882ff77d01229d169cdc77f29e8855e | ||||
parent: -1:0000000000000000000000000000000000000000 | ||||
manifest: 3:2232f329d66fffe3930d43479ae624f66322b04d | ||||
user: test | ||||
date: Thu Jan 01 00:00:00 1970 +0000 | ||||
files+: a-copied | ||||
extra: branch=default | ||||
extra: rebase_source=0a8162ff18a8900df8df8ef7ac0046955205613e | ||||
description: | ||||
copy A | ||||
Stefano Tortarolo
|
r13778 | $ cd .. | ||
Test rebase across repeating renames: | ||||
$ hg init repo | ||||
$ cd repo | ||||
$ echo testing > file1.txt | ||||
$ hg add file1.txt | ||||
$ hg ci -m "Adding file1" | ||||
$ hg rename file1.txt file2.txt | ||||
$ hg ci -m "Rename file1 to file2" | ||||
$ echo Unrelated change > unrelated.txt | ||||
$ hg add unrelated.txt | ||||
$ hg ci -m "Unrelated change" | ||||
$ hg rename file2.txt file1.txt | ||||
$ hg ci -m "Rename file2 back to file1" | ||||
$ hg update -r -2 | ||||
1 files updated, 0 files merged, 1 files removed, 0 files unresolved | ||||
$ echo Another unrelated change >> unrelated.txt | ||||
$ hg ci -m "Another unrelated change" | ||||
created new head | ||||
$ hg tglog | ||||
Phil Cohen
|
r35386 | @ 4: b918d683b091 'Another unrelated change' | ||
Stefano Tortarolo
|
r13778 | | | ||
Phil Cohen
|
r35386 | | o 3: 1ac17e43d8aa 'Rename file2 back to file1' | ||
Stefano Tortarolo
|
r13778 | |/ | ||
Phil Cohen
|
r35386 | o 2: 480101d66d8d 'Unrelated change' | ||
Stefano Tortarolo
|
r13778 | | | ||
Phil Cohen
|
r35386 | o 1: be44c61debd2 'Rename file1 to file2' | ||
Stefano Tortarolo
|
r13778 | | | ||
Phil Cohen
|
r35386 | o 0: 8ce9a346991d 'Adding file1' | ||
Stefano Tortarolo
|
r13778 | |||
$ hg rebase -s 4 -d 3 | ||||
Mads Kiilerich
|
r23517 | rebasing 4:b918d683b091 "Another unrelated change" (tip) | ||
Matt Harbison
|
r35394 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/b918d683b091-3024bc57-rebase.hg | ||
Stefano Tortarolo
|
r13778 | |||
$ hg diff --stat -c . | ||||
unrelated.txt | 1 + | ||||
1 files changed, 1 insertions(+), 0 deletions(-) | ||||
Mads Kiilerich
|
r16913 | $ cd .. | ||
Augie Fackler
|
r21826 | |||
Verify that copies get preserved (issue4192). | ||||
$ hg init copy-gets-preserved | ||||
$ cd copy-gets-preserved | ||||
$ echo a > a | ||||
$ hg add a | ||||
$ hg commit --message "File a created" | ||||
$ hg copy a b | ||||
$ echo b > b | ||||
$ hg commit --message "File b created as copy of a and modified" | ||||
$ hg copy b c | ||||
$ echo c > c | ||||
$ hg commit --message "File c created as copy of b and modified" | ||||
$ hg copy c d | ||||
$ echo d > d | ||||
$ hg commit --message "File d created as copy of c and modified" | ||||
Note that there are four entries in the log for d | ||||
$ hg tglog --follow d | ||||
Phil Cohen
|
r35386 | @ 3: 421b7e82bb85 'File d created as copy of c and modified' | ||
Augie Fackler
|
r21826 | | | ||
Phil Cohen
|
r35386 | o 2: 327f772bc074 'File c created as copy of b and modified' | ||
Augie Fackler
|
r21826 | | | ||
Phil Cohen
|
r35386 | o 1: 79d255d24ad2 'File b created as copy of a and modified' | ||
Augie Fackler
|
r21826 | | | ||
Phil Cohen
|
r35386 | o 0: b220cd6d2326 'File a created' | ||
Augie Fackler
|
r21826 | |||
Update back to before we performed copies, and inject an unrelated change. | ||||
$ hg update 0 | ||||
0 files updated, 0 files merged, 3 files removed, 0 files unresolved | ||||
$ echo unrelated > unrelated | ||||
$ hg add unrelated | ||||
$ hg commit --message "Unrelated file created" | ||||
created new head | ||||
$ hg update 4 | ||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
Rebase the copies on top of the unrelated change. | ||||
$ hg rebase --source 1 --dest 4 | ||||
Mads Kiilerich
|
r23517 | rebasing 1:79d255d24ad2 "File b created as copy of a and modified" | ||
rebasing 2:327f772bc074 "File c created as copy of b and modified" | ||||
rebasing 3:421b7e82bb85 "File d created as copy of c and modified" | ||||
Matt Harbison
|
r35394 | saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/79d255d24ad2-a2265555-rebase.hg | ||
Augie Fackler
|
r21826 | $ hg update 4 | ||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
There should still be four entries in the log for d | ||||
$ hg tglog --follow d | ||||
Phil Cohen
|
r35386 | @ 4: dbb9ba033561 'File d created as copy of c and modified' | ||
Augie Fackler
|
r21826 | | | ||
Phil Cohen
|
r35386 | o 3: af74b229bc02 'File c created as copy of b and modified' | ||
Augie Fackler
|
r21826 | | | ||
Phil Cohen
|
r35386 | o 2: 68bf06433839 'File b created as copy of a and modified' | ||
Martijn Pieters
|
r28627 | : | ||
Phil Cohen
|
r35386 | o 0: b220cd6d2326 'File a created' | ||
Augie Fackler
|
r21826 | |||
Same steps as above, but with --collapse on rebase to make sure the | ||||
copy records collapse correctly. | ||||
$ hg co 1 | ||||
0 files updated, 0 files merged, 3 files removed, 0 files unresolved | ||||
$ echo more >> unrelated | ||||
$ hg ci -m 'unrelated commit is unrelated' | ||||
created new head | ||||
$ hg rebase -s 2 --dest 5 --collapse | ||||
Mads Kiilerich
|
r23517 | rebasing 2:68bf06433839 "File b created as copy of a and modified" | ||
rebasing 3:af74b229bc02 "File c created as copy of b and modified" | ||||
Augie Fackler
|
r21826 | merging b and c to c | ||
Mads Kiilerich
|
r23517 | rebasing 4:dbb9ba033561 "File d created as copy of c and modified" | ||
Augie Fackler
|
r21826 | merging c and d to d | ||
Matt Harbison
|
r35394 | saved backup bundle to $TESTTMP/copy-gets-preserved/.hg/strip-backup/68bf06433839-dde37595-rebase.hg | ||
Augie Fackler
|
r21826 | $ hg co tip | ||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
This should show both revision 3 and 0 since 'd' was transitively a | ||||
copy of 'a'. | ||||
$ hg tglog --follow d | ||||
Phil Cohen
|
r35386 | @ 3: 5a46b94210e5 'Collapsed revision | ||
Martijn Pieters
|
r28627 | : * File b created as copy of a and modified | ||
: * File c created as copy of b and modified | ||||
: * File d created as copy of c and modified' | ||||
Phil Cohen
|
r35386 | o 0: b220cd6d2326 'File a created' | ||
Augie Fackler
|
r21826 | |||
$ cd .. | ||||