#!/bin/sh
REPOS="$1"
TXN="$2"
#必须填写注释且不少于5个字
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 5 ]; #要求注释不能少于5个字符,您可自定义
then
echo -e "注释信息不能为空且不少于5个字!" 1>&2
exit 1
fi
# Committing to tags is not allowed
$SVNLOOK changed -t "$TXN" "$REPOS" | grep "^U\W.*\/tags\/" && /bin/echo "tags版本不接受修改!" 1>&2 && exit 1
log=`$SVNLOOK changed -t "$TXN" "$REPOS"`
echo "log --> $log"
invalid="\.iml$|\.class$|\/logs|\/target|\/classes|.settings|.classpath$|.project$|.factorypath$"
# Committing logs or target or classes is not allowed
echo $log | grep "^[AU]" | grep -E "$invalid" \
&& /bin/echo "请不要提交非法文件! $log" 1>&2 && exit 1
# All checks passed, so allow the commit.
exit 0