svn强制注释配置

来源:互联网 发布:手机淘宝店店招 编辑:程序博客网 时间:2024/06/06 19:50

为了方便项目人员管理开发,我们强制要求开发人员在提交svn代码的时候填写备注


1.找到SVN 服务端




2.mv pre-commit.tmpl pre-commit将代码仓库根目录下,hooks文件夹中的pre-commit.tmpl文件重命名为pre-commit



3.vi pre-commit

REPOS="$1"  TXN="$2"    # Make sure that the log message contains some text.  SVNLOOK=/usr/bin/svnlook    # 定义个变量,注意这里不是单引号  LOGMSG=`$SVNLOOK log -t $TXN $REPOS | wc -m`     #把这一行和下面的一行注释掉    #$SVNLOOK log -t "$TXN" "$REPOS" | \           # grep "[a-zA-Z0-9]" > /dev/null || exit 1  #这里为什么是48呢,一个汉字对应16个字符 必须填四个汉字  if [ "$LOGMSG" -lt 48 ]                             then   echo "\n至少输入4个汉字" >&2                        exit 1  fi    # Exit on all errors.  #set -e    # Check that the author of this commit has the rights to perform  # the commit on the files and directories being modified.  #"$REPOS"/hooks/commit-access-control.pl "$REPOS" $TXN \    //把这一行和下面的一行注释掉。  #  "$REPOS"/hooks/commit-access-control.cfg    # All checks passed, so allow the commit.  exit 0


4.在hooks 文件下直接给pre-commit 增加加可执行权限chmod +x pre-commit

5.测试结果(注解低于四个字符或者null提示报错)



原创粉丝点击