subversion-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <>
Subject Re: svn
Date Fri, 23 Jul 2010 13:49:20 GMT
On Thu, Jul 22, 2010 at 10:48 AM,  <> wrote:
> Is there a way so when i commited a project, an automatic message(alert,..)
> could be send to different persons

You can be the first on your block to try out a new and not so
thoroughly tested post-commit hook written in that unreadable Perl
script no one uses any more!

I wrote a post-commit hook that does exactly what you want and does
something many of these other scripts don't do: It allows users to set
their own notifications.

One of the things I hated about all the other notification hooks out
there is that they all require one person (namely you) to setup the
configuration file. If a developer wants to change what files they get
notified on, they have to ask you to change the configuration file.

Being a lazy sort of person who'd rather watch YouTube videos all day,
I wrote a Subversion notification script that stores the notification
configuration files inside your Subversion repository. Each user gets
their own configuration file to play with. Since the files are in the
Subversion repository, users have access to them without having to
have access to the Subversion server itself.

The syntax of the configuration file is quite simple: Users enter in
the email addresses they want the notification sent to. (That's right,
they can enter in more than one!). Users also specify what files they
want to watch using either Perl's Regular Expression sytax or the
syntax Ant uses when specifying files using <fileset> and <include>
and <exclude> tasks.

The main caveat is that this script isn't as thoroughly tested as I'd
like. Normally, I foist my stuff on several companies and when the
developers stop whining that it doesn't work, I consider it good
enough for general distribution. This script has been only tested on
one company.

The other is that it isn't "complete". I showed the hook to someone
else, and they commented that it would be great if I could get it to
work with svn-notify. That I never did. The script has an "internal"
notification method. You can specify the format of that notification
and that is quite flexible, but it doesn't do groovy things like send
you multi colored diffs as you can via svn-notify.

As for the unreadable Perl, I generally write my code for readability
-- even in Perl. In fact, several Python programmers have commented to
me how easy it is to read my Perl code. I've been known to take a
working script and simply rewrite the whole thing from scratch just to
make it easier to understand and maintain. I do use the Object
Oriented Perl coding style which does throw off Perl developers who
never used Object Oriented Perl code, but if you're a Perl developer,
it's about time to learn how to write in a OOP fashion. I find OOP
Perl code tends to be easier to maintain and use.

I also try to write my code not to require non-standard Perl modules
because I know that on many sites, it is impossible to install
optional Perl modules without having to jumpt through a lot of
administrative hoops.

If you're interested, you can download this hook via: The hook you're
interested in is called The script is fully documented
via Perl POD. If you look at the first few lines of the script,
(Specifically lines 14 to 22) it will tell you how to generate the

The script is open source via the BMAB license.

David Weintraub

View raw message