Personal tools
You are here: Home Weblog Archive 2006 October 24 Watch my new commit...
Document Actions

Watch my new commit...

by jfroche last modified 2006-10-24 18:10
Filed Under:

Get notification as soon as somebody commit is really important! A quick note to set it up with emails...

We will make this in 4 steps.

Step 1: Installing pysvn

Check that you don't have it yet:
$ python2.4
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import svn
>>>
If you get something else (e.g ImportError: No module named svn) you will need to do this step:

You will need the python library to access subversion: pysvn. Note that header of the libsvn are required [should come with your subversion install]!
Go to  http://pysvn.tigris.org/project_downloads.html and fetch last tarball (MacOSX version also available). Note that
pysvn is noted there as "Extension". I fetched last stable version: http://pysvn.tigris.org/files/documents/1233/34994/pysvn-1.5.0.tar.gz

$ tar xvzf pysvn-1.5.0.tar.gz 
 ...
$ cd pysvn-1.5.0/Source
$ python2.4 setup.py configure
...
$ make
...[pray]...
$ mkdir /usr/lib/python2.4/site-packages/pysvn
$ cp pysvn/__init__.py /usr/lib/python2.4/site-packages/pysvn
$ cp pysvn/_pysvn.so /usr/lib/python2.4/site-packages/pysvn
Now try again and you should get something like:
$ python2.4
Python 2.4.3 (#2, Oct  6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import svn
>>>


Step 2: Installing SVNMailer


Go to http://storage.perlig.de/svnmailer/ and fetch last tarball (stable actual one is: http://storage.perlig.de/svnmailer/svnmailer-1.0.8.tar.gz)

Fallow these steps:
$ tar xvzf svnmailer-1.0.8.tar.gz
...

$ cd svnmailer-1.0.8
$ /usr/bin/python2.4 setup.py install
...

 You have now a brand new svnmailer installed. Check it with:

$ ls -l /usr/bin/svnmailer
-rwxr-xr-x 1 root root 2192 2006-10-24 17:00 /usr/bin/svn-mailer

3) Configure your repository to use svnmailer


We created a svn repository:

$ svnadmin create /var/svn/repos1
So we have a repository on our local filesystem in /var/svn/repos1

Go into the hooks directory:
$ cd /var/svn/repos1/hooks
Add/edit post-commit file.
And add the fallowing lines:
#!/bin/sh
REPOS="$1"
REV="$2"
/usr/bin/svn-mailer commit "$REPOS" "$REV" /etc/svn-mailer.conf
Change execute permission on post-commit
chmod 755 post-commit
It's time to configure SVNMailer

4) Configure SVNMailer


Edit/Add the file /etc/svn-mailer.conf
And add the fallowing lines [you might edit few things...]. Imagine that I have mymodule in my repository (so that i can do svn co file:///var/svn/repos1/mymodule)

[general]
# see http://opensource.perlig.de/svnmailer/doc-1.0/#general for details.

# the diff command to be used ... just copy it...
diff = /usr/bin/diff -u -L %(label_from)s -L %(label_to)s %(from)s %(to)s
# the sendmail location
mail_command = /usr/sbin/sendmail

[mymodule]
# see http://opensource.perlig.de/svnmailer/doc-1.0/#groups for details
# this part of the config apply only for commits under mymodule
for_paths = mymodule/.*

# the subject of the email
commit_subject_prefix = [MYMODULE]

# From address in the mail
from_addr = jfroche@jfroche.be

# To address ...
to_addr = peopleinterestinginmymodule@foo.bar

[defaults]
# see http://opensource.perlig.de/svnmailer/doc-1.0/#groups for details
# this part of the config apply for all the other module

# Default From address template
from_addr = %(author)s@localhost.localdomain

# the subject of the email
commit_subject_prefix = [SVN]
to_addr = jeff@jfroche.be foo@skynet.be bar@gmail.com
generate_diffs = add copy modify
suppress_deletes = yes
Here it is... Try to commit and you should get email...

If you want to traceback error, go to edit /var/svn/repos1/hooks/post-commit and for example log to a file by changing the line
/usr/bin/svn-mailer commit "$REPOS" "$REV" /etc/svn-mailer.conf
In
/usr/bin/svn-mailer commit "$REPOS" "$REV" /etc/svn-mailer.conf 2> 1> /tmp/svnmailer.log
Hope this helps ...

help with smtp

Posted by Anonymous User at 2009-04-10 21:21
Hi..
I would like to use the same with smtp.gmail.com as my smtp server.
Please help me in setting up with above...

Thanks..

your web page background makes it hard to read the text

Posted by Anonymous User at 2009-09-20 08:27
Your image background gets in the way of trying to read your useful blog entries.

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: