There are two main steps to setting up integration between FogBugz and Mercurial.
To get the fogbugz.py file, go to the Extras menu in FogBugz and select Configure Source Control Integration. Select the Download link for the Mercurial Python script and save the file to your Mercurial hgext directory.
To enable the script, edit the .hg/hgrc file in your repository by adding the following lines:
[extensions]
hgext.fogbugz=
[hooks]
incoming=python:hgext.fogbugz.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
script=cvsSubmit.asp (if *FogBugz* is hosted on Windows) OR
cvsSubmit.php (if *FogBugz* is hosted on Unix)
Finally, you should set your baseurl to make sure that the appropriate repository location is passed along to FogBugz.
[web]
baseurl=http://url/of/your/repo
Log onto FogBugz as an administrator and on the Settings | Site screen, go to the Main tab.
Under Source Control URL for logs, enter:
^REPO/log/^R2/^FILE
Under Source Control URL for diffs, enter:
^REPO/diff/^R2/^FILE
In these URLs, ^REPO is replaced by the repository URL you provided in fogbugz.py, ^R2 is the revision number, and ^FILE will be replaced with a file name for which FogBugz wants to display the history.