#!/bin/sh
SVN=svn
SVNADMIN=svnadmin

rm -rf test_repo \
       svntestrepo \
       testtrunk \
       testbranch1_userY \
       testbranch1_userX

${SVNADMIN} create test_repo 

${SVN} checkout file://`pwd`/test_repo svntestrepo

cd svntestrepo
mkdir trunk
cd trunk
mkdir B
mkdir C
cd ..
mkdir branches
${SVN} add branches
${SVN} add trunk
${SVN} commit -m ""
${SVN} copy "^/trunk" "^/branches/branch1" -m ""
${SVN} checkout "^/branches/branch1" ../testbranch1_userX
${SVN} checkout --depth empty "^/branches/branch1" ../testbranch1_userY
cd ../testbranch1_userY
${SVN} update --set-depth infinity C

${SVN} checkout "^/trunk" ../testtrunk
cd ../testtrunk/B
mkdir B1
cd B1
echo "B1 test" > test.txt
mkdir B1a
cd B1a
echo "B1a test" > test.txt
cd ../..
${SVN} add B1
cd ..
${SVN} commit -m ""
cd C
mkdir C1
cd C1
echo "C1 test" > test.txt
cd ..
${SVN} add C1
cd ..
${SVN} commit -m ""
cd B/B1
${SVN} delete B1a
cd ../..
${SVN} commit -m ""

cd ../testbranch1_userY
${SVN} merge "^/trunk"
${SVN} commit -m ""

cd ../testbranch1_userX
${SVN} update
${SVN} merge "^/trunk"
${SVN} commit -m ""
