FogBugz 7 Online Help

Setting up Perforce (VBScript)

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

Make sure to start your integration by setting up the Perforce repository in FogBugz according to these instructions

Getting Perforce to transmit changes to FogBugz

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

Download and customize the trigger VBScript.

  1. Follow these instructions to setup the Perforce repository in FogBugz. Download the logBugDataP4.vbs script.
  2. Put it in the directory that contains your Perforce server executable (for example, c:\Program Files\Perforce).
  3. 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 0.

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.vbs file every time any files are submitted in Perforce. To do this, do the following:

  1. Type p4 triggers on the command line (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 //... "cscript.exe C:\path\to\your\logBugDataP4.vbs %changelist% %serverport% %client%"

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

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

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

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

Note that this new line has a tab at the beginning. Adjust the path to the logBugDataP4.vbs file to make sure it points to logBugDataP4.vbs 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, follow these instructions to point FogBugz at your P4Web server for diff and log links.