当前位置: 代码迷 >> CVS/SVN >> svn hook(挟制要求提交注释必须多于X个字)
  详细解决方案

svn hook(挟制要求提交注释必须多于X个字)

热度:2919   发布时间:2013-02-26 00:00:00.0
svn hook(强制要求提交注释必须多于X个字)
cd repository/hooks,找到pre-commit.tmpl文件,去掉后缀.tmpl, 编辑pre-commit文件:

1. windows: 重命名为pre-commit.bat
@echo offsetlocalset REPOS=%1set TXN=%2rem check that logmessage contains at least 10 charactersrem .....代表5个字符svnlook log "%REPOS%" -t "%TXN%" | findstr ".........." > nulif %errorlevel% gtr 0 goto errexit 0:errecho Empty log message not allowed. Commit aborted! 1>&2exit 1


2. linux:chmod u+x pre-commit
#!/bin/shREPOS="$1"TXN="$2"SVNLOOK=/usr/bin/svnlook# check that logmessage contains at least 10 alphanumeric charactersLOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | tr -d ' ' | wc -c`if [ "$LOGMSG" -lt 10 ];then  echo -e "\nEmpty log message not allowed. Commit aborted!" 1>&2  exit 1fi
1 楼 雁行 2012-06-25  
good,tks
2 楼 李_俊 2012-08-18  
多谢博主,这个负责并且也认真得多。
其他网上搜索的,要么是到处copy的,并且也没有提示,不知道是windows还是linux环境,并且描述极乱,都不知道如何处理。