Mohan Cheema's Online Diary

Site Just to Keep Track of My Day to Day Work.

SVN Hook to send email after commit

| 0 comments

As SVN admin we are asked to send an email to release managers and testers for all the commits made to the repository so that release managers can update their release sheet and testers can do the testing. This is small post-commit hook for SVN which sends out an email to release manager and testers.

#!/bin/sh

REPOS="$1"
REV="$2"

SVNLOOK=/usr/bin/svnlook

auth=`$SVNLOOK author -r $REV $REPOS`
dt=`$SVNLOOK date -r $REV $REPOS | sed 's/,//g'`
changed=`$SVNLOOK changed -r $REV $REPOS`
log=`$SVNLOOK log -r $REV $REPOS`
n=$'n'

LISTID="releasemanagers@yourdomain.com testers@yourdomain.com"

echo "$n $n====Status:PROJECT INTEGRATION svncommit: $DATTIM====$n Changeset [Revision ID ${REV}] by $auth.$n$n On Date $dt.$n$n With Comment $n$log.$n$n Files Changed$n $changed.$n $n" | mailx -s "New Commit in $REPOS" $LISTID

I hope this will be helpful for someone. You can also write SVN Hook to stop commits without comments

Share

Author: Mohan Cheema

I am a Commerce Graduate currently I am working as Senior Support Analyst (Linux Administrator) with medium sized MNC Company. If time permits I do freelance work like setting up the servers as per the requirement, do performance tuning and so on.

Leave a Reply

Required fields are marked *.

*

* Copy this password:

* Type or paste password here:

2,910 Spam Comments Blocked so far by Spam Free Wordpress


CommentLuv badge

Notify me of followup comments via e-mail. You can also subscribe without commenting.