I recently set out to integrate a Subversion (SVN) source control repository with MantisBT, a free bug tracking system. I quickly found John Reese’s Source Integration plugin — available for the MantisBT 1.2.0 development branch — which promised to do exactly what I needed.
Reese provides step-by-step instructions to configure his plugin for a Git version control repository, but although his plugin supports Subversion, no walkthrough was available for an SVN scenario. Configuring the SVN plugin correctly took some trial and error, so I decided to document the process for others who want to get Mantis and SVN to play nicely.
- MantisBT 1.2.0
- As of this post, the latest development version is 1.2.0rc2
- Mantis Source Integration plugin
- This post refers to development snapshot version Fri, 2 Oct 2009 10:50:07
- Subversion command-line binaries
- The binaries must be available on the web server where MantisBT is installed
- A Subversion repository
- It’s not necessary for the repository itself to reside on the web server where MantisBT is installed
- WebSVN, a web front-end for Subversion respositories
- It’s not necessary for WebSVN to reside on the web server where MantisBT is installed or the server where your Subversion repository resides
- WebSVN should be configured to access the Subversion repository you’ll integrate with Mantis
Technically, WebSVN is optional: the Source Integration plugin will pull in your Subversion history using the command-line binaries alone. However, without WebSVN, links to browse the repository and view files or diffs from within MantisBT won’t work.
Source Integration Plugin Setup
Follow John Reese’s instructions through Step 4. You should now have the plugin installed in your MantisBT environment:
Next, click on the Subversion / WebSVN Integration link to access the configuration for the SVN plugin:
Fill in the location where the SVN command-line binaries reside on the web server. In the example above, my SVN binary is /usr/local/bin/svn. Be sure to only enter the directory portion of the path. Beware: if you enter the path incorrectly, the form will not return an error message.
Proceed with Steps 5 through 7 in Reese’s instructions, selecting WebSVN as the repository type. When you reach Step 8, the repository settings screen will look like this:
The settings are a little ambiguous at first: we’re creating a WebSVN repository, so does the URL field refer to the WebSVN address or the URL to the SVN repository itself? The WebSVN URL field calls for a trailing slash, but what about the WebSVN Path?
Beta software being what it is, the instructions will surely improve as the software evolves. For now, here are some additional guidelines to clarify the usage of each field shown above.
- A title of your choosing that will be used to describe this repository in the Mantis repositories list.
- The full Subversion (not WebSVN) repository URL
- In the example above, the repository resides at svn://svnserver/myproject/subdir
- SVN Username
- A valid username for accessing the SVN repository you entered in the URL field
- SVN Password
- The corresponding password for the username you entered
- WebSVN URL
- The base URL of your WebSVN installation: that is, the WebSVN landing page where you select from a list of repositories to browse
- In the example above, the WebSVN landing page is located at http://svnserver/websvn/
- WebSVN Name
- The name you entered in your WebSVN settings to describe the SVN repository
- In the example above, the WebSVN repository name is myproject
- Keep in mind that WebSVN names are not necessarily related to the SVN repository URL. Check your WebSVN config file (or compare with the repository list on the WebSVN landing page) to make sure you are using the appropriate spelling and capitalization here.
- WebSVN Path
- This is the path to the Subversion repository, relative to the top-level folder in your WebSVN repository
- In the example above, we have a WebSVN repository named myproject which is configured in our WebSVN settings to point to the Subversion URL svn://svnserver/myproject
- Since we want this MantisBT repository to point to svn://svnserver/myproject/subdir (one level deeper), the WebSVN path, relative to the WebSVN top-level path, is /subdir/
- In my testing, it was necessary to include both leading and trailing slashes in the WebSVN Path field
- Standard Repository
- Check this box if you use the conventional Subversion folder structure. In other words, the Subversion repository URL you entered should have subfolders named trunk, branches and tags, respectively.
- Trunk Path/Branch Path/Tag Path
- If you didn’t check the Standard Repository box, and if you use a different folder layout for your trunk/branches/tags folders, enter the paths here.
- I assume that these paths are relative to the Subversion URL. However, I haven’t tested these settings and some trial and error may be needed.
- Ignore Other Paths
- If you didn’t check the Standard Repository box, and if you entered your custom trunk/branches/tags folder paths in the previous fields, you can tell Mantis to ignore any other paths under the Subversion repository URL by checking this box.
When you’re finished, click the Update Repository button and proceed with the remaining instructions.
Thanks to John Reese and the other plugin contributors for a useful add-on.