如何防止没有注释的Subversion提交? [英] How can I prevent Subversion commits without comments?

查看:75
本文介绍了如何防止没有注释的Subversion提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有输入提交注释的情况下,有人知道如何防止提交Subversion代码存储库吗?

Does anybody know how to prevent commits to a Subversion code repository when there is no commit comment entered?

推荐答案

使用挂钩(将其放入< repository> / hooks 并命名为 pre-commit.bat (Windows) ):

You can use a hook (put it into <repository>/hooks and name it pre-commit.bat (Windows)):

@echo off
::
:: Stops commits that have empty log messages.
::

setlocal

rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2

rem check for an empty log message
svnlook log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else exit 0

:err
echo. 1>&2
echo Your commit has been blocked because you didn't give any log message 1>&2
echo Please write a log message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
exit 1

src: http://www.anujgakhar.com/2008/ 02/14 / how-to-force-comments-on-svn-commit /

这篇关于如何防止没有注释的Subversion提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