http://blog.crazytje.be/mantis-svn-integration-in-the-1-2-x/
Recently I upgrade my mantis version from 1.1.8 to 1.2.6, first thing I ran into was my SVN hook that didn’t work anymore.
In the 1.2.x they moved the checkin.php and implemented a fairly extensive plug-in system.
With the new 1.2.x mantis takes the source control integration a step further, it now natively supports source control integration and integrates nicely with WebSVN.
A few screenshot to show what they added:
Because of the integration with WebSVN, it allows for direct links to the diffs and modified files from within mantis.
So no need to look up changes manually anymore.
The downside is that the installation becomes harder. In the past it was calling the checkin.php script with a few parameters and that was it.
This has changed!
I already went over how to install WebSVN here but to be complete I’ll go over it again.
For the WebSVN you’ll need svn(doh!) and a webserver like apache, lighthttpd or IIS.
A short description taken from the Websvn website to explain what it does:
“WebSVN offers a view onto your subversion repositories that’s been designed to reflect the Subversion methodology. You can view the log of any file or directory and see a list of all the files changed, added or deleted in any given revision. You can also view the differences between two versions of a file so as to see exactly what was changed in a particular revision.”
To install WebSVN, follow these steps:
Add repository path(s):
the addRepository can be used to add all kinds of repositories, see the config file for examples.
Go to “http://yourdomain.ext/websvn” and you should be able to view your repository.
My setup looked like this:
Now that we’ve got the prerequisites up and running it’s time to add the plug-ins we need to mantis.
We’ll need the following plugins:
They can be downloaded from here:
https://github.com/mantisbt-plugins/source-integration
Extract the file and copy the directories into your mantis plugins directory(modify the commands to suite your needs).
Log in on the mantis site, go to ‘manage’ and click ‘ Manage Plugins’.
You’ll see a list of plug-ins available for your installation.
Install the plug-ins in this order:
To configure the source control plug-in click the ” Source Control Integration 0.16.4″ in the first column of ‘Installed Plugins’
Here you can set your own preferences.
Check the ‘Enabled Features’ checkboxes and change the regex’s if you want. I changed mine to those I was used to:
Create an api key and fill it in by running:
‘-hex’ is also ok, but that didn’t work for me.
At the bottom don’t forget to enter the path to your svn binary, on linux this is most of the time /usr/bin.
You’ll see a new link popping up in the menu called “Repositories”, click it and add your repositories.
Enter a name for the repository you’d like to add, select WebSVN and press ‘Create Repository’.
For the params you need to fill in:
Once filled in, press ‘Update Repository’. The page you’ll see next gives you the option to import the latest data or everything.
Be careful when importing, this will react on the ‘fixed issues’ in the commits, add the notes and send out mails!
There is one more step to do. That is pushing svn commits to mantis.
This is still done with a svn post-commit hook.
There is a post-commit script already available in “/mantis/plugins/SourceWebSVN/post-commit.tmpl”
Copy this script to your svn hooks directory and remove the .tmpl.
Modify the script to suite your needs, for most people changing the URL and PROJECT variable should do the trick.
Don’t forget that the ‘PROJECT’ needs to be the same name used as repository title in mantis!
The result should be that you can commit and the changeset together with the resolving/adding a message to an issue.
Example(depends on regex and template message settings):
Results in:
Note that the message displayed in the screenshots above are from a modified Mantis version.
More info on getting the author and revision changes to be shown can be found here:
Mantis SVN Integration : Adding extra info to the Note
And that’s how you set up the SVN integration with mantis.
It’s worth the extra effort, because mantis plays really nicely together with WebSVN.