FogBugz 6.0 Online Help

Setting up Perforce (Perl)

There are two steps in setting up FogBugz-Perforce integration:

  1. Installing either trigger scripts or the Perforce Defect Tracking Gateway so that Perforce transmits changes to FogBugz
  2. Getting FogBugz to provide links to P4Web, the Perforce web client

Getting Perforce to transmit changes to FogBugz

These instructions are for trigger scripts written in Perl. (See instructions for VBScript, or for setting up the DTG)

First you need to get the Perl script that will be used in the trigger:

  1. Log on to FogBugz as an administrator, and go to Settings | Site. In the Main tab, you will see a link to download scripts.
  2. Download the Perforce Perl script. You'll get a file named logBugDataP4.pl.safe.
  3. Rename the downloaded file logBugDataP4.pl.
  4. Put it in the directory that contains your Perforce server executable (for example, c:\Program Files\Perforce).
  5. Edit the file. Look for the variables $P4USERNAME and $P4PASSWORD and set them to the Perforce username and password you want to use.

Perforce passwords cannot be accessed from trigger scripts, so the good folks at Perforce will give you a free "background" or "automation" user for this purpose. Please contact them at support@perforce.com to pursue this option.

If you do NOT have Perforce passwords enabled, leave $P4PASSWORD blank.

  1. By default, the Perforce script sends changelists, not individual files (so you will see only one line in FogBugz for a changelist containing 40 files, instead of 40 lines).  If you want to change this, look for the variable $CHANGELIST_ONLY and set it to 1.

Perforce will let you call an executable every time files are submitted (actually, just before the submission occurs). This is called a trigger. We want to use a trigger to call the logBugDataP4.pl file every time any files are submitted in Perforce.  To do this, do the following:

  1. Type p4 triggers on the command line (or cmd window). A text file appears in your editor. (If it doesn't, make sure the full path to p4 is in your path.)
  2. To add the FogBugz trigger you need to add a line to at the bottom of this file.

The trigger looks slightly different depending on what version of Perforce you use:

Perforce Version 2003.2 - all triggers are of type "submit", no need to specify type:

FogBugzTrigger //... "C:\path\to\your\perl.exe C:\path\to\your\logBugDataP4.pl %changelist% %serverport% %client%"

Perforce Version 2004.2 - you must specify the type of trigger as "submit":

FogBugzTrigger submit //... "C:\path\to\your\perl.exe C:\path\to\your\logBugDataP4.pl %changelist% %serverport% %client%"

Perforce Version 2005.2 - you must specify the type of trigger as "change-submit":

FogBugzTrigger change-submit //... "C:\path\to\your\perl.exe C:\path\to\your\logBugDataP4.pl %changelist% %serverport% %client%"

Note that this new line has a tab at the beginning. Adjust the path to the perl interpreter, and the path to the logBugDataP4.pl file to make sure it points to logBugDataP4.pl on your server (wherever you put it).

IMPORTANT: The paths in the trigger cannot contain any spaces.  A path with spaces in it will generate an error like the following:

Input Error: There is no file extension in "C:\Program".

Click here for more information on setting paths without spaces.

  1. Save this temporary file and exit the editor. The trigger is now added.

    If you don't see the checkin entries in the FogBugz case, here is some troubleshooting help:

    Getting FogBugz to provide links to P4Web, the Perforce web client

    In order to browse a Perforce repository, you need something that allows you to view file diffs and history logs from a web browser. With Perforce, you use P4Web, the Perforce Web Client.

    Once that is installed and working with your Perforce repository, log onto FogBugz as an administrator and go to the Settings | Site screen, in the Main tab.

    If the trigger script is sending changelists instead of files (the default), enter the following:

    http://path to P4Web:8080/@md=d&cd=//&c=6fI@/^R2?ac=10
    http://path to P4Web:8080/@md=d&cd=//&c=6fI@/^R2?ac=10

    If you've modified the trigger script to send files instead of changelists, enter the following:

    http://path to P4Web:8080/@md=d&c=@^FILE?ac=22
    http://path to P4Web:8080/@md=d&cdf=^FILE&ra=s&dw=wu&c=@^FILE?ac=19&rev1=^R1&rev2=^R2