hooks/pre-commit (记得授权)
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
# Make sure that the log message contains some text.
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 5 ];
then
echo -e "nLog message cann't be empty! you must input more than 5 chars as comment!." 1>&2
exit 1
fi
SCMLIST="huayu"
C_USER=`$SVNLOOK info -t $TXN $REPOS | sed -n "1p"`
if [ -z `echo $SCMLIST | grep $C_USER` ];then
echo `$SVNLOOK changed -t $TXN $REPOS` > /svn/project/huayu/commit_log
if cat /svn/project/huayu/commit_log|cut -d" " -f1|uniq -u|grep "^D";then
echo "You do not have permisson to delete a file" > /dev/stderr
rm -rf /svn/project/huayu/commit_log
exit 1
fi
fi
#$SVNLOOK log -t "$TXN" "$REPOS" | \
# grep "[a-zA-Z0-9]" > /dev/null || exit 1
# Check that the author of this commit has the rights to perform
# the commit on the files and directories being modified.
#commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1
# All checks passed, so allow the commit.
exit 0