Perforce Merge Integration

Perforce calls third-party merge tools with four filename parameters. Perforce refers to these files as: "base", "theirs", "yours", and "merge". And, these filenames are passed in that order. In Guiffy terms the "base" file is the parent file, the "theirs" file is the 1st file, the "yours" file is the 2nd file, and the "merge" file is the result file. Guiffy's order for these file name parameters is different(1st, 2nd, parent, result). And, Guiffy command line options are required to specify a 3-way merge and (optionally) set the file name header prefixes to Perforce's terminology.

To integrate Guiffy with Perforce make a script file for your platform, lets call it "p4guiffy.bat".

On Windows with P4Win
The following will select Guiffy's 3-way SureMerge option and reorder the filename parameters:
guiffy -s %2 %3 %1 %4

The following also sets the file name header prefixes:
guiffy -s -p1theirs -p2yours -pmmerge %2 %3 %1 %4

NOTE: If you don't add the guiffy folder to your command PATH, you will need to enclose the full path in double quotes. For example:
"C:\Program Files\guiffy115\guiffy.exe" -s -p1theirs -p2yours -pmmerge %2 %3 %1 %4

To use the .bat file with p4win, Settings > Options > Files > Merge and give the full pathname of the .bat file (use Browse button to pick).

On Windows with P4V
If you're using the new p4v client, each of the filename parameters in the .bat file need to be enclosed in double, double quotes. Here's an example of the .bat file:
guiffy -s -p1theirs -p2yours -pmmerge ""%2"" ""%3"" ""%1"" ""%4""

NOTE: If you don't add the guiffy folder to your command PATH, you will need to enclose the full path in double quotes. For example:
"C:\Program Files\guiffy115\guiffy.exe" -s -p1theirs -p2yours -pmmerge ""%2"" ""%3"" ""%1"" ""%4""

Use the short form of the path to the bat script file when specifying the application in the Perforce P4V client (Tools > Preferences and "Use external application:"). For example:
C:/Progra~1/guiffy115/p4guiffy.bat

On Unix (with P4V)
The above scripts are .bat files for Windows. A p4guiffy.sh script for Unix or Linux systems would look like:
#!/bin/sh
guiffy -s $2 $3 $1 $4


After building your script and setting your command PATH to include the Guiffy folder --- test your script. Then, in Perforce under Tools->Preferences... set the "Use external application:" field to the full path of your script file - something like:
/home/billri/guiffy115/p4guiffy.sh

Documentation by Guiffy Software, Inc. 2016