test-push-warn
317 lines
| 5.3 KiB
| text/plain
|
TextLexer
/ tests / test-push-warn
mpm@selenic.com
|
r816 | #!/bin/sh | ||
Sune Foldager
|
r10875 | echo "[extensions]" >> $HGRCPATH | ||
echo "graphlog=" >> $HGRCPATH | ||||
mpm@selenic.com
|
r816 | mkdir a | ||
cd a | ||||
hg init | ||||
echo foo > t1 | ||||
hg add t1 | ||||
Martin Geisler
|
r12156 | hg commit -m "1" | ||
mpm@selenic.com
|
r816 | |||
cd .. | ||||
hg clone a b | ||||
cd a | ||||
echo foo > t2 | ||||
hg add t2 | ||||
Martin Geisler
|
r12156 | hg commit -m "2" | ||
mpm@selenic.com
|
r816 | |||
cd ../b | ||||
echo foo > t3 | ||||
hg add t3 | ||||
Martin Geisler
|
r12156 | hg commit -m "3" | ||
mpm@selenic.com
|
r816 | |||
hg push ../a | ||||
hg pull ../a | ||||
hg push ../a | ||||
Vadim Gelfer
|
r2283 | hg merge | ||
Martin Geisler
|
r12156 | hg commit -m "4" | ||
mpm@selenic.com
|
r816 | hg push ../a | ||
Thomas Arendsen Hein
|
r2021 | cd .. | ||
hg init c | ||||
cd c | ||||
for i in 0 1 2; do | ||||
echo $i >> foo | ||||
Martin Geisler
|
r12156 | hg ci -Am $i | ||
Thomas Arendsen Hein
|
r2021 | done | ||
cd .. | ||||
hg clone c d | ||||
cd d | ||||
for i in 0 1; do | ||||
hg co -C $i | ||||
echo d-$i >> foo | ||||
Martin Geisler
|
r12156 | hg ci -m d-$i | ||
Thomas Arendsen Hein
|
r2021 | done | ||
Vadim Gelfer
|
r2283 | HGMERGE=true hg merge 3 | ||
Martin Geisler
|
r12156 | hg ci -m c-d | ||
Thomas Arendsen Hein
|
r2021 | |||
Thomas Arendsen Hein
|
r3803 | hg push ../c; echo $? | ||
hg push -r 2 ../c; echo $? | ||||
hg push -r 3 ../c; echo $? | ||||
hg push -r 3 -r 4 ../c; echo $? | ||||
hg push -f -r 3 -r 4 ../c; echo $? | ||||
hg push -r 5 ../c; echo $? | ||||
Sune Foldager
|
r10908 | hg in ../c | ||
Thomas Arendsen Hein
|
r2021 | |||
Sune Foldager
|
r10908 | echo % issue 450 | ||
Benoit Boissinot
|
r3923 | hg init ../e | ||
hg push -r 0 ../e ; echo $? | ||||
hg push -r 1 ../e ; echo $? | ||||
Sune Foldager
|
r8565 | cd .. | ||
echo % issue 736 | ||||
hg init f | ||||
cd f | ||||
hg -q branch a | ||||
echo 0 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -Am 0 | ||
Sune Foldager
|
r8565 | echo 1 > foo | ||
Martin Geisler
|
r12156 | hg -q ci -m 1 | ||
Sune Foldager
|
r8565 | hg -q up 0 | ||
echo 2 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -m 2 | ||
Sune Foldager
|
r8565 | hg -q up 0 | ||
hg -q branch b | ||||
echo 3 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -m 3 | ||
Sune Foldager
|
r8565 | cd .. | ||
hg -q clone f g | ||||
cd g | ||||
echo % push on existing branch and new branch | ||||
hg -q up 1 | ||||
echo 4 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -m 4 | ||
Sune Foldager
|
r8565 | hg -q up 0 | ||
echo 5 > foo | ||||
hg -q branch c | ||||
Martin Geisler
|
r12156 | hg -q ci -m 5 | ||
Benoit Boissinot
|
r10354 | hg push ../f; echo $? | ||
Sune Foldager
|
r8565 | hg push -r 4 -r 5 ../f; echo $? | ||
Benoit Boissinot
|
r10354 | echo % multiple new branches | ||
hg -q branch d | ||||
echo 6 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -m 6 | ||
Benoit Boissinot
|
r10354 | hg push ../f; echo $? | ||
hg push -r 4 -r 6 ../f; echo $? | ||||
cd ../g | ||||
Sune Foldager
|
r8565 | echo % fail on multiple head push | ||
hg -q up 1 | ||||
Benoit Boissinot
|
r10354 | echo 7 > foo | ||
Martin Geisler
|
r12156 | hg -q ci -m 7 | ||
Benoit Boissinot
|
r10354 | hg push -r 4 -r 7 ../f; echo $? | ||
Sune Foldager
|
r8565 | |||
echo % push replacement head on existing branches | ||||
hg -q up 3 | ||||
Benoit Boissinot
|
r10354 | echo 8 > foo | ||
Martin Geisler
|
r12156 | hg -q ci -m 8 | ||
Benoit Boissinot
|
r10354 | hg push -r 7 -r 8 ../f; echo $? | ||
Sune Foldager
|
r8565 | |||
echo % merge of branch a to other branch b followed by unrelated push on branch a | ||||
hg -q up 7 | ||||
Benoit Boissinot
|
r10354 | HGMERGE=true hg -q merge 8 | ||
Martin Geisler
|
r12156 | hg -q ci -m 9 | ||
Benoit Boissinot
|
r10354 | hg -q up 8 | ||
echo 10 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -m 10 | ||
Sune Foldager
|
r8565 | hg push -r 9 ../f; echo $? | ||
Benoit Boissinot
|
r10354 | hg push -r 10 ../f; echo $? | ||
Sune Foldager
|
r8565 | |||
echo % cheating the counting algorithm | ||||
Benoit Boissinot
|
r10354 | hg -q up 9 | ||
Sune Foldager
|
r8565 | HGMERGE=true hg -q merge 2 | ||
Martin Geisler
|
r12156 | hg -q ci -m 11 | ||
Sune Foldager
|
r8565 | hg -q up 1 | ||
Benoit Boissinot
|
r10354 | echo 12 > foo | ||
Martin Geisler
|
r12156 | hg -q ci -m 12 | ||
Benoit Boissinot
|
r10354 | hg push -r 11 -r 12 ../f; echo $? | ||
Sune Foldager
|
r8565 | |||
Sune Foldager
|
r11211 | echo % failed push of new named branch | ||
echo 12 > foo | ||||
Martin Geisler
|
r12156 | hg -q ci -m 12a | ||
Sune Foldager
|
r11211 | hg -q up 11 | ||
echo 13 > foo | ||||
hg -q branch e | ||||
Martin Geisler
|
r12156 | hg -q ci -m 13d | ||
Sune Foldager
|
r11211 | hg push -r 12 -r 13 ../f; echo $? | ||
echo % using --new-branch to push new named branch | ||||
hg push --new-branch -r 12 -r 13 ../f; echo $? | ||||
Sune Foldager
|
r9479 | echo % checking prepush logic does not allow silently pushing multiple new heads | ||
cd .. | ||||
Henrik Stuart
|
r9609 | hg init h | ||
echo init > h/init | ||||
hg -R h ci -Am init | ||||
echo a > h/a | ||||
hg -R h ci -Am a | ||||
hg clone h i | ||||
Sune Foldager
|
r9479 | hg -R h up 0 | ||
Henrik Stuart
|
r9609 | echo b > h/b | ||
hg -R h ci -Am b | ||||
hg -R i up 0 | ||||
echo c > i/c | ||||
hg -R i ci -Am c | ||||
hg -R i push h | ||||
Sune Foldager
|
r9479 | echo | ||
Sune Foldager
|
r9954 | echo % check prepush logic with merged branches | ||
hg init j | ||||
hg -R j branch a | ||||
echo init > j/foo | ||||
hg -R j ci -Am init | ||||
hg clone j k | ||||
echo a1 > j/foo | ||||
hg -R j ci -m a1 | ||||
hg -R k branch b | ||||
echo b > k/foo | ||||
hg -R k ci -m b | ||||
hg -R k up 0 | ||||
hg -R k merge b | ||||
hg -R k ci -m merge | ||||
hg -R k push -r a j | ||||
echo | ||||
Sune Foldager
|
r10771 | echo % prepush -r should not allow you to sneak in new heads | ||
hg init l | ||||
cd l | ||||
echo a >> foo | ||||
hg -q add foo | ||||
hg -q branch a | ||||
Martin Geisler
|
r12156 | hg -q ci -ma | ||
Sune Foldager
|
r10771 | hg -q up null | ||
echo a >> foo | ||||
hg -q add foo | ||||
hg -q branch b | ||||
Martin Geisler
|
r12156 | hg -q ci -mb | ||
Sune Foldager
|
r10771 | cd .. | ||
hg -q clone l m -u a | ||||
cd m | ||||
hg -q merge b | ||||
Martin Geisler
|
r12156 | hg -q ci -mmb | ||
Sune Foldager
|
r10771 | hg -q up 0 | ||
echo a >> foo | ||||
hg -q ci -ma2 | ||||
hg -q up 2 | ||||
echo a >> foo | ||||
hg -q branch -f b | ||||
Martin Geisler
|
r12156 | hg -q ci -mb2 | ||
Sune Foldager
|
r10771 | hg -q merge 3 | ||
Martin Geisler
|
r12156 | hg -q ci -mma | ||
Sune Foldager
|
r10771 | hg push ../l -b b | ||
Sune Foldager
|
r10875 | cd .. | ||
echo % check prepush with new branch head on former topo non-head | ||||
hg init n | ||||
cd n | ||||
hg branch A | ||||
echo a >a | ||||
hg ci -Ama | ||||
hg branch B | ||||
echo b >b | ||||
hg ci -Amb | ||||
# b is now branch head of B, and a topological head | ||||
# a is now branch head of A, but not a topological head | ||||
hg clone . inner | ||||
cd inner | ||||
hg up B | ||||
echo b1 >b1 | ||||
hg ci -Amb1 | ||||
# in the clone b1 is now the head of B | ||||
cd .. | ||||
hg up 0 | ||||
echo a2 >a2 | ||||
hg ci -Ama2 | ||||
# a2 is now the new branch head of A, and a new topological head | ||||
# it replaces a former inner branch head, so it should at most warn about A, not B | ||||
echo %% glog of local | ||||
hg glog --template "{rev}: {branches} {desc}\n" | ||||
echo %% glog of remote | ||||
hg glog -R inner --template "{rev}: {branches} {desc}\n" | ||||
echo %% outgoing | ||||
hg out inner --template "{rev}: {branches} {desc}\n" | ||||
hg push inner | ||||
cd .. | ||||
echo % check prepush with new branch head on former topo head | ||||
hg init o | ||||
cd o | ||||
hg branch A | ||||
echo a >a | ||||
hg ci -Ama | ||||
hg branch B | ||||
echo b >b | ||||
hg ci -Amb | ||||
# b is now branch head of B, and a topological head | ||||
hg up 0 | ||||
echo a1 >a1 | ||||
hg ci -Ama1 | ||||
# a1 is now branch head of A, and a topological head | ||||
hg clone . inner | ||||
cd inner | ||||
hg up B | ||||
echo b1 >b1 | ||||
hg ci -Amb1 | ||||
# in the clone b1 is now the head of B | ||||
cd .. | ||||
echo a2 >a2 | ||||
hg ci -Ama2 | ||||
# a2 is now the new branch head of A, and a topological head | ||||
# it replaces a former topological and branch head, so this should not warn | ||||
echo %% glog of local | ||||
hg glog --template "{rev}: {branches} {desc}\n" | ||||
echo %% glog of remote | ||||
hg glog -R inner --template "{rev}: {branches} {desc}\n" | ||||
echo %% outgoing | ||||
hg out inner --template "{rev}: {branches} {desc}\n" | ||||
hg push inner | ||||
cd .. | ||||
Sune Foldager
|
r10771 | |||
Peter Arrenbrecht
|
r10909 | echo % check prepush with new branch head and new child of former branch head | ||
echo % but child is on different branch | ||||
hg init p | ||||
cd p | ||||
hg branch A | ||||
echo a0 >a | ||||
hg ci -Ama0 | ||||
echo a1 >a | ||||
hg ci -ma1 | ||||
hg up null | ||||
hg branch B | ||||
echo b0 >b | ||||
hg ci -Amb0 | ||||
echo b1 >b | ||||
hg ci -mb1 | ||||
hg clone . inner | ||||
hg up A | ||||
hg branch -f B | ||||
echo a3 >a | ||||
hg ci -ma3 | ||||
hg up 3 | ||||
hg branch -f A | ||||
echo b3 >b | ||||
hg ci -mb3 | ||||
echo %% glog of local | ||||
hg glog --template "{rev}: {branches} {desc}\n" | ||||
echo %% glog of remote | ||||
hg glog -R inner --template "{rev}: {branches} {desc}\n" | ||||
echo %% outgoing | ||||
hg out inner --template "{rev}: {branches} {desc}\n" | ||||
hg push inner | ||||
Sune Foldager
|
r10925 | hg push inner -r4 -r5 | ||
hg in inner | ||||
Peter Arrenbrecht
|
r10909 | cd .. | ||
Thomas Arendsen Hein
|
r2021 | exit 0 | ||