» Home » Tutorials » SVNbot2009-04-17 13:48:15

This tutorial shows how to install a subversion script that automatically posts updates to laconi.ca/twitter containing the commit log message.


  • This subversion addon has to be installed on the subversion server, not the client
  • You'll need unique SVNbot installations for each laconi.ca/twitter account you want to post to.

Installing SVNbot

First we have to download a Perl module called Net::Twitter which will do the posting stuff. To do that, enter

cpan Net::Twitter

into a root console and follow the instructions.

When we've done that, we can get SVNbot via subversion (I assume you have already installed the svn client on your subversion server):

cd $target_directory
svn checkout https://fakeroot.at/svn/svnbot

So, now you've got a svnbot directory within the current working directory. Change into it and copy config.pl.example to config.pl:

cd svnbot
cp config.pl.example config.pl

Now edit config.pl with your favourite editor.

After that you may want to try out svnbot.


./svnbot [laconica-group]

e.g.: ./svnbot /svn/svnbot 123

Installing a subversion hook

We want svnbot to be called every time someone commited to your subversion repository.

The subversion hook for that action is called post-commit hook.

Go to your subversion repository. There you'll have a directory called hooks that contains something like this:

-rw-rw-r-- 1 root www-data 2000 17. Apr 14:34 post-commit.tmpl
-rw-rw-r-- 1 root www-data 1690 17. Apr 14:34 post-lock.tmpl
-rw-rw-r-- 1 root www-data 2307 17. Apr 14:34 post-revprop-change.tmpl
-rw-rw-r-- 1 root www-data 1606 17. Apr 14:34 post-unlock.tmpl
-rw-rw-r-- 1 root www-data 2982 17. Apr 14:34 pre-commit.tmpl
-rw-rw-r-- 1 root www-data 2038 17. Apr 14:34 pre-lock.tmpl
-rw-rw-r-- 1 root www-data 2764 17. Apr 14:34 pre-revprop-change.tmpl
-rw-rw-r-- 1 root www-data 1980 17. Apr 14:34 pre-unlock.tmpl
-rw-rw-r-- 1 root www-data 2758 17. Apr 14:34 start-commit.tmpl

If you haven't got a file called post-commit yet, copy the template file and make it executable:

cp post-commit.tmpl post-commit
chmod +x post-commit

remove the commit-email line with something like that:

cd /path/to/your/SVNbot/
./svnbot "$1" "$2"

cd /path/to/your/SVNbot/
./svnbot "$1" "$2" mysvncommits

That's it. Now your SVNbot should be installed.

Valid XHTML 1.0