SVN Hooks Configuration

May 11th, 2010 by bhumish.shah § 2

Today, I will show you an excellent way of doing a code review of your team.

This article is based on Fedora, Redhat, CentOS distribution.

I’ll talk about how to configure an SVN commit event for email notification on repositories  named svnmailtesting.

After installing subversion in Linux you can find the subversion-tool in following location:

/usr/share/doc/subversion-1.4.4/tools

You can find mailer.conf in the following location:

/usr/share/doc/subversion-1.4.4/tools/hook-scripts/mailer/mailer.conf.example/

An example for the Mailer.conf. is the main file for configuration. It looks like this after removing the comments:

[general]
smtp_hostname = 192.168.0.208
[defaults]
diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s
commit_subject_prefix = [SVN-Commit]
propchange_subject_prefix =
lock_subject_prefix =
unlock_subject_prefix =
from_addr = [email protected]
to_addr = [email protected]
reply_to =
generate_diffs = add copy modify
show_nonmatching_paths = yes
[maps]

This is a very simple file . You have to just change the smtp server, “from” address and “to” address according to your environment.

You can either configure mailer.conf.example and rename it to mailer.conf file

or

Just copy and paste the above code in mailer.conf file

For example :

#vim mailer.conf

Copy the code above and paste it in the  mailer.con file and  change the smtp server , “from” address and “to” address. After completing these steps, copy mailer.conf file to following location:

cp mailer.conf  /var/www/svn/repo/svnmailtesting/conf/

After completing the  steps go to the following path:

/var/www/svn/repo/svnmailtesting/hooks/

Rename post-commit.tpl file to post-commit and make it executeable so the apache user can execute this file:

# cd  /var/www/svn/repo/svnmailtesting/hooks/
# mv post-commit.tpl post-commit
# chmod 770 post-commit
#vim post-commit

Add the following line at the end of the file:

/usr/share/doc/subversion-1.4.4/tools/hook-scripts/mailer/mailer.py commit “$REPOS” “$REV”

After completing these steps, whenever a user commit in svn repositories (svnmailtesting), one mail will get sent from [email protected] to [email protected] account with the subject: You have configured in mailer.conf file.

Great, so now you have an excellent way of doing code reviews of the developers.

Please write in comment if I have missed anything here.

Tagged: , , ,

§ 2 Responses to “SVN Hooks Configuration”

What's this?

You are currently reading SVN Hooks Configuration at Digicorp.

meta

Share