Version control comparison with UltraCompare

UltraCompare's command line options allow you to integrate it with other applications and systems. If you're using version control in a team development environment, then you can use UltraCompare as your version control system's compare tool to quickly diff files, resolve conflicts, merge, and more.

While most version control systems provide integration with an external diff tool, each version control system has a unique way of building the command line. Some are simple (e.g., simply sending the two file names) while others are more difficult.

As a base, we have tested UltraCompare with the following version control systems:

Basic command line rules

The command line support is the key component to the version control support. While the command line support is very flexible, there are some rules you must observe when building your command line strings:

  1. All parameters must be separated by a space.
  2. Compare type switches such as -t, -3, -p, -x, -d, and -w must always precede the related compare object (ie: the paths for the files/folders being compared).

    Correct: -t <filename1> <filename2> -b -lt -o <outputfile>
    Incorrect: -t -o -b <filename1> -lt <filename2> <outputfile>

  3. Logical units can appear in any order on the command line so long as they are paired with their related parameters.

    Correct: -title1 <titlename1> -title2 <titlename2> -t <filename1> <filename2>
    Correct: -title1 <titlename1> -t <filename1> <filename2> -title2 <titlename2>
    Correct: -t <filename1> <filename2> -title2 <titlename2> -title1 <titlename1>
    Incorrect: -t <filename1> -title2 <titlename2> <filename2> -title1 <titlename1>

Back to top

Command line parameters

The following command line parameters may be used to invoke UltraCompare Professional from the command line. For a full list of the command line parameters, see the UltraCompare Help.

Parameter Description
-3 3-way text mode
-a sets Show All
-B ignore blank lines in text compare mode
-b ignore spaces in text compare mode
-d folder compare mode
-dmb sets Folder Compare type to Basic
-dmf sets Folder Compare type to Full
-dms sets Folder Compare type to Smart
-fb force all files to be compared as binary in folder compare mode
-ft force all files to be compared as text in folder compare mode
-horz sets view to horizontal layout
-i ignore case in text compare mode
-lt enables ignore line terminators
-m shows matching lines / items only
-mc shows matching columns only (table / Excel mode)
-mr shows matching rows only (table / Excel mode)
-ne shows different lines / items only
-nec shows different columns only (table / Excel mode)
-ner shows different rows only (table / Excel mode)
-o creates output file
-op appends output to specified file
-p fast binary compare mode
-prf runs specified profile
-qc quick difference check – performs a byte by byte check until the first difference is detected and then returns "Same" or "Different" on command line
-r compare folders recursively in folder compare mode
-rio reset ignore options
-rom read only merge mode
-t text compare mode
-tb table / Excel compare mode
-title1 sets alias/title name for file/folder in first pane
-title2 sets alias/title name for file/folder in second pane
-title3 sets alias/title name for file/folder in third pane
-vert sets view to vertical layout
-w 3-way folder compare mode
-x smart binary compare mode

Back to top

AnkhSVN with Visual Studio

AnkhSVN with Visual Studio

  1. Open Visual Studio.
  2. Select Options from the Tools menu.
  3. Select Source Control and click on Plug-In Selection.
  4. Under Plug-In Selection select AnkhSVN.
  5. Under Subversion User Tools enter the following into the External Diff field:

    "C:\Program Files\IDM Computer Solutions\UltraCompare\uc.exe" "%base" "%mine%"

Back to top

Perforce for Windows

Perforce for Windows

  1. Select Preferences from the Edit menu.
  2. Go to the Diff tab.
  3. Under Default Diff Application select Other Application.
  4. Click the browse button next to the Location box and browse to the UltraCompare install directory. Select uc.exe.
  5. In the Arguments field, enter:

    %1 %2

Back to top

Subversion

Subversion

  1. Create a batch file named "ucsvndiff.bat" in the UltraCompare install directory.
  2. Open ucsvndiff.bat for editing and enter the following:

    %ECHO OFF
    "C:\Program Files\IDM Computer Solutions\UltraCompare\uc.exe" "%6" "%7" -title1 %3 -title2 %5


  3. Go to Subversion's configuration area, normally

    C:\Users\<username>\AppData\Roaming\Subversion
    - or -
    C:\Users\<username>\Application Data\Subversion

    (One way to find this folder is to enter %APPDATA% in the address bar and then look for the "Subversion" folder.)

  4. Change the following lines in the "config" file in the "Subversion" folder:

    #[helpers]
    #diff-cmd=diff_program(diff, gdiff, etc.)


    to:

    [helpers]
    diff-cmd=diff_program(diff, gdiff, etc.)


  5. Edit the diff-cmd to point to the ucsvndiff.bat file, e.g.:

    diff-cmd=C:\Program File\IDM Computer Solutions\UltraCompare\ucsvndiff.bat

Note: One of our users provided the following solution to integrate UltraCompare with Cygwin Subversion.

Create a file named ucsvndiff.sh or something similar and put the following into it:

#!/bin/sh

# Edit $HOME/.subversion/config
### Set diff-cmd to the absolute path of your 'diff' program.
### This will override the compile-time default, which is to use
### Subversion's internal diff implementation.
#diff-cmd = /home/rob_000/bin/ucsvndiff.sh

# Uses the format -u -L <revision> -L "(working copy)" <revision file> <working copy file>
# The files are in linux format, so cygpath -w is required

/cygdrive/c/Program\ Files/IDM\ Computer\ Solutions/UltraCompare/uc `cygpath.exe -w $6` `cygpath.exe -w $7` -title1 "$3" -title2 "$5"

Back to top

TortoiseCVS

TortoiseCVS

  1. From context menu in Windows Explorer select CVS and then Preferences.
  2. Select Tools tab.
  3. For Diff application, browse to UltraCompare install directory and select uc.exe.
  4. For Two-way diff parameters enter the following:

    "%1" "%2"

Please note: A space must be inserted between the specified values.

Back to top

TortoiseSVN

TortoiseSVN

  1. From context menu in Windows Explorer select TortoiseSVN and then Settings.
  2. Go to Diff Viewer under External Programs.
  3. Under "Configure the program used for comparing different revisions of files" select External.
  4. Click browse button and browse to UltraCompare install directory. Select uc.exe and press OK.
  5. Add the following string to the end of the uc.exe path:

    %base %mine -title1 %bname -title2 %yname

  6. The constructed string should now look like this:

    C:\Program Files\IDM Computer Solutions\UltraCompare\uc.exe %base %mine -title1 %bname -title2 %yname

  7. Press Apply button.

Back to top

Visual SourceSafe 2005

Visual SourceSafe 2005 (installed from Visual Studio DVD)

  1. Select Options from Tools menu.
  2. Select Custom Editors tab.
  3. Select File Difference under Operation:.
  4. In the File Extension field, enter: ".*"
  5. In the Command Line field, enter:

    C:\Program Files\IDM Computer Solutions\UltraCompare\uc.exe %1 %2

  6. Press Add button.

Back to top