#!/bin/sh

SVN=/home/arwin/Binaries/subversion-1.7.x/bin/svn
SVNADMIN=/home/arwin/Binaries/subversion-1.7.x/bin/svnadmin
WORK_DIR=/tmp/1.7.x
REPO_ROOT=/home/arwin/Binaries/csvn/data/repositories
REPO_URL=http://r52/svn/
FULL_PERM_USER=admin
PARTIAL_PERM_USER=arwin

### Use the following rules in your authz file
#   [/]
#   admin=rw
#   arwin=rw
#   [/A/B]
#   admin=rw
#   arwin=
###

# Setup working area and remove repository from previous run if any.
rm -rf $REPO_ROOT/cp_fail_repo
rm -rf $WORK_DIR/cp_fail_wcs
mkdir -p $WORK_DIR/cp_fail_wcs

# Create repo with the tree structure as:
# .
# `-- A
#     `-- B
$SVNADMIN create $REPO_ROOT/cp_fail_repo
cd $WORK_DIR/cp_fail_wcs
$SVN co $REPO_URL/cp_fail_repo wc --username=$FULL_PERM_USER
cd wc
$SVN mkdir A A/B
$SVN ci -m "created dirs" --username=$FULL_PERM_USER

# Checkout with partial permissions
cd $WORK_DIR/cp_fail_wcs
$SVN co $REPO_URL/cp_fail_repo wc_fail --username=$PARTIAL_PERM_USER

# Notes
echo ""
echo "Now, go to $WORK_DIR/cp_fail_wcs/wc_fail "
echo "The following commands will fail:"
echo "$SVN cp A C"
echo "(1.6.x leaves the wc in a vague state: 
             "svn st" shows C as unversioned
             "svn info C" says schedule is normal (it should be add))"
echo "(1.7.x, 1.8.x segfaults upon doing info C/B)"



