Using FogBugz On Demand? We've recently rolled out a new sidebar as part of taking FogBugz forward. Please see this article for details on what's new, what's changed, and where you can find all your favorite things.

This article is intended for users that are using a stand-alone Mercurial server. If you are already using Kiln or are interested in starting to use it, please check out the details of the built-in integration between FogBugz and Kiln.

Getting Mercurial to transmit changes to FogBugz

To setup Mercurial-FogBugz integration, start by logging into FogBugz as an administrator and going to Admin | Source Control. Click Create New Repository. In the resulting dialog, select Mercurial as the type and click Next.

In the resulting dialog, download the Python script and place it on your Mercurial server. It can go anywhere that’s visible to the Mercurial server process, but do not put it in your hgext directory.

To enable the script, edit the .hg/hgrc file in your repository by adding the following lines (you may need to create this file):

[hooks]
changegroup = python:/path/to/fogbugz.py:hook

You will then need to configure the FogBugz extension so that it knows where to locate your FogBugz install. Simply add the following lines, edited appropriately, into your .hg/hgrc file:

[fogbugz]
host=http://full/path/to/fogbugz

Finally, you should set your baseurl to make sure that the appropriate repository location is passed along to FogBugz. Baseurl is the web URL to where the “hg serve” web server is running for the provided repository.

[web]
baseurl=http://url/of/your/repo

Getting FogBugz to Provide Hyperlinks to Mercurial

Assuming you supplied the right value for baseurl in your hgrc file, FogBugz will automatically link to logs and diffs in Mercurial. If you do not have hg serve running, then although FogBugz will record changesets, the links back from FogBugz will not point anywhere meaningful.

Entering Case Numbers in Mercurial Commits

When you commit a change using Mercurial, include a single line of the form BugzID: 1234 in the log after the other comments (where 1234 is the case number you want to link).