Subversion Commit E-mail Notification configuration

上一篇 / 下一篇  2009-04-02 15:49:06 / 个人分类:工作

If you want to get the notification email about the code update when a team member commits the code. And the mail contains the Author, Date, Modified,Log and Commit information, just like the following type:

Author: lulei

Date: 2009-04-02 15:12:50 +0800 (Thu, 02 Apr 2009) New Revision: 6615

 

Modified:

  nat/7.Test/test_file/test2.txt

Log:

Commit: Test for the commit notification. 

Modified: nat/7.Test/test_file/test2.txt ===================================================================

--- nat/7.Test/test_file/test2.txt 2009-04-02 07:08:21 UTC (rev 6614)

+++ nat/7.Test/test_file/test2.txt 2009-04-02 07:12:50 UTC (rev 6615)

@@ -8,5 +8,23 @@

 

 test it again when updating the repository of subversion.

 

+test it again when updating the repository of subversion.

+

+test it again when updating the repository of subversion.

 

This function is very useful and helpful to managers, but it needs more extra effort.

 

But it can be done by using the svn inbuilt hooks.For more information about the hooks, please refer to the manual of Subversion.

 

OK, let's do something for the mail notification.

 

First, you can access the website:http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/commit-email.pl.in, and stored the file "commit-email.pl.in" into your local disk.

 

Secondly,please copy the file "commit-email.pl.in" into the hooks directory of your Subversion repository, mine is "/svnroot/repo/hooks".

And then renanme the file "commit-email.pl.in" as "commit-email.pl".Defaultly, I thought you have installed perl on your server.

 

OK, cd to the hooks directory inside of your repository, rename the post-commit.tmpl to post-commit, and then chmod 755 to post-commit and commit-email.pl. Now, let's open the post-commit with your favorite editor, and put the following content at the bottom of the file:

/usr/bin/perl /svnroot/repo/hooks/commit-email.pl "$REPOS" "$REV" --fromsubversion_notifcation@example.com-s 'SVN Commit Notification'user_whom_to_notify@example.comanother_user_whom_to_notify@example.com

And then open the file "commit-email.pl" and make changes to the configuration according to your own requirement and server, sepcillay the svnlook path.

 

Congratulations! You are done, :)

 

Now the email addressuser_whom_to_notify@example.com,anthor_user_whom_to_notify@example.comwill get the notification emails whenever someone commits codes.

 

Hope this article is helpful to you.

 

So far, I still have an problem about the environment variables.Because sometimes you can not get the right result because of the variables.

OK,if any problems, you can contact me.

 

 


TAG:

雷子的blog 引用 删除 louis_lu   /   2009-06-02 10:53:49
原帖由七明芝于2009-05-21 19:53:18发表
最近老大也让我做这个东西,如果要设置trunk上commit才发邮件该怎么改呢?


这个要使用subversion的钩子原理,自己定义相关的收件人,我记得subversion里有个文件是直接可以用的"commit-email.pl"可以直接使用.
七明芝 软件测试之路 引用 删除 七明芝   /   2009-05-21 19:53:18
最近老大也让我做这个东西,如果要设置trunk上commit才发邮件该怎么改呢?
 

评分:0

我来说两句

Open Toolbar