Google
 
  主站 | 论坛 | Subversion手册 | TortoiseSVN手册 | SVN知识库 | 下载区 | QQ群MSN群 | 家园 | 关于
繁體中文

Linux下 强制写日志并且可以限制字数

From SVN知识库

Jump to: navigation, search
只要求强制写日志不要求字数可以在pre-commit 里修改 把红色的部分注释掉即可

 #!/bin/sh

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

 # Make sure that the log message contains some text.

 SVNLOOK=/usr/local/subversion/bin/svnlook

 $SVNLOOK log -t "$TXN" "$REPOS" | \

 grep "[a-zA-Z0-9]" > /dev/null || exit 1

 # Check that the author of this commit has the rights to perform

 # the commit on the files and directories being modified.

 #commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1

 # All checks passed, so allow the commit.

 #exit 0

强制写日志并且限制日志长度  pre-commit

 #!/bin/sh

 REPOS="$1"

 TXN="$2"

 # Make sure that the log message contains some text.

 SVNLOOK=/usr/local/subversion/bin/svnlook

 LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c)

 if [ "$LOGMSG" -lt 10 ]; then //-eq 等于号 -gt 大于号 -lt小于号 ,显示输入的长短为10

               (如果数字或者字母表示最少要写9个,如果汉字是一个根据自己的需求可以任意修改

 echo -e "\nEmpty log message not allowed.Commit aborted!" >$2

      exit 1

 fi

Personal tools