view tests/test-revert @ 5149:ad6b97132b81

merge: fix a copy detection bug (issue672) When merging rev1 and rev2, we want to search for copies that happened in rev1 but not in rev2 and vice-versa. We were starting the search at rev1/rev2 and then going back, stopping as soon as we reached the revno of the ancestor, but that can miss some cases (see the new test-issue672). Now we calculate the revisions that are ancestors of rev1 or rev2 (but not both) and make sure the search doesn't stop too early. Simplified test provided by mpm, based on a test case provided by Edward Lee.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sun, 12 Aug 2007 12:15:10 -0300
parents da6b14877195
children bfd73b567b3d
line wrap: on
line source

#!/bin/sh

hg init
echo 123 > a
echo 123 > c
echo 123 > e
hg add a c e
hg commit -m "first" -d "1000000 0" a c e
echo 123 > b
echo %% should show b unknown
hg status
echo 12 > c
echo %% should show b unknown and c modified
hg status
hg add b
echo %% should show b added and c modified
hg status
hg rm a
echo %% should show a removed, b added and c modified
hg status
hg revert a
echo %% should show b added, copy saved, and c modified
hg status
hg revert b
echo %% should show b unknown, and c modified
hg status
hg revert --no-backup c
echo %% should show unknown: b
hg status
echo %% should show a b c e
ls
echo %% should verbosely save backup to e.orig
echo z > e
hg revert --all -v
echo %% should say no changes needed
hg revert a
echo %% should say file not managed
echo q > q
hg revert q
rm q
echo %% should say file not found
hg revert notfound
hg rm a
hg commit -m "second" -d "1000000 0"
echo z > z
hg add z
hg st
echo %% should add a, forget z
hg revert --all -r0
echo %% should forget a
hg revert --all -rtip
rm a *.orig
echo %% should silently add a
hg revert -r0 a
hg st a

hg update -C
chmod +x c
hg revert --all
echo %% should print non-executable
test -x c || echo non-executable

chmod +x c
hg commit -d '1000001 0' -m exe

chmod -x c
hg revert --all
echo %% should print executable
test -x c && echo executable

echo %% issue 241
hg init a
cd a
echo a >> a
hg commit -A -d '1 0' -m a
echo a >> a
hg commit -d '2 0' -m a
hg update 0
mkdir b
echo b > b/b

echo % should fail - no arguments
hg revert -rtip

echo % should succeed
hg revert --all -rtip

echo %% issue332
hg ci -A -m b -d '1000001 0'
echo foobar > b/b
mkdir newdir
echo foo > newdir/newfile
hg add newdir/newfile
hg revert b newdir
echo foobar > b/b
hg revert .
true