Integrating ExamDiff Pro with Version Control Systems

:: ExamDiff Pro :: Home

Using ExamDiff Pro as an External Diff Tool

ExamDiff Pro's command-line interface makes it easy to use it as a diff tool in version control applications. The syntax is

    ExamDiff.exe File1 File2 [Options]

and there are several options that may be helpful when using ExamDiff Pro in a version control context:

The /nh option prevents the compared files from being added to ExamDiff Pro's history, which is handy because, since you're comparing temporary files, it wouldn't make sense to remember them. You can read more about this option here.

The /dn1:name and /dn2:name set the display names of the files being compared. They can be helpful if you don't want to see ugly temp file paths and your version control program sends file labels as parameters.

The /sn1:name and /sn2:name specify the file names used when saving each file. These options are useful if you want to use ExamDiff Pro as an external merge tool.

Below you'll find examples of how to integrate ExamDiff Pro into some popular version control applications. Is your version control tool of choice not listed? Let us know and we can put up a tutorial for it.

Note: '-' options can always be used instead of '/' options listed below, which can be helpful if Unix style file paths are passed.

Using ExamDiff Pro as an External Merge Tool

Starting with version 6.0, ExamDiff Pro's three-way diff and merge functionality allows it to be used as a merge tool in version control applications. The syntax is

    ExamDiff.exe /merge LeftFile CenterFile RightFile [/o:OutputFile] [Options]

with several options that are helpful in a merge context:

The /nh option, as usual, prevents the compared files from being added to ExamDiff Pro's history, which is handy because, since you're comparing temporary files, it wouldn't make sense to remember them. You can read more about this option here.

The /dn1:name, /dn2:name, /dn3:name, and /dno:name set the display names of the left ("theirs"), center ("base"), right ("yours"), and output files, respectively. They can be helpful if you don't want to see ugly temp file paths and your version control program sends file labels as parameters.

Some of the examples below include instructions on how to use ExamDiff Pro as an external merge tool. Let us know if you would like us to put up a tutorial for your version control tool of choice.

Using Version-Control Commands from ExamDiff Pro

Sometimes you may want to perform version control operations on files or directories that you are comparing in ExamDiff Pro. For instance, you may be editing a file that hasn't been checked out yet and wish to check it out before saving it, or you may be copying files from an external drive and wish to check out the destination files before copying.

Many version control systems (such as ClearCase, TFS, etc) can integrate with the Windows shell, and you can access Windows Explorer commands in ExamDiff Pro either by right-clicking on a file or directory and selecting Explorer Menu, or by holding down the Shift key as you right-click on a file or directory.

Integration Settings For Common Version Control Systems

Visual Studio/Team Foundation Server

Using ExamDiff Pro as an External Diff Tool

Go to Tools | Options | Source Control | Visual Studio Team Foundation Server, then click Configure User Tools and then Add. Enter the following:

Extension: *
Operation: Compare
Command: <Path to ExamDiff.exe>
Arguments: %1 %2 /dn1:%6 /dn2:%7 /nh

Using ExamDiff Pro as an External Merge Tool

Go to Tools | Options | Source Control | Visual Studio Team Foundation Server, then click Configure User Tools and then Add. Enter the following:

Extension: *
Operation: Merge
Command: <Path to ExamDiff.exe>
Arguments: /merge %1 %3 %2 /o:%4 /dn1:%6 /dn2:%8 /dn3:%7 /dno:%9 /nh

Visual Studio/Git

Using ExamDiff Pro as an External Diff and Merge Tool

Edit your "~/.gitconfig" file to include the following (your path may vary):


[diff]
    tool = edp
[difftool "edp"]
    cmd = \"C:\\Program Files\\ExamDiff Pro\\ExamDiff.exe\" \"$LOCAL\" \"$REMOTE\" -nh
[merge]
    tool = edp
[mergetool "edp"]
    cmd = \"C:\\Program Files\\ExamDiff Pro\\ExamDiff.exe\" -merge \"$REMOTE\" \"$BASE\" \"$LOCAL\" -o:\"$MERGED\" -nh

ClearCase

