FogBugz and TortoiseSVN: Integration Bliss

Fog Creek Software has been using Subversion as our source control system for a few years now.  We switched a while back from using CVS and have nothing but praise for Subversion.  Anyone currently using CVS should bite the bullet and make the switch.  It just works.  The price is right, and best of all it integrates tightly with FogBugz.  We support a whole host of Source Control Systems, and adding new ones is very simple, but if you are starting out -- our recommendation is to start with Subversion

Once you get Subversion set up and running, if you are on Windows, you will be amazed at how useful a good Subversion client can be.  Steve King has created a fantastic piece of software, the TortoiseSVN client, and he has spent some time making sure that it works perfectly with FogBugz.  It uses a set of properties on the Subversion repository which tell it how to treat commit messages to pull out bug information. 

Rather than trying to explain the cryptic setup, I'll just give you the commands for getting this running ASAP from the command line.  If you have problems with the command lines, right click on the folder, switch to the Subversion tab and set the properties via the Windows interface.

  1. Check out your repository
  2. cd to the root directory of your checkout
  3. Run the following commands from the command line.
    You have to run them from the command line because a batch file will replace %BUGID% with nothing (substituting nothing for what it thinks is the variable BUGID).  Note the . at the end of these commands is not a period, but should be entered as a space . after the double quotes, indicating the current directory.
    svn propset -R bugtraq:label "BugzID:" .
    svn propset -R bugtraq:url "
    http://your.fogbugz.url/default.asp?%BUGID%" .
    svn propset -R bugtraq:message "BugzID: %BUGID%" .
    svn propset -R bugtraq:number "true" .
    svn propset -R bugtraq:warnifnoissue "false" .
    svn commit -q -m "Added BugzID properties to the repository"
  4. Verify when you are finished that the bugtraq:message is BugzID: %BUGID% and not just BugzID:
  5. If you are smarter than me, than check out this guide which explains all the above mumbo jumbo.

You will need to continue with the Subversion Source Control integration steps listed here (install WebSVN and make sure bugtraq is turned on in the config.inc file once it is installed).

Now when you go to check in a file using Tortoise, it will give you a window where you can enter the bug number:

On the command line you could just enter the log message as

BugzID:181468
This is NOT how you spell Joel's name.  Splotsky.

(I'll open another bug on the fact that I left the word 'spell' out of the screenshot')

But it's nice to have the GUI client show the bug number in its own window.

And in FogBugz, you can view the checkin.  Click on the filename to see the contents of the file.  Click on the revision name to see the diffs for that file to the previous revision.

And the reverse direction link from WebSVN back to FogBugz - the bug number is now a link to the case in FogBugz.

And even cooler, when you view the log history in TortoiseSVN, the bug number is a link too:

And the circle completes.  From source control to FogBugz and back again.

If you aren't using Subversion, you should be (especially if you've ever read KB 133054)  And if you are using Subversion, you should definitely download TortoiseSVN.  With FogBugz, Subversion and TortoiseSVN, all the info you ever need will be at your fingertips.