1. 程式人生 > >強制svn checkin時必須寫註釋

強制svn checkin時必須寫註釋

鑑於SVN上大量檔案都沒有標註comments , 導致檢視history 時無法知曉本次改動內容,特修改配置檔案,強制每次提交新版本時都需要寫註釋。

1,把專案下的 hooks/pre-commit.tmpl 更名為 hooks/pre-commit
比如: /opt/svn/ued/hooks/pre-commit.tmpl -->  /opt/svn/ued/hooks/pre-commit   

2,開啟pre-commit,修改如下,意思為註釋內容不少於3個字元:

# 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

LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" |grep "[a-zA-Z0-9]" |wc -c`
if [ "$LOGMSG" -lt 3 ];
then
echo -e "\nEmpty log message not allowed. Commit aborted!" 1>&2
exit 1
fi

3,修改 pre-commit  屬性:

 chmod +x pre-commit

原文link

http://cnshell.blog.sohu.com/163056016.html