Linux系统中SVN强制填写注释才能提交

如果大家懒得写提交注释,那你需要把svn目录下hooks/pre-commit脚本改成如下内容,并给予执行权限:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

REPOS="$1"
TXN="$2"

# 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 1 ]
then
echo -e "\n必须填写注释才能提交!" >&2
exit 1
fi

# All checks passed, so allow the commit.
exit 0