view tests/test-filebranch @ 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 b0140ead7f70
children
line wrap: on
line source

#!/bin/sh

# This test makes sure that we don't mark a file as merged with its ancestor
# when we do a merge.

cat <<EOF > merge
import sys, os
print "merging for", os.path.basename(sys.argv[1])
EOF
HGMERGE="python ../merge"; export HGMERGE

echo creating base
hg init a
cd a
echo 1 > foo
echo 1 > bar
echo 1 > baz
echo 1 > quux
hg add foo bar baz quux
hg commit -m "base" -d "1000000 0"

cd ..
hg clone a b

echo creating branch a
cd a
echo 2a > foo
echo 2a > bar
hg commit -m "branch a" -d "1000000 0"

echo creating branch b

cd ..
cd b
echo 2b > foo
echo 2b > baz
hg commit -m "branch b" -d "1000000 0"

echo "we shouldn't have anything but n state here"
hg debugstate | cut -b 1-16,35-

echo merging
hg pull ../a
hg merge -v

echo 2m > foo
echo 2b > baz
echo new > quux

echo "we shouldn't have anything but foo in merge state here"
hg debugstate | cut -b 1-16,35- | grep "^m"

hg ci -m "merge" -d "1000000 0"

echo "main: we should have a merge here"
hg debugindex .hg/store/00changelog.i

echo "log should show foo and quux changed"
hg log -v -r tip

echo "foo: we should have a merge here"
hg debugindex .hg/store/data/foo.i

echo "bar: we shouldn't have a merge here"
hg debugindex .hg/store/data/bar.i

echo "baz: we shouldn't have a merge here"
hg debugindex .hg/store/data/baz.i

echo "quux: we shouldn't have a merge here"
hg debugindex .hg/store/data/quux.i

echo "manifest entries should match tips of all files"
hg manifest --debug

echo "everything should be clean now"
hg status

hg verify