的VisualSVN pre-提交规则 [英] VisualSVN pre-commit rule

查看:204
本文介绍了的VisualSVN pre-提交规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用这个钩子与VisualSVN服务器,添加到存储库/钩子文件夹pre-commit.bat。

我的问题是我怎么添加评论必须始终以数值开始的规则?我要评论的第一部分始终来自bug跟踪的发行数量。例如。 123 - 这个承诺修复问题123

 关闭@echo
::
::停止有空提交信息的提交。
::关闭@echoSETLOCALREM颠覆将通过仓库路径和事务ID
集REPOS =%1
设置TXN = 2%REM检查空日志消息
svnlook的日志%REPOS%-t%TXN%| FINDSTR。 > NUL
如果%ERRORLEVEL%GTR 0(转到ERR)否则退出0:呃
回声。 1>和2
呼应您的提交已被阻止,因为你没有给任何日志消息1 GT;和2
回声请写出描述你的变化和1 GT目的的日志信息;和2
呼应然后再试一次提交。 - 谢谢你1 GT;和2
1号出口


解决方案

尝试下面的正前pression:

  FINDSTR^ [0-9]

  svnlook的日志%REPOS%-t%TXN%| FINDSTR^ [0-9]> NUL
如果%ERRORLEVEL%GTR 0(转到ERR)否则退出0

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

解决方案

Try following regular expression:

findstr "^[0-9]"

I.e.

svnlook log %REPOS% -t %TXN% | findstr "^[0-9] > nul
if %errorlevel% gtr 0 (goto err) else exit 0

这篇关于的VisualSVN pre-提交规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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