There are two aspects to setting up FogBugz-Subversion integration:
- Getting Subversion to transmit changes to FogBugz
- Getting FogBugz to provide links to WebSVN (Diff/Log links), the web-based Subversion repository browser
Setting up the repository in FogBugz
The starting point for setting up source control integration is to create the repository in FogBugz. To do so, log into FogBugz as an administrator and go to Admin -> Source Control. Click Create New Repository. In the resulting dialog, select Subversion as the type and give the repository a display name. Click Next.
The resulting dialog contains scripts and instructions for getting Subversion to transmit changes to FogBugz. Those instructions are provided in more detail below. Select the appropriate tab for the server Subversion runs on and download the scripts. Before you close the dialog, choose whether you want FogBugz to provide links to your check-ins. You can change this setting later by clicking the Edit icon next to the repository on the Admin -> Source Control page.
Diff and log links
To have FogBugz link to checked-in files directly from cases, you need something that allows you to view file diffs and history logs from a web browser. We recommend WebSVN. You can also setup FogBugz to link to logs and diffs in Trac. Once you have WebSVN or Trac installed and working with your Subversion repository, set the path to it in the New Repository dialog and click OK to complete the setup.
Getting Subversion to transmit changes to FogBugz
If your Subversion server is Linux or Unix, make sure that Perl is installed.
If your Subversion server is Windows, make sure it has Windows Scripting version 5.6 or later installed.
Put the logBugDataSVN and post-commit scripts you downloaded above into Hooks directory in your Subversion repository. If your SVN repository is on Unix, grant executes permissions on both files (chmod +x filename). If you already have a post-commit script, you will need to merge it with this one.
Entering Case Numbers in Subversion Commits
When you commit a change using Subversion, include a single line of the form BugzID: case number in the log after the other comments, for example:
You can also reference multiple case numbers by separating them with commas: BugzID: 49, 50
Setting up Integration with TortoiseSVN
If anyone on your team uses TortoiseSVN, a Subversion client for Windows, follow the steps below to configure it to prompt for case numbers when you enter log messages:
- Check out your repository
- cd to the root directory of your checkout
- Run the following commands from the command line. Notice the important dots.
svn propset bugtraq:label "BugzID:" . svn propset bugtraq:url "http://Your FogBugz URL/default.asp?%BUGID%" . svn propset bugtraq:message "BugzID: %BUGID%" . svn propset bugtraq:number "true" . svn propset bugtraq:warnifnoissue "false" . svn commit -q -m "Added BugzID properties to the repository"
Note: if you would prefer to run these commands from a batch file, you need to escape the % signs by doubling them to prevent the batch file from replacing them with nothing. (e.g. %%BUGID%%).
Tortoise will search up your folder path on a checkout looking for this property, so if you check out from other folders in your tree, be sure to do the same procedure for those folders also. We used to ask people to execute the above commands with the -R flag to do this recursively, but it has been reported that this can slow down Subversion. More details are available in this guide about Integrating Issue Trackers with TortoiseSVN.
Entering Case Numbers in TortoiseSVN Commits
When you commit a change to a Subversion repository using Tortoise-SVN, type in the case number in the BugzID edit box at the top right corner of the Enter Log Message dialog:
Troubleshooting SVN Integration
Read our SVN Troubleshooting instructions.