如何在没有注释的情况下防止 Subversion 提交? [英] How can I prevent Subversion commits without comments?
本文介绍了如何在没有注释的情况下防止 Subversion 提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道如何在没有输入提交注释的情况下防止提交到 Subversion 代码存储库吗?
Does anybody know how to prevent commits to a Subversion code repository when there is no commit comment entered?
推荐答案
可以使用钩子(放入
并命名为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屋!
查看全文