Mail notification for subversion repository
Par SandRock le mardi 14 septembre 2010, 23:33 - Software - Lien permanent
I was searching for a little script able to email my collaborators and myself when someone commits something to my SVN repositories.
There seem to be a popular perl script commit-email.pl. But I had several errors when implementing it. This is why I decided to make one. Because it's useful and easy to configure, I'll share my entire script here.
As you can see, there is a little configuration section.
<?php // CONFIGURATION $svnlook = '/usr/bin/svnlook'; $globaladdress = 'someone+logs@gmail.com'; $repoaddress = array( 'repoAAA' => 'user1@aaa.com, user2@aaa.com', 'repoBBB' => 'user1@b.com, user2@b.com', ); $from = 'svn-noreply@svn-hosting.lol'; $replyto = 'admin@svn-hosting.lol'; //
Nothing fancy here. $svnlook is the path where the svnlook command can be run. $globaladdress is a email address where all commit will be notified. $repoaddress is a field for specific repositories to add email addresses. $from and $replyto are what they are.
It's following the svn postcommit hook. My SVN repos are located in /home/svn. You can create a hook in /home/svn/repoX/hooks/post-commit containing:
#!/bin/sh REPOS="$1" REV="$2" /usr/bin/php /home/svn/commit-email.php "$REPOS"
Don't forget to place my script in /home/svn and to install php5-cli.
