Using Subversion Hooks to send out build emails



The subversion version control system has a wonderfully handy feature called hooks. Hooks are essentially scripts that are triggered by a version control event (such as a commits, or revision property changes).
Subversion Hooks are located in your repository directory (so if you have multiple repositories you have to setup hooks for each one) in a directory called hooks, perhaps something like this: /home/svn/projectName/hooks. There are template files (.tmpl) in the directory for each event (these files are just examples). The events are:
- start-commit - run before commit transaction begins, can be used to do special permission checking
- pre-commit - run at the end of the transaction, but before commit. Often used to validate things such as a non zero length log message.
- post-commit - runs after the transaction has been committed. Can be used for sending emails, or backing up repository.
- pre-revprop-change - runs before a revision property change. Can be used to check permissions.
- post-revprop-change - runs after a revision property change. Can be used to email or backup these changes.
In your hooks directory you will find a .tmpl file with each of the event names, if you want to enable one of the hooks, copy the template file (without the .tmpl extension) and make it executable.
Note: On windows you need to rename the .tmpl file with an extension that is executable by windows such as an exe or bat file.
If you want to send out a build email on post-commit copy the post-commit.tmpl file to post-commit and make it executable. Edit the file, and add your email addresses.
Subversion comes with a few other pre-built hook scripts, there is a hot-backup.py script that can be used to make hot backups of your repository after commits.
You can find more info about this in the
Version control with Subversion book which can also be found here
Tweet
Related Entries
- Bug Report hooks for FindBugs and Subversion - May 9, 2005
- Subversion commit message validator pre-commit hook - May 31, 2005
- Top 10 Things I like about subversion - February 23, 2005
- Subversion Better than CVS? - March 4, 2004
Trackbacks
Comments
But your blog title mentions "build emails". How can you use svn hooks to email results of a build?
Did I miss something?
We actually use subversion hooks to do just that, we send the results of the ant build script and also the svn commit. Basically what you need to do is write the results of your build to a file, and include the contents of the file in the email
AFAIK, the various hook scripts execute in a synchronous fashion, keeping the svn client blocked until everything is complete.
In other words, I'm assuming your svn client is blocked until your build is complete (correct me if I'm wrong).
Since commit transactions now become potentially very long (a build of a project typically takes from 10 secs to 30 minutes) - how does this impact your work?
Does svn allow concurrent commits? (I.e. can Sue commit while Fred's commit is in process?) If concurrent commits are not possible, wouldn't your setup potentially cause developers to have to queue up in order to commit their changes?
What I mean is that unless there is a fork (done by svn or your hook script), I don't see how the client would *not* hang ?!
In my tmpl file, commit-email.pl was getting called, but it is not a program in my $PATH. As the post-commit.tmpl file said, checkout http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ to find a script, or look to see if commit-email.pl was include in /usr/share somewhere (as packaged by your distro). Then you can copy it somewhere, and call it explicitly.
you can find it at: http://dev.nxt.myftp.org/projects/SVNRevMailer/
How are you doing? I am doing just fine. It is a little hot here now, and I have to take a cool bath just to cool off.
Your mother said I would be glued to my computer, and people would come here and say where is Beth, and Martin would say who's Beth. Well she is right, cause I use this all of the time. I love computers. Well you know that.
Write to me any time you can, and I will write back to you.
love Beth
Hostgator Coupon 20% OFF : GREEN Hostgator Coupon 20% OFF (October): SPOOKY Hostgator coupon - "HGC25 - $9.94 discount Hostgator coupon - "jury" - $9.94 discount Hostgator coupon - "iceishot" - $9.94 discount Hostgator coupon - "Hostcritique" - $9.94 discount
HostGator Valentine's Day Coupon Coupon code - "Heart" - It saves you 20% on your order!
First Month 1 Cent Coupons ($9.94 Off) <img>http://www.bloggingtipsonline.com/terminal/img/1660/z08q1005awez/confused.gif</img> 1. "iceishot" - $9.94 OFF 2. "jury" - $9.94 OFF 3. "webhostingunleashed" - $9.94 OFF
To save upto $ 9.94 on Hostgator Shared Hosting, enter any of the below mentioned:
Hostgator Coupon Code : WEBHOSTING Hostgator Coupon Code : TURKEY Hostgator Coupon Code : FINDMYHOST Hostgator Coupon Code : TOPHOST Hostgator Coupon Code : HGC25 Hostgator Coupon Code : 404PAGE Hostgator Coupon Code : HOSTGATOR Hostgator Coupon Code : WORDPRESS Hostgator Coupon Code : ICEISHOT
Hostgator Resellers Coupon Code : CO_NR
This hostgator coupon will give you following discount:
* Hostgator Hatchling 1 year: $6.95 x 12 x 20% Off = $16.68 Discount! * Hostgator Hatchling 2 year: $5.95 x 24 x 20% Off = $28.56 Discount! * Hostgator Hatchling 3 year: $4.95 x 36 x 20% Off = $35.64 Discount! * Hostgator Baby 2 year: $8.95 x 24 x 20% Off = $42.96 Discount! * Hostgator Baby 3 year: $7.95 x 36 x 20% Off = $57.24 Discount! * Hostgator Swamp 2 year: $13.95 x 24 x 20% Off = $66.96 Discount! * Hostgator Swamp 3 year: $12.95 x 36 x 20% Off = $93.24 Discount!
Enjoy!!
<img>http://bloggingtipsonline.com/terminal/img/1660/z08q1005awez/confused.gif</img>
http://bit.ly/sell-hosting
I mean everytime there is an earthquake, a flood, an oil spill - there's always a group of heartless people who rip off tax payers.
This is in response to reading that 4 of Oprah Winfreys "angels" got busted ripping off the system. Shame on them! http://www.cbsnews.com/blogs/2009/08/19/crimesider/entry5251471.shtml
Can I use some of the information from your post right above if I provide a backlink back to this site?
Thanks, Harry
I would appreciate if someone here at www.petefreitag.com could post it.
Thanks, James
Can I use some of the information from this post right above if I give a link back to this website?
Thanks, James
I would appreciate if someone here at www.petefreitag.com could repost it.
Thanks, Daniel
Can I use some of the information from this blog post above if I give a link back to this website?
Thanks, John
I would appreciate if a staff member here at www.petefreitag.com could post it.
Thanks, Harry
I would appreciate if someone here at www.petefreitag.com could repost it.
Thanks, Jack
greets roland
Post a Comment
Recent Entries
- Firefox Aurora now Supports Content Security Policy 1.0
- Writing Secure CFML cfObjective 2013 Slides
- Upgrading to Java 7 on Linux
- J2EE Sessions in CF10 Uses Secure Cookies
- Learn about ColdFusion Security at cfObjective 2013
- Session Loss and Session Fixation in ColdFusion
- FuseGuard 2.3 Released
- CKEditor Spell Checker Plugin


add to del.icio.us



