VisualSVN 预提交规则
将此挂钩与 VisualSVN Server 结合使用,作为 pre-commit.bat 添加到 Repository/hooks 文件夹中。
我的问题是如何添加注释必须始终以数值开头的规则?我希望评论的第一部分始终是错误跟踪器的问题号。例如。 “123 - 此提交修复了问题 123”
@echo off
::
:: Stops commits that have empty log messages.
::
@echo off
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
Using this hook with VisualSVN Server, added to the Repository/hooks folder as pre-commit.bat.
My question is how do I add the rule that a comment must always start with a numeric value? I want the first part of the comment to always be the issue number from a bug tracker. Eg. "123 - this commit fixes issue 123"
@echo off
::
:: Stops commits that have empty log messages.
::
@echo off
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试以下正则表达式:
Ie
Try following regular expression:
I.e.
请参阅文章 KB140:验证 VisualSVN 服务器中的提交日志消息 并使用选项 <代码>--regexp ARG。如果您希望提交日志消息始终以数值开头,请尝试使用
\d+
正则表达式值。例如,像这样:
See the article KB140: Validating commit log messages in VisualSVN Server and use the option
--regexp ARG
. In your case when you want the commit log message to always start with a numeric value, try the\d+
regexp value.E.g., like this: