本文介绍了如何有条件地发送svn commit电子邮件,基于提交消息关键字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有运行与通过提交后(通常的设置)发送通知电子邮件,但我想要当某些关键字包含在提交消息中时,不发送电子邮件,例如#noemail或类似的东西。

I've got VisualSVN running with svnnotify sending notification email via post-commit (the common setup), but I'd like to not send email when certain keywords are included in the commit message, such as "#noemail" or something similar.

任何人都有一个例子,可以添加到我的后提交钩子来查看提交信息,并防止在存在某些关键字时发送电子邮件?

Anyone have an example of what I can add to my post-commit hook to look at the commit message and prevent email from being sent if certain keywords exist?

谢谢!

FYI,以下是我目前的后期提交内容的一个例子:

FYI, here's an example of my current post-commit content:

set REPOS=%1
set REV=%2
set EMAILADDRESSES="[email protected]"
set OS=Windows_NT
set PATH=%PATH%;C:\Program Files\VisualSVN Server\bin\;C:\Perl\site\bin;C:\Perl\bin;

svnnotify --repos-path %REPOS% --revision %REV% --to %EMAILADDRESSES% -f [email protected] --smtp smtp.example.com --subject-prefix "SVN - Rev: %%d - "


推荐答案

解决方案,使用关键字nosvnemail:

Here's the solution, using keyword "nosvnemail":

set REPOS=%1
set REV=%2
set EMAILADDRESSES="[email protected]"
set OS=Windows_NT
set PATH=%PATH%;C:\Program Files\VisualSVN Server\bin\;C:\Perl\site\bin;C:\Perl\bin;

svnlook log -r %2 %1 | FindStr "nosvnemail"

IF %ERRORLEVEL% EQU 0 GOTO SKIPEMAIL

svnnotify --repos-path %REPOS% --revision %REV% --to %EMAILADDRESSES% -f [email protected] --smtp smtp.example.com --subject-prefix "SVN - Rev: %%d - "

:SKIPEMAIL

exit 0

这篇关于如何有条件地发送svn commit电子邮件,基于提交消息关键字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 15:40