Question

I have VisualSVN Server running on my server and I have created a post-commit hook to send an email to me when someone commits code, using the steps outlined here: http://www.visualsvn.com/support/topic/00018/

However, I would like to be able to have an email sent to one person if a certain project in SVN has been committed to, but someone else should receive an email if another project is committed to.

How can I go about creating multiple post-commit hooks to send emails to different people depending on on which project is committed to?

Was it helpful?

Solution 2

I figured it out. I simply entered the next hook underneath my initial one, separating them with line. Eg:

    "%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^
    commit-notification "%1" -r %2 ^
    --from svn@mycompany.co.za --to me@mycompany.co.za ^
    --smtp-server mail.mycompany.co.za ^
    --detailed-subject

   "%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^
    commit-notification "%1" -r %2 ^
    --from svn@mycompany.co.za --to someone_else@mycompany.co.za ^
    --smtp-server mail.mycompany.co.za ^
    --detailed-subject

OTHER TIPS

You might want to look at my post-commit Watch script. This will eliminate your need for multiple post-commit hooks in this circumstance.

This script will send email to multiple users depending what gets changed. The main purpose of this script is to allow users to set their own watches. Users can specify files or directories using glob or regex patterns. You can use my pre-commit script to prevent users from changing other user's watch files. This way, no one has to bother you when they need these types of notifications which can cut into your Candy Crush time.

Users can also set up which email accounts they'd like the watches to go to. Users can setup these notices to go to multiple email accounts, or even to email accounts associated with SMS, IM, Twitter, or Facebook accounts if they prefer notifications that way.

The hook uses Perl, but the standard Perl installation will work without having to add any additional modules. It should work with all Perl from 5.8.8 onwards too. Windows users can download install the most recent version of Perl for free since it's open source.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top