📜 ⬆️ ⬇️

svn diff notification

Quick trick to get svn change notifications
Required to receive notification of changes in svn.
In svn it is possible to customize different hooks to various actions.
A simple example of receiving notifications via e-mail (you can use the mail command, but under the conditions of the task it was not there, there was also no sendmail and other things. In general, you can do as you please, but this is the simplest option that fit the conditions of the problem).

#!/usr/bin/perl -w
use Net::SMTP_auth;

my $repos=$ARGV[0];
my $rev=$ARGV[1];
my $change_data=`/usr/local/bin/svnlook diff -r $rev /home/svn/masterpanel/`;

$smtp = Net::SMTP_auth->new('smtp.example.com');
$smtp->auth('CRAM-MD5', 'some_login', 'some_pass');

$smtp->mail('svn@example.ru');
$smtp->to('masters@example.com');

$smtp->data();
$smtp->datasend("Subject: svn.example.com\n");
$smtp->datasend('From: svn@example.com');
$smtp->datasend("\n");
$smtp->datasend("$repos\n");
$smtp->datasend("$rev\n");
$smtp->datasend("$change_data\n");
$smtp->dataend();

$smtp->quit;


Now this script needs to be placed in / home / svn / masterpanel / hooks / post-commit
Give it permission to execute for the user owner.

')

Source: https://habr.com/ru/post/55719/


All Articles