Using ExamDiff Pro as an External Diff and Merge Tool

Open the C:\Program Files\Rational\ClearCase\lib\mgrs\map file (your path may differ) and edit the following lines to point to ExamDiff.exe:

    text_file_delta xcompare <Path to ExamDiff.exe>
    _html xcompare <Path to ExamDiff.exe>
    _xml xcompare <Path to ExamDiff.exe>

Using ExamDiff Pro as an External Merge Tool

In the same file, change the following lines to point to ExamDiff.exe:

    text_file_delta xmerge <Path to ExamDiff.exe>
    _html xmerge <Path to ExamDiff.exe>
    _xml xmerge <Path to ExamDiff.exe>

Git/SourceTree

Using ExamDiff Pro as an External Diff Tool

UPDATE: Starting with Git 2.9 (Jun 10, 2016) ExamDiff Pro is an officially supported git mergetool, which means that you can just use the following command:
    git config --global merge.tool examdiff

In your Git command window, enter the following commands:

    git config --global diff.tool edp
    git config --global diff.guitool edp
    git config --global difftool.edp.cmd "\"<Path to ExamDiff.exe>\" \"\$REMOTE\" \"\$LOCAL\" //nh"
    git config --global difftool.prompt false

<Path to ExamDiff.exe> should replaced by the full path to the ExamDiff.exe file, with each backslash ('\') replaced by a forward slash ('/').

Note: Every double quote ('"') and dollar sign ('$') in these command lines, inside the surrounding quotes, must be escaped with a preceding backslash. (It looks a bit convoluted like that, but it's needed to make it be correctly interpreted by the git command line.) If the commands don't work, replace the '/' character used for command line options with '-', e.g. use -nh instead of //nh

Example:

    git config --global difftool.edp.cmd "\"C:/Program Files/ExamDiff Pro/ExamDiff.exe\" \"\$REMOTE\" \"\$LOCAL\" //nh"

Using ExamDiff Pro as an External Merge Tool

In your Git command window, enter the following commands:

    git config --global merge.tool edp
    git config --global mergetool.edp.cmd "\"<Path to ExamDiff.exe>\" //merge \"\$REMOTE\" \"\$BASE\" \"\$LOCAL\" //o:\"\$MERGED\" //dn1:\"Theirs\" //dn2:\"Base\" //dn3:\"Yours\" //dno:\"Output\" //nh"
    git config --global merge.prompt false
    git config --global merge.keepBackup false
    git config --global merge.trustExitCode false

Git/WSL

Using ExamDiff Pro as an External Diff Tool

Edit your "~/.gitconfig" file to include the following (your path may vary):

[diff]
    tool = examdiff
[diff "tool"]
    prompt = false
[diff "tool.examdiff"]
    trustExitCode = true
    cmd = '/C/Program Files/ExamDiff Pro/ExamDiff.exe'
    prompt = false

You can also use a batch file like this

    #!bash
    #diff current branch to (local) develop
    git difftool --dir-diff develop &

to compare the current branch to the develop branch.

Mercurial

Using ExamDiff Pro as an External Diff Tool

Open the Mercurial configuration file at %USERPROFILE%\Mercurial.ini and add or edit the following lines:

    [tortoisehg]
    vdiff = edpd

    [extensions]
    extdiff =

    [extdiff]
    cmd.edp = <Path to ExamDiff.exe>
    opts.edpd = /nh

You can now launch comparisons with:

    hg edp

Using ExamDiff Pro as an External Merge Tool

Open the Mercurial configuration file at %USERPROFILE%\Mercurial.ini and add or edit the following lines:

    [ui]
    merge = edpm

    [merge-tools]
    edpm.args = /merge $other $base $local /o:$output /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Output" /nh
    edp.executable = <Path to ExamDiff.exe>
    edpm.gui = True

Perforce

Using ExamDiff Pro as an External Diff and Merge Tool

Instructions for P4

Add the environment variable:

    P4DIFF=<Path to ExamDiff.exe>
    P4MERGE=<Path to ExamDiff Pro Installation Folder>\EDProP4Merge.bat

Create EDProP4Merge.bat in the ExamDiff Pro installation folder with the following line:

    <Path to ExamDiff.exe> /merge %2 %1 %3 /o:%4 /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Merge Output" /nh

Instructions for P4V

Go to Edit | Preferences | Diff, change the Default diff application option to "Other application", and for Location enter the path to ExamDiff.exe. Then go to the Merge tab, change the Default merge application to "Other application", and for Location again enter the path to ExamDiff.exe. In the Arguments control, enter:

    /merge %1 %b %2 /o:%r /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Merge Output" /nh

Note: According to our users, Perforce Inc. confirmed that the construct "/o:%r" does not work in (current versions of) P4V. A workaround they suggest is to use an intermediate .bat file to launch ExamDiff.exe since specifying %r alone works fine in P4V.

Instructions for P4Win

Go to Settings | Options | Files | Diff. Select User supplied diff application and browse to ExamDiff.exe . Check Options args and enter:

    %1 %2 /dn1:"%L" /dn2:"%R" /nh

Then go to Settings | Options | Files | Merge. Select User supplied merge application and browse to ExamDiff.exe . Check Options args and enter:

    /merge %2 %1 %3 /o:%4 /dn1:"%T" /dn2:"Base" /dn3:"%Y" /dno:"Merge Output" /nh

StarTeam

Using ExamDiff Pro as an External Diff Tool

Go to Tools | Personal Options | Files. Click the Alternate Applications button if present. Check Comparison Utility. Enter the path to ExamDiff.exe, and for Options write:

    $file1 $file2 /nh

Using ExamDiff Pro as an External Merge Tool

Go to Tools | Personal Options | Files. Click the Alternate Applications button if present. Check Merge Utility. Enter the path to ExamDiff.exe, and for Options write:

    /merge $usertip $basefile $branchtip /o:$resultfile /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Merge Output" /nh

Subclipse

Using ExamDiff Pro as an External Merge Tool

In Eclipse, go to Window | Preferences | Team | SVN | Diff/Merge, then under Merge Program select External. Browse for ExamDiff.exe, and for Parameters write:

    /merge "${theirs}" "${base}" "${yours}" /o:"${merged}" /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Merge Output" /nh

Surround SCM

Using ExamDiff Pro as an External Diff Tool

Go to User Options | Diff/Merge. Add or edit an entry with the following settings and click OK.

File extensions: All other text files
Diff/Merge: Diff
Compare with: Selected application
Selected application: <Path to ExamDiff.exe> "%1" "%2" /nh

Using ExamDiff Pro as an External Merge Tool

Go to User Options | Diff/Merge. Add or edit an entry with the following settings and click OK.

File extensions: All other text files
Diff/Merge: Merge
Compare with: Selected application
Selected application: <Path to ExamDiff.exe> /merge "%1" "%3" "%2" /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Merge Output" /o:%4 /nh

TortoiseSVN

Using ExamDiff Pro as an External Diff Tool

Go to TortoiseSVN Settings | External Programs | Diff Viewer, select the External radio button, and enter the following into the Path field

    <Path to ExamDiff.exe> %base %mine /dn1:%bname /dn2:%yname /nh

Using ExamDiff Pro as an External Merge Tool

Go to TortoiseSVN Settings | External Programs | Merge Tool, select the External radio button, and enter the following into the Path field

    <Path to ExamDiff.exe> /merge %theirs %base %mine /o:%merged /dn1:%tname /dn2:%bname /dn3:%yname /dno:%mname /nh

Visual SourceSafe

Using ExamDiff Pro as an External Diff Tool

Go to Tools | Options | Custom Editors. Enter the following and click Add.

Operation: File Difference
Extension: .*
Command Line: <Path to ExamDiff.exe> %1 %2 /nh

Using ExamDiff Pro as an External Merge Tool

Go to Tools | Options | Custom Editors. Enter the following and click Add.

Operation: File Merge
Extension: .*
Command Line: <Path to ExamDiff.exe> /merge %1 %3 %2 /o:%4 /dn1:"Theirs" /dn2:"Base" /dn3:"Yours" /dno:"Merge Output" /nh