#!/bin/ksh

set -x

SVNADMIN=/usr/bin/svnadmin
SVNLOOK=/usr/bin/svnlook
SVN=/usr/bin/svn
CP=/bin/cp
RM=/bin/rm
CHMOD=/bin/chmod

HOME=/home/svn
REPO_PATH=$HOME/lock-test-repo
REPO_URL=localhost/lock-test-repo
WC=$HOME/lock-test-wc

$RM -rf $REPO_PATH $WC

$SVNADMIN create $REPO_PATH

#$SVN co file:///$REPO_PATH $WC
$SVN co http://$REPO_URL $WC

$SVN info $WC > $WC/test.txt
$SVN add $WC/test.txt
$SVN ci $WC -m"add"

$SVN up $WC

$SVN lock $WC/test.txt
$SVN rm $WC/test.txt

$CP $HOME/lock-test-pre-commit $REPO_PATH/hooks/pre-commit
$CHMOD u+x $REPO_PATH/hooks/pre-commit

$SVN st $WC
$SVNLOOK lock $REPO_PATH test.txt

$SVN ci $WC -m"delete"
$SVN st $WC
$SVNADMIN lslocks $REPO_PATH
