Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Subversion's post-commit hook (svn-notify)
#!/usr/bin/perl -w
use strict;
use SVN::Notify;
my $path = $ARGV[0];
my $rev = $ARGV[1];
my %params = (
repos_path => $path,
revision => $rev,
handler => 'HTML::ColorDiff',
trac_url => 'http://trac.example.com/project',
filters => ['Trac'],
with_diff => 1,
diff_switches => '--no-diff-added --no-diff-deleted',
subject_cx => 1,
strip_cx_regex => [ '^trunk/', '^branches/', '^tags/' ],
footer => 'Administrado por: BOFH <bofh@example.com>',
max_sub_length => 72,
max_diff_length => 1024,
from => 'noreply@example.com',
subject_prefix => '[project]',
smtp => 'smtp.example.com',
smtp_user => 'example',
smtp_pass => 'example',
);
my $developers = 'dev@example.com';
my $admins = 'admins@example.com';
$params{to_regex_map} = {
$developers => '^trunk|^branches',
$admins => '^tags|^trunk'
};
my $notifier = SVN::Notify->new(%params);
$notifier->prepare;
$notifier->execute;
__END__
=head1 Name
post-commit - Subversion's post-commit hook using SVN::Notify
=head1 Usage
post-commit PATH REVISION
=head1 Options
PATH Path to the Subversion repository. Required.
REVISION Commit revision number. Required.
=head1 Author
Milton Mazzarri <milmazz@gmail.com>
=head1 Copyright and License
Copyright (c) 2010 Milton Mazzarri. Some Rights Reserved.
This script is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.
=cut
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment