#!/bin/sh

# The next line is the only line you should need to adjust.
SVNDIR=/home/builder/usr/svn-166/bin

SVN=${SVNDIR}/svn
SVNSERVE=${SVNDIR}/svnserve
SVNADMIN=${SVNDIR}/svnadmin

URL=file:///`pwd`/repos

rm -rf repos wc import-me

${SVNADMIN} create repos

echo "### Making a Greek Tree for import..."
mkdir import-me
mkdir import-me/dir
mkdir import-me/dir2

(cd import-me; ${SVN} import -q -m "Initial import." ${URL})

echo "### Checking out WC..."
${SVN} co ${URL} wc

echo "### Setting svn:externals property..."
${SVN} ps svn:externals "ext ${URL}/dir2" wc/dir
${SVN} ci wc -m "external property set"
echo "### Update: external should be added"
${SVN} up wc

echo "### Deleting svn:externals property..."
${SVN} pd svn:externals wc/dir
echo "### Update: external should be deleted"
${SVN} up wc
${SVN} ci wc -m "external property deleted"

echo "### Creating new directory named as removed external directory"
${SVN} mkdir ${URL}/dir/ext -m "directory added remotely"

echo "### Receiving update (new directory named as removed external directory)"
${SVN} up wc
