test-backout
159 lines
| 2.5 KiB
| text/plain
|
TextLexer
/ tests / test-backout
Vadim Gelfer
|
r2158 | #!/bin/sh | ||
Alexis S. L. Carvalho
|
r4365 | HGMERGE=true; export HGMERGE | ||
Vadim Gelfer
|
r2158 | hg init basic | ||
cd basic | ||||
Thomas Arendsen Hein
|
r4726 | |||
echo '# should complain' | ||||
hg backout | ||||
hg backout -r 0 0 | ||||
echo '# basic operation' | ||||
Vadim Gelfer
|
r2158 | echo a > a | ||
hg commit -d '0 0' -A -m a | ||||
echo b >> a | ||||
hg commit -d '1 0' -m b | ||||
hg backout -d '2 0' tip | ||||
cat a | ||||
echo '# file that was removed is recreated' | ||||
cd .. | ||||
hg init remove | ||||
cd remove | ||||
echo content > a | ||||
hg commit -d '0 0' -A -m a | ||||
hg rm a | ||||
hg commit -d '1 0' -m b | ||||
hg backout -d '2 0' --merge tip | ||||
cat a | ||||
echo '# backout of backout is as if nothing happened' | ||||
hg backout -d '3 0' --merge tip | ||||
TK Soh
|
r2186 | cat a 2>/dev/null || echo cat: a: No such file or directory | ||
Vadim Gelfer
|
r2158 | |||
Matt Mackall
|
r5568 | echo '# across branch' | ||
cd .. | ||||
hg init branch | ||||
cd branch | ||||
echo a > a | ||||
Martin Geisler
|
r8167 | hg ci -Am0 | ||
Matt Mackall
|
r5568 | echo b > b | ||
Martin Geisler
|
r8167 | hg ci -Am1 | ||
Matt Mackall
|
r5568 | hg co -C 0 | ||
# should fail | ||||
Martin Geisler
|
r8167 | hg backout 1 | ||
Matt Mackall
|
r5568 | echo c > c | ||
Martin Geisler
|
r8167 | hg ci -Am2 | ||
Matt Mackall
|
r5568 | # should fail | ||
Martin Geisler
|
r8167 | hg backout 1 | ||
Matt Mackall
|
r5568 | |||
Vadim Gelfer
|
r2158 | echo '# backout with merge' | ||
cd .. | ||||
hg init merge | ||||
cd merge | ||||
echo line 1 > a | ||||
Gilles Moris
|
r6161 | echo line 2 >> a | ||
Vadim Gelfer
|
r2158 | hg commit -d '0 0' -A -m a | ||
Gilles Moris
|
r6161 | # remove line 1 | ||
echo line 2 > a | ||||
Vadim Gelfer
|
r2158 | hg commit -d '1 0' -m b | ||
echo line 3 >> a | ||||
hg commit -d '2 0' -m c | ||||
hg backout --merge -d '3 0' 1 | ||||
hg commit -d '4 0' -m d | ||||
Gilles Moris
|
r6161 | # check line 1 is back | ||
Vadim Gelfer
|
r2158 | cat a | ||
Brendan Cully
|
r2492 | echo '# backout should not back out subsequent changesets' | ||
hg init onecs | ||||
cd onecs | ||||
echo 1 > a | ||||
hg commit -d '0 0' -A -m a | ||||
echo 2 >> a | ||||
hg commit -d '1 0' -m b | ||||
echo 1 > b | ||||
hg commit -d '2 0' -A -m c | ||||
hg backout -d '3 0' 1 | ||||
hg locate b | ||||
Gilles Moris
|
r6161 | hg update -C tip | ||
hg locate b | ||||
Brendan Cully
|
r2492 | |||
Vadim Gelfer
|
r2614 | cd .. | ||
hg init m | ||||
cd m | ||||
echo a > a | ||||
hg commit -d '0 0' -A -m a | ||||
echo b > b | ||||
hg commit -d '1 0' -A -m b | ||||
echo c > c | ||||
hg commit -d '2 0' -A -m b | ||||
hg update 1 | ||||
echo d > d | ||||
hg commit -d '3 0' -A -m c | ||||
hg merge 2 | ||||
hg commit -d '4 0' -A -m d | ||||
echo '# backout of merge should fail' | ||||
hg backout 4 | ||||
echo '# backout of merge with bad parent should fail' | ||||
hg backout --parent 0 4 | ||||
echo '# backout of non-merge with parent should fail' | ||||
hg backout --parent 0 3 | ||||
echo '# backout with valid parent should be ok' | ||||
hg backout -d '5 0' --parent 2 4 | ||||
hg rollback | ||||
hg update -C | ||||
hg backout -d '6 0' --parent 3 4 | ||||
Thomas Arendsen Hein
|
r6162 | cd .. | ||
echo '# named branches' | ||||
hg init named_branches | ||||
cd named_branches | ||||
echo default > default | ||||
hg ci -d '0 0' -Am default | ||||
hg branch branch1 | ||||
echo branch1 > file1 | ||||
hg ci -d '1 0' -Am file1 | ||||
hg branch branch2 | ||||
echo branch2 > file2 | ||||
hg ci -d '2 0' -Am file2 | ||||
hg backout -d '3 0' -r 1 -m 'backout on branch1' | ||||
# XXX maybe backout shouldn't suggest a merge here as it is a different branch? | ||||
echo '% on branch2 with branch1 not merged, so file1 should still exist:' | ||||
hg id | ||||
hg st -A | ||||
echo '% on branch2 with branch1 merged, so file1 should be gone:' | ||||
hg merge | ||||
hg ci -d '4 0' -m 'merge backout of branch1' | ||||
hg id | ||||
hg st -A | ||||
echo '% on branch1, so no file1 and file2:' | ||||
hg co -C branch1 | ||||
hg id | ||||
hg st -A | ||||
Vadim Gelfer
|
r2158 | exit 0 | ||