svn强制要求添加并允许修改注释信息

SVN强制添加注释信息

hooks目录 编辑pre-commit 文件内容,找到下面3行,用#注释掉

1
2
3
$SVNLOOK log -t "$TXN" "$REPOS" |
grep "[a-zA-Z0-9]" > /dev/null || exit 1
commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1

然后再修改处下面增加一下内容

1
2
3
4
5
6
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 5 ];#........5.........
then
echo -e "nLog message cann't be empty! you must input more than 5 chars as comment!." 1>&2
exit 1
fi

保存退出。 设置pre-commit文件权限可执行 使用如下命令chomd +x pre-commit

允许用户修改注释信息

用户修改注释信息的动作,对应的是pre-revpos-change。将hooks目录下的pre-revpos-change.tmpl改名为pre-revpos-change

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ];
then
exit 0;
fi
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

坚持原创分享,您的支持将鼓励我继续创作