ore than a week ago I wrote about getting Subversion running remotely. However, now that I have multiple people using it remotely I want to know when someone commits changes. I have come to find out that this is very simple to do using hooks. However, I did run into a little trouble configuring it. So here are my findings.
With a default install of Fedora Core 4, Apache 2, and Subversion you can follow my example and everything should work fine.
You should find a directory: (substitute the X’s with your version numbers)
I wanted this directory to be somewhere more memorable for me, so I actually moved it to:
I also wanted to ensure that apache would be able to do everything that it needed to, since I am using Subversion remotely. I did it this way:
cd /usr/local/bin mkdir svn_stuff cp -R /usr/share/docs/subversion-X.X.X/tools/hook-scripts /usr/local/bin/svn_stuff chmod -R 755 svn_stuff chown -R apache.apache svn_stuff
There are many things in this directory, but the one I am using for this example is commit-email.pl.
Now that I have what I need in the
/usr/local/bin/svn_stuff/hook-scripts directory I am ready to create the hook.
In my repository, which is located at
/var/www/svnprojects I need to edit a file in the
hooks directory. The file is post-commit.tmpl that needs to be renamed to post-commit, then edit the file by adding one line.
I renamed the file by typing:
cp post-commit.tmpl post-commit
Then I added the following line to the file post-commit:
/usr/local/bin/svn_stuff/hook-scripts/commit-email.pl $REPOS $REV firstname.lastname@example.org
And I commented out the two lines that were already in the file as examples like so:
# commit-email.pl "$REPOS" "$REV" [email protected] # log-commit.py --repository "$REPOS" --revision "$REV"
After closing the file the email should work upon a commit.