SVN(Linux)提交时强制写日志

  • Post author:
  • Post category:linux


SVN(Linux)提交时强制写日志

1.创建并修改pre-commit文件

进入svn/code/hooks目录,在svn版本库的hooks文件夹下面,复制模版pre-commit.tmpl

cp pre-commit.tmpl pre-commit

chmod +x pre-commit

2.编辑pre-commit文件:

将:

$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

这几行注释掉(前面加#符号),


3.在此位置添加如下几行:

#下面这句去掉前面的#号
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

转载于:https://www.cnblogs.com/crazytata/p/10257035.html