任何人有提交通知钩子脚本,将在提交代码时发送电子邮件? [英] Anyone have commit notification hook script that will send email upon commit of codes?

查看:139
本文介绍了任何人有提交通知钩子脚本,将在提交代码时发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以与我分享这个脚本吗?

Can share with me any of this script?

推荐答案

由于某些原因,ruby脚本和默认钩子脚本不为我工作这可能是由于我们的邮件服务器的一些怪异,但我会在这里包括重要的部分:

For some reason, the ruby script and the default hook script didn't work for me. This might be due to some oddities with our mail server, but I'll include the important part here anyway:

#!/bin/sh

REPOS="$1"
REV="$2"

svnnotify --repos-path "$REPOS" --revision "$REV" --with-diff --to mailinglist@server.domain --smtp mailserver.domain --from svn@server.domain -VVVVVVVVV -P "[repository_name]"

如果要测试脚本之外的命令,-VVVVVV部分将显示非常详细的消息。它应该在实际的脚本中删除。

The -VVVVVVV part displays very verbose messages if you want to test the command outside of the script. It should be removed in the actual script.

当然,为了这个工作,你需要安装svnnotify。您可以先安装cpan来安装,这个应用程序应该与perl一起安装。然后,您需要启动cpan并安装SVN :: Notify库。

Of course, for this to work you'll need to install svnnotify. You can install this by first installing cpan, which should come with perl. Then you need to launch cpan and install the SVN::Notify library.

$ cpan
cpan> install SVN::Notify

请注意,'$'和'cpan>'部分只是提示,您不需要键入它们。

Note that the '$' and the 'cpan>' parts are just prompts, you don't need to type them.

此解决方案对我来说更有吸引力,因为它提供了详细的错误消息,这些错误消息有助于整理这些问题邮件服务器我提到。我们还有多个存储库,因此将整个程序/脚本复制到每个目录将是多余的。您的里程可能会有所不同。

This solution was much more attractive for me, because it gave detailed error message which were instrumental in sorting out those problems with the mail server I mentioned. We also have multiple repositories, so copying a whole program / script into each directory would have been redundant. Your mileage may vary.

顶部代码块中的文本应放置在名为post-commit的文本文件中。该文件应位于/ path / to / svn / repos / repository_name / hooks并标记为可执行文件。

The text in the code block at the top should be placed in a text file named "post-commit". This file should be located at /path/to/svn/repos/repository_name/hooks and marked as executable.

这篇关于任何人有提交通知钩子脚本,将在提交代码时发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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