view tests/test-backout @ 5429:77cafe8f89e0

findcopies: fix rename bug We've fiddled with this line several times, and an old bug has reappeared from it. Let's take a peek at the history. The original "or" (rev 3674, in 0.9.2 and 0.9.3): http://www.selenic.com/hg/rev/9103dab96093 Then I changed it to an "and" to fix a bug (rev 4304): http://www.selenic.com/hg/rev/4787e2b0dd03 Then for reasons now lost in the mists of time, I dropped half (rev 4399): http://www.selenic.com/hg/rev/93652499bed3 Then we added back the "or" (rev 4416, in 0.9.4): http://www.selenic.com/hg/rev/bb1800a7d7e1 So it seems it ought to be "and".
author Matt Mackall <mpm@selenic.com>
date Mon, 08 Oct 2007 18:47:22 -0500
parents f6e961c0155b
children
line wrap: on
line source

#!/bin/sh

HGMERGE=true; export HGMERGE

hg init basic
cd basic

echo '# should complain'
hg backout
hg backout -r 0 0

echo '# basic operation'
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
cat a 2>/dev/null || echo cat: a: No such file or directory

echo '# backout with merge'
cd ..
hg init merge
cd merge

echo line 1 > a
hg commit -d '0 0' -A -m a

echo line 2 >> a
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
cat a

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

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

exit 0