view tests/test-copy2 @ 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 44e17f5029d0
children
line wrap: on
line source

#!/bin/sh

hg init
echo foo > foo
echo "# should fail - foo is not managed"
hg mv foo bar
hg st -A
hg add foo
echo "# dry-run; print a warning that this is not a real copy; foo is added"
hg mv --dry-run foo bar
hg st -A
echo "# should print a warning that this is not a real copy; bar is added"
hg mv foo bar
hg st -A
echo "# should print a warning that this is not a real copy; foo is added"
hg cp bar foo
hg rm -f bar
rm bar
hg st -A
hg commit -m1 -d"0 0"

echo "# dry-run; should show that foo is clean"
hg copy --dry-run foo bar
hg st -A
echo "# should show copy"
hg copy foo bar
hg st -C

echo "# shouldn't show copy"
hg commit -m2 -d"0 0"
hg st -C

echo "# should match"
hg debugindex .hg/store/data/foo.i
hg debugrename bar

echo bleah > foo
echo quux > bar
hg commit -m3 -d"0 0"

echo "# should not be renamed"
hg debugrename bar

hg copy -f foo bar
echo "# should show copy"
hg st -C
hg commit -m3 -d"0 0"

echo "# should show no parents for tip"
hg debugindex .hg/store/data/bar.i
echo "# should match"
hg debugindex .hg/store/data/foo.i
hg debugrename bar

echo "# should show no copies"
hg st -C

echo "# copy --after on an added file"
cp bar baz
hg add baz
hg cp -A bar baz
hg st -C

echo "# foo was clean:"
hg st -AC foo
echo "# but it's considered modified after a copy --after --force"
hg copy -Af bar foo
hg st -AC foo

exit 0