Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何根据提交邮件关键字有条件地发送svn提交电子邮件?_Svn_Email_Notifications_Post Commit - Fatal编程技术网

如何根据提交邮件关键字有条件地发送svn提交电子邮件?

如何根据提交邮件关键字有条件地发送svn提交电子邮件?,svn,email,notifications,post-commit,Svn,Email,Notifications,Post Commit,我已经开始通过post commit(常见设置)发送通知电子邮件,但我希望在提交消息中包含某些关键字时不发送电子邮件,例如“#noemail”或类似内容 有没有人举个例子,说明我可以在post-commit钩子中添加什么来查看提交消息,并在存在某些关键字的情况下阻止发送电子邮件 谢谢 仅供参考,以下是我当前提交后内容的示例: set REPOS=%1 set REV=%2 set EMAILADDRESSES="example@example.com" set OS=Windows_NT se

我已经开始通过post commit(常见设置)发送通知电子邮件,但我希望在提交消息中包含某些关键字时不发送电子邮件,例如“#noemail”或类似内容

有没有人举个例子,说明我可以在post-commit钩子中添加什么来查看提交消息,并在存在某些关键字的情况下阻止发送电子邮件

谢谢


仅供参考,以下是我当前提交后内容的示例:

set REPOS=%1
set REV=%2
set EMAILADDRESSES="example@example.com"
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 svn@example.com --smtp smtp.example.com --subject-prefix "SVN - Rev: %%d - "

以下是使用关键字“nosvnemail”的解决方案:


对于linux,以下
hooks/post-commit
将起作用:

REPOS="$1"
REV="$2"
SVNLOOK=$(which svnlook)

LOGMSG=$($SVNLOOK log -r $REV $REPOS)
if [[ $LOGMSG != nosvnemail* ]] ; then
    "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
fi
日志消息中的
nosvnemail
字符串必须位于第一位

REPOS="$1"
REV="$2"
SVNLOOK=$(which svnlook)

LOGMSG=$($SVNLOOK log -r $REV $REPOS)
if [[ $LOGMSG != nosvnemail* ]] ; then
    "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
fi