Redmine has a module which allows to link SVN changesets to tickets so we can follow commits to given ticket on ticket’s page.
So I want to write commit message like this:
!a: some code modified (what a useful message:) !t: #1234
When configured well this change will be shown in Redmine below ticket 1234.
This blog entry shows the opposite direction: how to link SVN log message to Redmine ticket with a handy URL?
After using some post-commit hook magic my log entry above will be visible as below:
!a: some code modified (what a useful message:) !t: #1234 (https://my.redmine.site/issues/1234)
Which, at least in TortoiseSVN will be shown as a real, clickable link. So when we are browsing log messages we will be in one click distance from the referenced ticket!
The magic is not magic at all. Simply add/modify You post-commit hook script to contain these lines:
#!/bin/sh REPOS="$1" REV="$2" tmp=`mktemp` LC_ALL=hu_HU.ISO-8859-2 /usr/bin/svnlook log -r $REV "$REPOS" |sed 's%^!t:[^#]*#\([0-9]*\)$%!t: #\1 (https://my.redmine.site/issues/\1)%' > $tmp LC_ALL=hu_HU.ISO-8859-2 /usr/bin/svnadmin setlog "$REPOS" -r $REV $tmp --bypass-hooks rm $tmp
This will modify commit log message as described above.
The only thing to mention is the explicit locale setting. Without this we lost some characters from our ABC 🙂