Subversion post-commit hook script posting commit info to Simple Machines Forum
You can use this script as post-commit hook of your svn repo, and it'll announce each commit as new topic on selected boards.
Tested to be compatible with Simple Machines Forum 2.0.x
The arguments are the default arguments accepted by svn post-commit hook:
./svn-smf-hook.py /absolute/path/to/your/repo revision
Working like a charm.
This script is continously developed, so be sure to check back for updated versions! 😄
All that's needed to run this script is Python 2.6 (or newer) and subversion. No other external dependencies.
Python 3 is not supported atm, though it'd be probably easy to convert the script with 2to3 tool.
Just download svn-smf-hook.py and svn-smf-hook.conf files and place it in your hooks folder. Then configure the script and run it from post-commit hook.
#!/bin/sh
REPO=/aboslute/path/to/your/repo
/usr/bin/env python $REPO/hooks/svn-smf-hook.py $1 $2
Or if you want it to be asynchronous (so the commit operation will not have to wait till posting ends):
#!/bin/sh
REPO=/aboslute/path/to/your/repo
/usr/bin/env python $REPO/hooks/svn-smf-hook.py $1 $2 &
Before you deploy this as hook, make sure to properly configure it in svn-smf-hook.conf file. Config options are documented in conf file.
svn-smf-hook features Trac and Redmine integration. You can enable it by setting PMS and PMS_URL config option to the url of your trac/redmine installation.
With PMS integration enabled, the revision number, changed files and all ticket references in commit message (for example: ticket #1234) will be converted into links to their PMS pages.
PMS value | what PMS_URL should point to | Example |
---|---|---|
'trac' | Root trac address | PMS_URL = 'http://trac.myproject.net' |
'redmine' | Root of the project | PMS_URL = 'http://redmine.myproject.org/projects/fooproject' |
Even though this script features PMS integration, it does not work as post-commit hook refreshing repo status in PMS. To have your tickets in PMS updated on commit, use the PMS svn hook together with this script.
Read: http://trac.edgewall.org/wiki/TracRepositoryAdmin#Subversion
Personally, I use this Trac hook, and I find it working great. You can even close tickets via commit messages with it.
Please fill an issue with request, and I'll probably make it happen 😉
Pull requests are also welcome.
The post produced by this hook will look roughly like this:
=
user_56 made revision 12185 changing the following files:
modified /trunks/project/readme.txt
with the message:
update readme
=
The idea for this hook came from similiar hook for another forum software, by [FH]ctz.