文章标签 ‘svn’

没有评论利用SVN hook机制 限制提交必须填写注释

2011年12月30日

进入svn data文件夹下你的repos
会发现里面会有这些文件夹

|-- README.txt
|-- conf
|-- dav
|-- db
|-- format
|-- hooks
`-- locks

此次我们会用到的就是hooks
SVN已经为我们提供了一些hook模板
cp pre-commit.tmpl pre-commit 复制一份
chmod +x pre-commit 增加可执行权限
然后修改其内容
ok啦!
内容如下

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

RES="OK"
# Make sure that the log message contains some text.
SVNLOOK=/app/subversion/bin/svnlook
$SVNLOOK log -t "$TXN" "$REPOS" | egrep "[^[:space:]]+" >/dev/null || unset RES
if [ "$RES" != "OK" ]
then
    echo "You must input some comments for you commit" >&2
    exit 1
fi

# All checks passed, so allow the commit.
exit 0
分类: 其他技术 标签: , ,