Unitz LLC
Home   |   Unitz News   |   Contact Us

Subversion (SVN) Repository Integration with Mantis Bug Tracker

Bookmark and Share
Posted by Chris Dornfeld at 7:23 pm on October 14, 2009 • Programming

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.


Prerequisites

  • 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:

MantisBT Installed Plugins

Next, click on the Subversion / WebSVN Integration link to access the configuration for the SVN plugin:

MantisBT SVN Configuration

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:

MantisBT WebSVN Repository

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.

  • Name
    • A title of your choosing that will be used to describe this repository in the Mantis repositories list.
  • URL
    • 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.

46 Comments »

  1. [...] Dornfeld at Unitz has an excellent, detailed overview of the options available when importing Subversion repositories into MantisBT using my Source [...]

    Pingback by LeetCode.net - Detailed Integration of Subversion in MantisBT at 11:31 pm on October 14, 2009

  2. [...] This post was mentioned on Twitter by Mantis Bug Tracker, Unitz LLC. Unitz LLC said: Latest U-notez blog post: Subversion (SVN) Repository Integration with Mantis Bug Tracker #MantisBT http://tinyurl.com/unotez-mantis-svn [...]

    Pingback by Tweets that mention U-notez » Subversion (SVN) Repository Integration with Mantis Bug Tracker - Unitz LLC -- Topsy.com at 10:37 pm on October 15, 2009

  3. Hi Chris

    Thanks for your graphical steps!

    I have setting up with those steps but failed in “Import Latest Data”, “Import Everything” and “Search”.

    Error messages in apache’s log when doing Search:
    PHP Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 10240 bytes) in /var/www/html/mantisbt-1.2.0rc2/plugins/Source/Source.FilterAPI.php on line 592, referer: https://localhost/mantisbt-1.2.0rc2/plugin.php?page=Source/index

    Error messages in Mantis WEB UI when doing “Import”:
    APPLICATION ERROR #0
    An error occurred during this action. You may wish to report this error to your local administrator.

    Does it suppot URL as: file:///repo/svn/myproject or https://localhost/svn/myproject ?

    raymond

    Comment by raymond at 12:13 am on October 30, 2009

  4. Hi Raymond, it sounds like you encountered the memory issue John Reese mentions in his original instructions: “Click ‘Import Latest Data’ to begin. Note that for large repositories, you may need to repeat this step, due to limits or timeouts, until it has finished importing the entire repository.”

    The repository I tested with was small enough that I didn’t run into that problem, but it sounds like you may be able to re-run “Import Latest Data” repeatedly until everything is imported.

    You should be able to use any valid SVN repository URL protocol: svn://, file:// and http(s)://. I believe the Mantis plug-in just passes the repository URL through as a parameter to the SVN binary.

    Comment by Chris Dornfeld at 10:25 am on October 30, 2009

  5. Hi Chris,
    this works fine,
    but is it possible to update the repositories automatically?
    So every user can see what happens last hours … and mus not press update or ask admin for update.
    Thanks Lars

    Comment by Lars at 6:04 am on November 5, 2009

  6. Hi Lars, I’m not aware of any way to automate the “Import Latest Data” process at the moment; I think you may be stuck clicking it manually. You might want to check with the plugin’s author, John Reese, and/or submit a feature request on his bug tracker: http://leetcode.net/mantis

    If all else fails, it may be possible to create a PHP script that runs as a cron job to instantiate a SourceWebSVNPlugin object and call the update function.

    Comment by Chris Dornfeld at 1:58 pm on November 5, 2009

  7. Chris,
    thanks I found a tip at John Reese web page:
    curl http://yoururl.xyz/mantisbt/plugin.php?page=Source/repo_import_latest&id=XX
    Now I installed a cron job and it works as expected.

    Do you know if it possible to map Issues to subversion? dependency – bug – svn sources?

    Lars

    Comment by Lars at 3:09 am on November 6, 2009

  8. Thanks for the follow-up, Lars — glad to hear there was an easy solution.

    You’re probably already aware of using SVN commit comments to reference a specific Mantis issue number (entering “Fixed bug #123″ causes that commit to be listed on the corresponding Mantis issue page, for example). As for further integration, I’m afraid I don’t know what other options are available at this point. I’d be interested to hear what else you have in mind.

    Comment by Chris Dornfeld at 5:08 pm on November 6, 2009

  9. This is a great description and I got it up and working quickly. I was just wondering if there was a setup which supports individual repositories per project? Isn’t that the preferred way of working? Or do you guys have all your sources in one single repository?

    Just wondering what’S best practice here.

    Comment by Jürgen at 6:40 am on February 2, 2010

  10. Hi Jürgen, using a different SVN repository for each Mantis project should work fine. Just create additional repository entries in Mantis for each repository used in your projects.

    I believe that Mantis issue numbers are unique across projects within each Mantis installation. There’s only one issue numbered #123 in Mantis, regardless of the number of projects you have. That means you should be able to reference issue numbers in your SVN commit comments in different repositories (see my comment #8 above) and they will be linked with the appropriate Mantis issues.

    Comment by Chris Dornfeld at 11:51 am on February 3, 2010

  11. Thanks Chris, I must have been a bit blind when asking my question. As it is designed it really works very nice.

    What I’ve been doing next is following the advice from Lars in #7 and tried to run that curl from console first but I am getting an application error #200 inside the html page returned from the URL. I filed a bug report at leetcode.net but no response yet. Has anyone here had the same problem before? I could imagine it has to do with authorization probably.

    Comment by Jürgen at 3:47 am on February 20, 2010

  12. Hi,
    first here one of the cron job line from me:

    0,10,20,30,40,50 7-20 * * 1-5 curl “http://localhost/mantis/plugin.php?page=Source/repo_import_latest&id=15″ > /dev/null 2>&1

    this works as normal user, not as root!
    The interworking svn mantis is good for me.

    But I have a question,
    has anyone upgraded/transfered the plugin??
    Is there a description anywhere?
    I changed to mantis 1.2 released and will transfer the plugins with the settings to the new release. Can I copy this?

    Thanks for help

    Lars

    Comment by Lars at 7:34 am on February 23, 2010

  13. Ok,
    I tried it
    - installed new mantis
    - copied the hole plugins dir from old to the new mantis
    - copied the new files (from git.mantisforge – source control – latest snapshot) into the same folder inside the plugins
    - it works!!!!
    have now source control integration 0.14
    all repositories included further ..

    Comment by Lars at 3:48 am on February 24, 2010

  14. I have install all plugin for SVN integration and all work fine.

    But i when i integrate the post-commit give as example i can’t mark bugs automatically resolved or anything else. Commit appears in the changesets of my bug.

    How can i do ?

    Comment by oxomichael at 10:46 am on February 26, 2010

  15. Sorry i solve my problem myself

    For all, you must take care of regular expression define by default. It could be not the same you use with mantisbt version 1.1.x

    Comment by oxomichael at 10:52 am on February 26, 2010

  16. Hi Lars, the syntax of your cron job in #12 works fine here. Thanks for your help. I’ve now integrated Mantis 1.2.0 with Subversion for a fairly substantial number of projects and developers and all is automated. Really nice. Feels like a cockpit and you have real control. Excellent.

    Comment by Jürgen at 9:17 am on March 11, 2010

  17. Hmm, stupid question… where do I actually download these plugins? I clicked the link to the SVN integration plugin, and it took me to a git repository… nowhere there did I see any “download” link, just a bunch of stuff like “commit” and “diff”! Don’t wanna mess up the git repository, just wanna download the plugins! ;)

    Comment by Ed Kolis at 3:06 pm on March 13, 2010

  18. Hi Ed, click the link in the article for “Mantis Source Integration plugin”, find the “shortlog” listing and click the first “snapshot” link to download the latest release in .tar.gz format.

    As mentioned above, these instructions are based on the release dated Fri, 2 Oct 2009 10:50:07. I have not had a chance to try out the newest release myself so you may find some differences if you select a newer snapshot.

    Comment by Chris Dornfeld at 3:45 pm on March 13, 2010

  19. [...] you want to get this set up then you should have a look at this post by Chris Dornfeld in addition to this post by John Reese. Just be mindful that the screenshots [...]

    Pingback by Mantis and Subversion-integration « Persistent Cloud at 6:58 am on March 17, 2010

  20. For those of you struggling to get the cronjob or post-commit curl command running: don’t forget to escape the ampersand, ie:

    curl http://my.domain.com/plugin.php?page=Source/repo_import_latest\&id=1

    Otherwise the id param not be transmitted.

    thanks for the write-up!

    Comment by mk at 10:59 am on April 7, 2010

  21. Anyone got the Sourceforge SVN plugin working?

    The parsing of the revision fails somehow.

    Ton

    Comment by Ton Plomp at 5:45 am on April 10, 2010

  22. Hi Jürgen,
    how did you get around your initial error message? I have the same error running this command from the terminal:
    curl http://www.domain.tld/mantisbt/plugin.php?page=Source/repo_import_latest&id=1
    Returns “APPLICATION ERROR #2800, Invalid form security token.”
    - MantisBT Core 1.2.1
    - Source Control Integration 0.16.1
    - Subversion Integration 0.16

    Comment by Andreas at 5:15 pm on May 9, 2010

  23. Hi, I am having trouble with the Cron job, curl http://www.domain.tld/mantisbt/plugin.php?page=Source/repo_import_latest&id=1 was executed but the result page is saying “Invalid form security token”.

    I think it’s because Plugin manage needs Administrator level, I am wondering how people work around it?

    Comment by Derrick at 1:52 am on May 19, 2010

  24. Hi,

    For those who have problems with :

    curl http://www.domain.tld/mantisbt/plugin.php?page=Source/repo_import_latest&id=1

    (APPLICATION ERROR #2800)

    The procedure has changed, yuo now have to do :

    curl http://www.domain.tld/mantisbt/plugin.php?page=Source/import&id=all

    (“id=all” for all you repos)

    See http://leetcode.net/mantis/view.php?id=120 for more infos

    Comment by johndoe at 1:30 pm on May 20, 2010

  25. Hi,

    thank you very much for the detailed instructions. I got the SVN integration in Mantis working!

    I have a question: Does anyone know, what’s the difference between “Import Latest Data” and “Import All”?

    Thanks
    Karl

    Comment by Karl at 4:42 am on June 18, 2010

  26. Hi Karl
    with “Import Latest Data” you can specify one repository separately.
    with “Import All” you update all available reps.

    Regards Lars

    Comment by Lars at 4:20 am on June 29, 2010

  27. Hi,

    I am trying to set up the repository and my repository is reachable trough a secure connection svn+ssh:// , I think this kind of access method is not recognized by you, could you please tell me where I can adjust the code, so I can add the necessary credentials for the ssh connection. Right now , when trying to connect I get :

    Requesting svn log for Import 2010-07-26 10:46:42 starting with revision 0…
    Processing svn log…
    No revisions parsed.

    Where could I see the actual server response.

    Thank you so much for you Help!

    Marcus

    Comment by Marcus at 4:48 am on July 26, 2010

  28. [...] seguimos las indicaciones que se indican en esta web, que son mucho más detalladas que las de su creador. Sólo hay una discrepancia: Todo se configura [...]

    Pingback by Unir Subversion con MantisBt, sin complicaciones. | Ni'palante Ni'patras at 7:52 am on October 26, 2010

  29. Hi,

    I was following your tutorial but I got stuck. I use ssh tunnels to access my svn server in the form of svn+user:///repo/

    If I try to simply set this as the server I get Application Error #0

    Do you know if the above is possible? Thank you.

    Comment by icebox at 5:51 am on November 3, 2010

  30. Hi,
    I need help:
    I want to refresh the repositories via crontab using curl.
    But I¨m alwys getting:
    Invalid remote import address

    In the Plugin settings I added localhost/mantis to the allowed addresses, but did not help.
    Whats wrong?

    Comment by Marcel at 5:30 am on November 17, 2010

  31. All I see in Mantis BT 1.2.4 is “Manage Plugins” with 4 plugins:
    Import/Export issues 1.0
    Mantis Graphs 1.0
    MantisBT Core 1.2.4
    MantisBT Formatting 1.0a

    And no option to add more, there are no options that I see to add a repository either. Googled until blue in the face, and the Mantis docs are as obtuse as possible.. what’s the magic trick that everyone else seems to know?

    Comment by AJ at 6:55 pm on December 18, 2010

  32. Hi,

    thanks for that great summary about the SVN usage.

    But I got a problem I cannot find a solution for:
    Wenn using the curl command to trigger the updates, I would like to use a special user inside mantis for this, just to have the list of changes set with the right name.

    Is there a way to supply the user with the import link?

    Any help is greatly appreciated

    Comment by TC at 9:04 am on January 10, 2011

  33. Hi all,
    I can’t find anywhere the proper configuration for a Windows installation. Can you please provide a little help here ?
    (in my case using the Source WebSVN plugin)

    I have mantis, websvn and subversion (through VisualSVN), all installed on a windows machine.

    1) in the Source Integration plugin configuration page, I don’t know the right syntax to input in the different field/
    Could I used windows path like c:\Program Files\etc… types of path (for svn binary for example: “c:\Program Files\VisualSVN\bin”) ?
    2) How can I convert the post-commit.tmpl file provided in the plugin into a DOS compatible script ?
    3) Does curl come automatically with php on windows ? or should it be installed manually ?

    Thank you in advance.

    Comment by AlainD. at 3:56 pm on February 24, 2011

  34. OK, I provide a piece of answer after some tests.
    1) for windows, the path format I gave is correct. Besides a error message is displayed if the path is incorrect.
    2) I managed to convert the hook script into DOS format, which I moved to the hooks dir of my repository. I successfully tested the scripts manually, but I don’t understand why it is not called automatically after each svn commit. If someone experienced the same pb please let me know how you solved it.
    3) the answer is no: I had to download it and install it appart.

    Thank you.

    Comment by AlainD. at 5:43 pm on February 26, 2011

  35. Thanks for your elaborate explanation. i however am stuck, because the repositories link did not appear.. how to fix this??

    Comment by Rene at 3:17 pm on July 7, 2011

  36. [...] eine Fehlermeldung die auf einen ungültigen Sicherheitstoken verweist. In einem Blog Eintrag von Chris Dornfeld habe ich jedoch einen angepassten URL Aufruf dazu gefunden, der nicht auf ein Repository [...]

    Pingback by HOWTO: Git-Integration in MantisBT - nullpointer.at at 2:03 pm on November 8, 2011

  37. Hello, I tried to launch this command:

    curl http://localhost:82/mantisbt/plugin.php?page=Source/repo_import_latest&id=30

    But i got this error:

    APPLICATION ERROR #2800
    Invalid form security token.

    What is the problem?

    Thanks in advance.

    Bye.

    Alessio

    Comment by Alessio at 10:03 am on January 11, 2012

  38. Chris,

    I have my svn/mantis/websvn installed within a ispconfig 3 setup. for the URLs and paths, do I use local path names? or the .com server that its installed on?

    Thanks in advance.

    Comment by mike at 5:22 pm on February 5, 2012

  39. [...] http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/ [...]

    Pingback by Mantis Literaturliste Part 2 | GAMEDEVELOPERS COMMUNITY at 1:09 pm on June 16, 2012

  40. [...] http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/ [...]

    Pingback by GAMEDEVPORTAL | Rund um den Mantis Bugtracker….. at 8:06 am on June 22, 2012

  41. [...] Subversion (SVN) Repository Integration with Mantis Bug Tracker | U-notez [...]

    Pingback by Diigo Diary 07/25/2012 « Benx Blog at 8:31 pm on July 24, 2012

  42. Hi, i’m trying to integrate Mantis and svn on Windows. I realized that I’ve to create a .bat file that can replace the post-commit file.
    Someone could solve that???
    Thanks so much

    Comment by Cecilia at 6:41 pm on August 25, 2012

  43. It’s going to be finish of mine day, however before end I am reading this impressive paragraph to increase my knowledge.

    Comment by hurtig lån at 5:07 am on January 5, 2013

  44. […] http://www.unitz.com/u-notez/2009/10/subversion-svn-integration-mantisbt/ […]

    Pingback by Mantis Bugtracker Literaturliste | at 5:32 pm on November 11, 2013

  45. Can you write an updated article please.

    Things have changed a lot & I’m using Windows.

    An article to integrate mantis with websvn on windows would be of great help, since all present on googling are outdated.

    Comment by Nitin Surana at 9:46 am on December 5, 2013

  46. On windows the SVN plugin crashes (Source Integration 0.18 and Subversion Integration 0.17)

    After painstakinly debugging:
    * I’ve added command arguments “–config-dir C:\Users\Administrator\AppData\Roaming\Subversion\config” to bypass errors i’ve gotten with shell_exec on the SVN path.

    * In my repository the svn:// link is validated to work
    * Changesets are created but they fail with “APPLICATION ERROR #0″

    How can I debug what is going wrong ?

    Comment by Tim at 11:48 am on April 11, 2014

Leave a comment

TrackBack URI

Unitz LLC, 850 North Randolph St., Suite 103 - A38, Arlington, VA  22203 * Tel. 703-539-2542 Email us