Sourcegear Diffmerge: User Manual, Version 4.2
Sourcegear Diffmerge: User Manual, Version 4.2
____________________________
This copy of DiffMerge is licensed to you under the terms listed in the License Agreement at the end of this document.
iii
SourceGear DiffMerge
iv
SourceGear DiffMerge
v
Contact Information
Mailing Address
SourceGear LLC
115 North Neil Street, Suite 408
Champaign, IL 61820
USA
Sales
Web: https://store.sourcegear.com/sgstore/
Email: [email protected] [mailto:[email protected]]
Phone: 1-217-356-0105 x399 (weekdays 9am to 4pm Central United States time)
FAX: 1-217-356-0135
Support
Web: http://support.sourcegear.com/
Email: [email protected] [mailto:[email protected]]
Phone: 1-217-356-0105 x700 (weekdays 9am to 4pm Central United States time)
vi
Chapter 1. Introduction
DiffMerge is an application to visually compare and merge files and folders on Windows, OS X, and Linux.
• Diff: Graphically shows the changes between two files. Includes intra-line highlighting and full support
for editing.
• Merge: Graphically shows the changes between 3 files. Allows automatic merging (when safe to do
so) and full control over editing the resulting file.
• Folder Diff: Performs a side-by-side comparison of 2 folders, showing which files are only present in
one file or the other, as well as file pairs which are identical, equivalent or different.
• Windows Explorer/Shell Integration: Right-click on any two files or folders in Windows Explorer
to diff them immediately.
• Configurable: Rulesets and options provide for customized appearance and behavior.
• International: DiffMerge is a UNICODE-based application and can import files in a wide range of
character encodings.
1
Introduction
2
Introduction
3
Chapter 2. Installation
Windows
System Requirements:
Packaging Choices:
DiffMerge is distributed on Windows as a standard Microsoft Installer (MSI) package and as a ZIP archive.
There are now separate versions of these packages for 32-bit and 64-bit systems.
The 64-bit package includes both the 64- and 32-bit versions of the Windows Explorer Shell Extension so
it should work with both Windows Explorer (64-bit) and various third-party shell replacements (usually
32-bit).
The 32-bit MSI package can only be installed on a 32-bit version of Windows. The 64-bit MSI package
can only be installed on a 64-bit version of Windows.
The preferred method of installing DiffMerge is to use the MSI package. To do so, simply click on the
file and follow the on-screen instructions.
This will install the application in Program Files, install the Windows Explorer/Shell Integration
Extension, create menu items in the Start Menu, and create a Desktop Shortcut.
To uninstall DiffMerge either click the MSI file again or use the Add/Remove Programs (aka Programs
and Features) Control Panel and follow the on-screen instructions.
If for some reason you cannot use the MSI package or simply prefer to use the ZIP file, you may simply
unzip the ZIP file somewhere on your system. sgdm.exe and the related files will all be in this directory.
Use the 32-bit ZIP archive on 32-bit versions of Windows. You can use the 32-bit or 64-bit ZIP archive
on 64-bit versions of Windows.
Macintosh
System Requirements:
Packaging Choices:
On OSX DiffMerge is distributed in both DMG and PKG format packages. The PKG format will
automatically handle all of the installation details whereas the DMG format will allow you to manually
install the pieces as you wish.
4
Installation
In both packages, DiffMerge is built as a Universal binary having both Intel i386 (32-bit) and Intel x86_64
(64-bit) executables and are targeted to 10.6 and newer. OS X will automatically choose the best version
for your system at runtime.
To install DiffMerge using the PKG version, simply click on it. It will install the DiffMerge application
bundle in /Applications. It will also the command line tool (in /usr/bin/diffmerge) and a
diffmerge(1) man-page (in /usr/share/man).
After downloading the most recent DMG file, click to let OS X open it. Inside you will find the
DiffMerge Application bundle. This application bundle is completely self-contained. Simply drag it to
your /Applications folder. A short-cut to your /Applications folder is provided inside the DMG next to the
DiffMerge Application bundle.
Extras: Also included on the DMG is an Extras folder containing things you may find useful. These are
for your convenience; DiffMerge uses copies that are inside the DiffMerge Application bundle.
A sample shell script is also provided to make it easier to use DiffMerge from the command line. You
will need to edit it to set the pathname to the DiffMerge Application bundle if you installed it to a location
other than /Applications.
• Ubuntu: Intel 32- or 64-bit CPU running Ubuntu 12.04 LTS "Precise Pangolin" or newer.
• Mint: Intel 32- or 64-bit CPU running Mint 14 "Nadia" or newer. It has been tested on Mint 14, but it
should also work with Mint 13 "Lisa" since it is based on Ubuntu 12.04 LTS.
Packaging Choices:
On Ubuntu and Mint Linux, DiffMerge is distributed as a standard debian DEB package. Both 32- and
64-bit Intel versions are now available.
After downloading the most recent DEB file, install DiffMerge using the following command:
5
Installation
This completely installs DiffMerge; this includes an executable in /usr/bin/diffmerge, a man page,
and a menu item in the Ubuntu Application | Programming menu.
You can enable your system to pull from the SourceGear Apt Repository by adding the repository to the
Apt databases and then letting apt-get install DiffMerge.
The repository currently only contains stable releases based upon Ubuntu LTS releases; unstable
or nightly releases are not currently published on the repository.
Where UBUNTU_CODENAME is the codename of currently installed version of Ubuntu, for example
"precise" or "quantal". To get the name of your installed Ubuntu release, use the command
lsb_release -c
For Mint systems, UBUNTU_CODENAME should be set to the codename of the version of Ubuntu that
the currently installed Mint release was based upon, for example for Mint 14 "Nadia" is based upon
"quantal".
• Second, add SourceGear's PGP key to APT. Packages in the SourceGear Apt Repository are
cryptographically signed using a PGP key to ensure their integrity. In order to verify the package
contents, you will need to add the SourceGear public key to Apt.
• Third, after adding a new Apt Repository and installing a new PGP key, you will need to run the
following command to update the Apt databases:
Fedora Linux
System Requirements:
6
Installation
Packaging Choices:
On Fedora Linux, DiffMerge is distributed as a standard RPM package. Both 32- and 64-bit Intel versions
are now available.
After downloading the most recent RPM file, install DiffMerge using the following command:
This completely installs DiffMerge; this includes an executable in /usr/bin/diffmerge a man page,
and a menu item in the Fedora Application | Programming menu.
7
Chapter 3. Registration
Overview
SourceGear DiffMerge has been the leading diff and merge tool for professional developers since 2007.
SourceGear DiffMerge is licensed for use free of charge. However, to help fund new feature development
and ongoing product maintenance, SourceGear asks DiffMerge users to register the product for a small
fee and receive a registration key. Registration keys do not expire and can be used on every computer a
user has. Registered users have access to all product updates and support, and no longer see the Register
Dialog when DiffMerge is launched.
To open the Registration Dialog, select Tools | Registration... from the main DiffMerge menu. If you
have already have a registration key it will be displayed in the dialog and 'valid' will be enabled. If you do
not have a key or enter an invalid key, 'valid' will appear gray.
When you register DiffMerge, you will receive an email containining your registration key. Copy the
registration key from the email and paste it into the Registration Dialog and then press OK to correctly
configure your registration key in DiffMerge.
To remove your registration from this installation of DiffMerge, simply erase the contents of the
Registration Key field in the Registration Dialog and press OK.
If you have not registered and configured your registration key, DiffMerge will occasionally prompt you
with the Register Dialog. You can also force the dialog to appear by selecting Tools | Register... from
the main menu.
The Register Dialog contains instructions for registering DiffMerge and obtaining a registration key and
will also display any promotional materials and product offers.
8
Chapter 4. File Diff/Merge Windows
File Window Types
There are two types of file windows – File Diff Windows and File Merge Windows.
9
File Diff/Merge Windows
If a Swap button is provided, it will swap the left and right pathnames. Keep in mind that only the right/
bottom file will be editable.
You can open a File Merge Window by selecting File | Open Merge Window from the menu. This raises
the Select Files to Merge Dialog:
Note: in both cases, if the set of files selected are already open in an existing window, that window will
be raised rather than creating a new, duplicate window.
10
File Diff/Merge Windows
File Panels
In the center of File Diff and Merge Windows DiffMerge displays 2 or 3 files in a series of File Panels.
Each panel looks like a basic text editor window with a few differences.
• A Panel Label is drawn above the panel. This may contain the pathname of the file or a symbolic name
describing the version of the file.
• Line Numbers are optionally displayed next to each line of the file.
• Invisible characters such as whitespace and line terminators are optionally displayed using special
symbols.
• An Edited Line Indicator (*) is drawn in the line number area for edited lines.
• A Void is drawn using a shaded, diagonal hatch pattern to indicate missing lines. This is shown in
Showing Changes.
• A Gap is drawn to indicate hidden lines. This is illustrated in the Display Mode and Hiding Omitted
Lines [19].
11
File Diff/Merge Windows
• Colored lines/blocks are drawn to indicate changes in the files; the coloring and the
shape blocks reflect the color and shape of the actual changes.
• Black bars are drawn on the sides of the glance bar to show the current scroll position
of the files.
• As the mouse moves over the Glance Bar, the corresponding line numbers from the
files are shown in the Status Bar. A star * is used when the corresponding line is
a Void.
• You may click on the glance bar to scroll the file panels to that position.
The Reference View is a static view of the changes in the files as originally read from disk. In this view
the files are considered read-only. You may scroll around and view the differences and you may copy
things to the clipboard -- but you cannot modify the files.
This mode can be useful in various situations, such as when you want to see the changes between two
historical versions of a file.
The Edit View is an interactive editor and live difference viewer. It enables you to make changes to the
center panel in a File Merge Window and the right panel in a File Diff Window. As you edit, your changes
are highlighted, the files are re-compared in real-time, and their changes are displayed.
The View Selector is only present when editing is permitted on the files. When not present, the window
only shows the Reference View and treats all files in the window as read-only.
Ruleset Indicator
The Active Ruleset Indicator shows the current Ruleset in use in this window. The Ruleset provides
customizable rules for comparing and displaying file content (such as whitespace handling and character
encodings) that are based upon file type.
Generally, the Ruleset is automatically selected based upon the file suffix. It may be changed using the
File | Change Ruleset... command.
If both or all 3 files have the same character encoding, the value is listed once.
12
File Diff/Merge Windows
If each file has a different encoding, each is listed separately. DiffMerge compares the files after the files
have been converted from the original character encoding into UNICODE. So files that are in different
encodings can be compared.
If a file contained a UNICODE Byte Order Mark (BOM), a (BOM) will be shown.
The Splitter
By default, DiffMerge shows the file panels side-by-side with vertical “splitters” between them. This mode
allows you to easily see and match up the corresponding lines in the files. However, you may have to
scroll horizontally to see parts of a line.
DiffMerge also lets you view the files panels one above another with horizontal “splitters” between them.
In this mode, it may be a little difficult to see the line correspondence, but you should be able to see the
entire line in each file. In this mode, the order of the files is the same: editing takes place in the bottom
panel in a File Diff Window and the center panel in a File Merge Window.
13
File Diff/Merge Windows
You may drag the splitter to change the relative size of the file panels. Double-click on it to restore it to
the center.
The Toolbar
The toolbar above the File Diff/Merge Windows presents the following commands. Some appear only in
File Merge Windows.
View | Show Line Numbers and View | Show Invisibles control the visibility
of line numbers and whitespace and line terminator characters.
Apply Change from Left and Apply Change from Right apply the current
change to the editable file.
Showing Changes
Detail Level
DiffMerge has two Detail Levels: Lines Only and Lines and Characters.
14
File Diff/Merge Windows
Lines Only
In Lines Only mode, DiffMerge only performs difference analysis line-by-line. Changes are indicated
based upon equality of the entire line.
Lines are colored using the overall line status color and then intra-line highlights are added.
15
File Diff/Merge Windows
Highlighting Changes
Highlighed Changes are surrounded by a dotted line. When a change is highlighted, it may be acted upon
by the Apply Change... [14] commands and the custom right-mouse context menus. You can also use
the Next/Previous Change [14] commands to jump between changes.
Aggregating Changes
As a precaution, adjacent or overlapping changes are aggregated into a single change. Usually this produces
a conflict (depending on the individual types of changes in the grouping). When you’re merging multiple
files, these usually require your attention because DiffMerge cannot automatically determine what to do
with them.
For example, in the figure below, "Line 1" was added to both branches (in the left and right panels) and
"Line 2" was deleted from the right panel. So what should the merge result look like?
To access an individual line change within a block of changes, hold down the Control key while using the
left or right mouse buttons to select the desired line.
For example, in the following example a block of text has been moved. DiffMerge chose to match up the
BEGIN_EVENT_TABLE... block and treat the #define... block as a delete and an insert.
16
File Diff/Merge Windows
If you want to force the #define... blocks to line up, you could insert a marker as shown here.
This causes the other block of code to appear as a delete and an insert.
17
File Diff/Merge Windows
You can use the View | Delete All Manual Alignment Markers menu command to to delete all of the
Manual Alignment Markers in the window.
View | Show All. This mode shows all lines in the files.
View | Show Differences Only. This mode shows only the changes in the files. Identical lines
are hidden. For example:
View | Show Differences with Context. This mode shows changes with upto 3 lines of context
around each. Identical lines not adjacent to a change are hidden.
Note
The last 2 modes are only available in the Reference View.
18
File Diff/Merge Windows
Omitted Lines
A Ruleset can declare that certain lines be omitted from the difference analysis. These lines are treated as
if they were not present in the file during the analysis. For example, you might use this feature to ignore
differences caused by RCS Keyword Expansion.
Normally, these lines are drawn in a special gray color. For example, when we add the Regular Expression
\$Revision:.*\$, we can see that the revision lines were omitted from the analysis.
The View | Hide Omitted Lines menu option causes these lines to be hidden and a Gap drawn instead.
Note
The Hide Omitted Lines feature is only available in the Reference View when you have the
Display Mode set to Show All.
When the Detail Level is set to Lines and Characters, DiffMerge classifies all changes as either important
or unimportant using the information in the Ruleset. Normally, DiffMerge draws these unimportant
changes in a dimmer color. In the following example, compare the coloring of the “CHANGED” and
“YOUR/MY” changes in the file panel and in the glance bar. Also, the Change Stats shows that there are
3 changes.
19
File Diff/Merge Windows
When the Display Mode is set to Show All, the View | Hide Unimportant Differences command
causes DiffMerge to draw them as if they were identical (and with a slightly dimmer color for intra-line
character changes). In the following example, the 2 comment lines are no longer highlighted. And the word
“CHANGED” is dimmed slightly. The glance bar no longer shows a block for the change. The whitespace
before “sz” is no longer highlighted. The Change Stats shows that there are 2 important changes and 1
unimportant change (not being shown).
If we set the Display Mode to Show Differences Only, we see only the 3 changes with Gaps between them.
If we now turn on View | Hide Unimportant Differences, the unimportant changes are not drawn at all.
Again, the Change Stats indicates that 1 unimportant change is being hidden.
20
File Diff/Merge Windows
Change Ruleset
The File | Change Ruleset... menu command allows you to select a different Ruleset for the current
window. This raises the Choose Ruleset Dialog.
There are several output options, such as "Text" vs "HTML" mode and "Unified" vs "Traditional" vs "Side-
by-Side" formats, but in all cases:
• The current view (Reference or Edit) is exported and if the Edit View is chosen and it has unsaved
edits, those changes will be included in the output.
• The current Ruleset and the settings for: Show/Hide Unimportant, Show/Hide Omitted, and Tab
Size are respected.
• When exporting in "HTML" mode, intra-line highlighting will be shown if the Detail Level is set to
Lines and Chars.
• These Export commands always write to the destination, even if there are no differences to report. This
differs from the command line interface which for historical reasons only writes to the destination file
when there are differences to report.
Writes the file differences to a "Text" or "HTML" file in a format similar to the industry standard "unified"
format. For example:
21
File Diff/Merge Windows
Note: DiffMerge extends the industry standard format to allow for hidden and omitted lines, so our "Text"
mode output, while providing you with additional information, may confuse tools like "patch".
Writes the file differences to a "Text" or "HTML" file in the traditional "diff" format. For example:
Writes the file differences to a "HTML" file in a side-by-side format similar to how DiffMerge displays
them in a window. For example:
Side-by-side HTML output also respects the View | ShowView All, View | Differences Only, and
View | Differences with Context settings, so you can see as much of the 2 files as you want.
File Editing
File Diff and Merge Windows only allow 1 of the files in the set to be edited. This is called the Editable
Panel. This is the file in the right panel in a File Diff Window and the center panel in a File Merge Window
on the Edit View.
Interactive Editing
The term Interactive Editing refers to the normal editing operations found in most text editors and includes
inserting/deleting text with the keyboard and mouse and the standard cut/copy/paste clipboard operations.
22
File Diff/Merge Windows
Patching
The term Patching refers to the various commands that let you apply a change to the Editable Panel using
the content of the other panel(s).
With a change highlighted, you can use the right-mouse context menu to select an action.
Patching Verbs
The content of the context menu will vary depending on the type of the change or conflict, which panel you
click on, and whether you have a File Diff or File Merge window. All context menu patching commands
are variations of one of the following verbs:
Insert This option inserts content from the source panel into the Void in the editable panel.
Replace This option replaces the content in the editable panel with the content from the source
panel.
Prepend This option inserts the source content before the existing content in the editable panel.
Append This option inserts the source content after the existing content in the editable panel.
Most of the time, the first item in the context menu will be labeled with “(default)”. This is the Default
Action.
To apply the default action, you can shift-right-click on the change or use one of the
Apply Change... commands.
The complete auto-merge is performed as a batch (in 1 transaction) and may be undone using the Undo
command.
23
File Diff/Merge Windows
After the Auto-Merge command completes, the Auto-Merge Results dialog displays a report on what
changes were made, from where they came, and finally a notification about what conflicts could not be
merged.
Note
It is strongly recommended that if you wish to use Auto-Merge you use it BEFORE making any
other edits in the window. This prevents Auto-Merge from possibly reverting some of your edits.
Also, after Auto-Merge has been applied to a window, it is disabled. This is to prevent Auto-
Merge from being used twice and possibly reverting some edits made by the first Auto-Merge.
Undo/Redo
DiffMerge features an unlimited Undo/Redo so that it is possible to undo changes all
the way back to the initial state.
These commands cause the Find Panel to appear at the top of the File Window. The Find Panel will let
you search for text or jump to a particular line in the file. This panel can stay visible or can be dismissed
at any time.
24
File Diff/Merge Windows
This panel replaces the Find Dialog and Go To Line Dialog found in previous versions of DiffMerge.
This command can be used within a file window to directly set the find-string to the current selection for
a subsequent Find Next or Find Previous commands without raising the Find Panel.
These commands repeat the last search without raising the Find Panel.
These commands enable you to quickly jump between changes in the files.
These commands are only available in File Merge Windows. They enable you to
quickly jumpt to the next/previous conflict in the files.
The Glance Bar can be used to find changes and scroll the file panels to a specific line
or change.
Simply move the mouse over the Glance Bar and click. The corresponding line numbers
are displayed in the status bar as you move the mouse.
25
Chapter 5. The Folder Diff Window
The Folder Diff Window enables you to compare two folders and quickly see all of the differences
between them. It shows you which files and folders are present in both or only present in one. It also shows
you which files are different and optionally which are equivalent or identical.
You can use this, for example, to compare two versions of a software project and quickly see an overview
of the changes between them. You can then click on an individual pair files to open a File Diff Window
and see how the files have changed.
The Folder Diff Window is a recursive listing; it examines all files contained within the given root folders
and all sub-folders regardless of how deeply the folders are nested. Producing a listing in a large folder
tree can take a significant amount of time.
There are various Show/Hide commands to let you limit the clutter in the window and concentrate on the
important items more easily.
Filtering options are available in the Options Dialog to filter out generated and other uninteresting files
and sub-folders.
26
The Folder Diff Window
If a Swap button is provided, it will swap the left and right pathnames.
Note: if the set of folders selected are already open in an existing window, that window is raised rather
than creating a new, duplicate window.
Folder Listing
In the center of the window is a 2 column listing of the files and sub-folders that are present in the 2 folders
being compared. This is a recursive listing; all sub-folders are completely expanded. Lines are colored and
27
The Folder Diff Window
an icon is attached to each line based upon the status of the files or sub-folders on the line. In the following
example, the files C:\examples\ancestor\subfolder1\Preview_LineMode_3.txt and
C:\examples\branch_1\subfolder1\Preview_LineMode_3.txt are different and the file
version.h only exists in the C:\examples\ancestor\ folder.
The status bar contains a summary of the 2 folders. This is independent of the various show/hide settings.
From left to right the fields are the sum of the number of:
On rows with a pair of files or folders, double-clicking will open a new DiffMerge file or folder window
on the pair.
On rows with a single or pair of shortcuts, double-clicking will open a dialog showing information about
the shortcut(s). (Windows only)
On rows with a single or pair of symlinks, double-clicking will open a dialog showing information about
the symlink(s). (Linux/Mac only)
The Toolbar
The toolbar above the Folder Diff Window presents the following icons.
View | Compare Selected Files and View | Compare Selected Folders open the
selected pair of items in a File Diff or Folder Diff Window.
View | Show Equivalent Files shows/hides files that have minor differences (such as
in whitespace), but are otherwise effectively “equivalent”. Equivalence settings are set
in the Options Dialog.
28
The Folder Diff Window
View | Show Quick-Match Files shows/hides items that were marked equivalent using
Quick Match Mode. This mode only looks at file size.
View | Show Peerless shows/hides items (files, folders, and shortcuts) that are only
present in one of the 2 folders.
Context Menus
There are a few right-mouse context menu items worth mentioning here:
Open Pair in New DiffMerge Window Opens the pair of files or folders in a new window.
Copy Left Pathname to Clipboard Copies the full pathname of the item in the left tree
to the clipboard.
Copy Right Pathname to Clipboard Copies the full pathname of the item in the right
tree to the clipboard.
Copy Left to Right Copies the file, symlink, shortcut or folder in the
left tree to the right tree. If the right side does not
exist, it will be created. If the right side does
exist, it will be overwritten.
29
The Folder Diff Window
Export Commands
Export | File Diffs
The menu commands under here are available when a file pair with differences is highlighted in the Folder
Window. These commands will export the differences in the highlighted file pair but without opening a
File Diff Window on them.
See the section on Exporting File Differences for more information on the commands under this menu.
The menu commands under here menu will export the contents of the current Folder Window to a file.
There are several output options, such as "Text" vs "HTML" vs "CSV", but in all cases:
• The current state of the various Show/Hide commands on the View menu and/or the toolbar will be
respected.
30
The Folder Diff Window
31
Chapter 6. The Options Dialog
The Options Dialog allows you to fine-tune DiffMerge to better suit your needs.
All of the various settings are grouped by category into a series of Pages whose titles are listed on the left
side of the dialog. You can click on these titles to visit each of the various Pages.
Each Page is somewhat self-contained and has a Restore Defaults at the bottom. This button will restore
all of the fields on that Page to their original factory defaults.
The Options Dialog can be accessed using Tools | Options... on Windows and Linux and
DiffMerge | Preferences... on OS X.
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
32
The Options Dialog
Fonts
The Window Font and Printer Font fields determine the screen and printer fonts used to draw and print
the files. The Choose... buttons raise the standard system font chooser.
Window Options
The Window Options box contains a collection of miscellaneous settings:
DiffMerge can optionally test and display a warning if a file has been modified by another application.
This warning also asks you if you would like to reload the file(s). This test is performed each time that a
File Diff or Merge Window comes to the foreground and becomes the active window.
When printing File Diff and Merge Windows, DiffMerge actually prints 2 (or 3) files simultaneously.
When this option is checked, DiffMerge prints all the page 1s first, then all the page 2s, and so on. When
this option is off, DiffMerge prints all of the pages from the left file, then all of the pages from the center
file, and then all of the pages from the right file.
When this option is enabled, DiffMerge adds the appropriate end of line character(s), if necessary, to the
end of the final line of the file before saving.
33
The Options Dialog
When Auto-Save is enabled, DiffMerge periodically saves the edited file in a special Temporary Auto-
Save File. In the event of a program or system crash, you can recover your work from this temporary file.
Auto-Save does not modify the original file.
The Edit Interval determines the frequency of the auto-saves. This is an edit count. For example, if the
Edit Interval is set to 100, then the Auto-Save File is rewritten after every 100 changes.
When this option is enabled, DiffMerge automatically advances to and highlights the next Change after
you apply a patch/change using one of the various toolbar or menu commands.
This allows you to rapidly apply a series of changes without having to manually advance using the Next
Change command.
If not checked, DiffMerge leaves the caret where it was after the patch/change was applied and does not
highlight a change.
Rulesets allow you to fine-tune DiffMerge to handle different types of files. This includes things such as
character encodings, end of line conventions, and whitespace handling.
34
The Options Dialog
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings. This will also delete all of your Rulesets and restore the original set of Rulesets that were
originally shipped with the program.
Default Ruleset
The Default Ruleset is a built-in Ruleset that is applied to a File Diff or Merge Window when no Custom
Ruleset is appropriate or when Custom Rulesets are disabled.
The Default Ruleset cannot be deleted, but you can edit it.
Custom Rulesets
The Custom Rulesets box contains a collection of overall settings:
35
The Options Dialog
This option turns on Custom Rulesets. When disabled, the Default Ruleset is used for all File Windows.
This option lets DiffMerge try to automatically select the proper Custom Ruleset using the suffixes of the
files and the list of suffixes in each Custom Ruleset. For example, if you open foo.cpp and bar.cpp
in a File Diff Window, DiffMerge will automatically select the C/C++/C# Source Custom Ruleset. If you
open foo.py and bar.py, DiffMerge will automatically select the Python Source Custom Ruleset.
If this option is disabled, DiffMerge will ask you to select a Ruleset when each File Window is opened.
When the files in the set have different suffixes, it’s possible to take the first match, or to require all of
the files to match the same Ruleset.
You probably don't want this turned on. Temp files often get a system-defined temp name rather than
the proper suffix. Enabling one file to match enables you to ignore the temp file suffix when it’s being
compared against a properly named file in your workspace.
When DiffMerge cannot find a suffix match, it can either use the Default Ruleset or it can ask you to select
one using the Choose Ruleset Dialog.
The list box contains all of the currently defined Custom Rulesets. DiffMerge ships with Rulesets
predefined for C/C++/C# Source, VB Source, and several others. This list is ordered – DiffMerge searches
for a match in the order listed here.
36
The Options Dialog
You can double-click an item or click the Edit... button to edit or view the Ruleset. See the chapter on
Rulesets for more information.
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
37
The Options Dialog
• In Lines Only mode, DiffMerge compares the files line-by-line and does not perform any intra-line
highlighting/analysis.
Tip
This is the fastest mode. Switch to it if you're working with large files and/or having
performance problems.
• In Lines and Characters mode, DiffMerge performs the line-by-line analysis and then performs intra-
line analysis within each of the changes. Intra-line analysis is performed over the body of each change
and is governed by the following setting.
• In Complete mode, the entire body of the change (spanning all of the lines in the change) are essentially
joined into a single line before doing the character-level analysis. This allows changes introduced by
re-wrapping text to be separated from actual changes to the text.
Tip
This mode can be very expensive if the files have lots of changes and/or have very low
correlation. Disable it or switch to Simple mode if you experience performance problems.
• In Simple mode, lines are joined like in Complete mode, but this is limited to short change blocks to
avoid using an excessive amount of time and memory on highly uncorrelated blocks.
• If Disabled, DiffMerge does not attempt to join lines before doing the character level analysis.
For example, the following images show where a line of source code was broken across several lines in
one version. When in Simple or Complete mode, only the whitespace is highlighted because DiffMerge
matches up the words by crossing the line boundaries.
When Disabled, DiffMerge sees this as a five line change. There is a one line change (where text was
deleted from the end of the line) followed by an insert of four lines of new text. Since DiffMerge does not
combine the lines in this mode, the two parts are seen simply as adjacent, but unrelated, changes.
38
The Options Dialog
In the following, the threshold was set to 0 (disabled). Notice how the “x” characters are matched up
between the changes on the line.
In the following, the threshold was set to 3. Notice how the “x”, “xx”, and “xxx” sequences are combined
with the surrounding changes. But the “xxxx” sequence is not affected.
The intra-line threshold value doesn't change any difference analysis results; it only affects the coloring
of short spans of text within the line.
The intra-line threshold is only used when the Detail Level is set to Lines and Characters.
39
The Options Dialog
When the smoothing is set to 3 or more, we see that they have been combined into 1 change that includes
the identical lines between them:
This feature is initially set to 0 (disabled) because in File Merge Windows this smoothing can cause
adjacent changes (such as in the above example) to be considered a conflict when the individual
(unclumped) changes would not be. When you increase the threshold, you increase the likelihood that
Auto-Merge will require manual follow-up. This may or may not be a good thing -- it's somewhat
questionable how far apart nearby changes should be to be considered independent changes. By increasing
the setting to 1 or 2, you may produce a few conflicts that will cause Auto-Merge to complain, but these
are areas that you probably want to examine anyway.
Also, you might use this feature to reduce the number of annoying little changes reported. For example,
in source code a function frequently consists of several lines of text, a blank line, several lines of text, a
blank line, and so on. If someone inserts or changes a big chunk of code, the blank lines can sync up and
the unrelated chunks of code can appear as a sequence of little changes. Setting the threshold to 1 should
cause these individual changes to appear as 1 large change rather than numerous (annoying) little ones.
40
The Options Dialog
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
41
The Options Dialog
The overall line colors (from the Line Colors Page) are shown for reference in the first and last columns.
The buttons in the Foreground (Unimportant) column enable you to change the de-emphasized foreground
colors which are used when an intra-line change is marked as unimportant, such as text within a comment.
The buttons in the Intra-line Background column enable you to change the background colors of the intra-
line highlight.
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
42
The Options Dialog
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
43
The Options Dialog
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
Fonts
The Window Font and Printer Font fields determine the screen and printer fonts used to draw and print
the Window. The Choose... buttons raise the standard system font chooser.
Window Options
The Window Options box contains miscellaneous settings:
44
The Options Dialog
DiffMerge can optionally automatically rescan the filesystem and look for files that have been modified
by other applications. This rescan is performed each time a Folder Diff Window comes to the foreground
and becomes the active window.
Tip
This option can be very expensive and annoying if you are comparing large folders. Disable it if
restacking windows causes an unacceptable delay.
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
45
The Options Dialog
Tip
Scanning the file system is very expensive and time consuming. The use of Folder Filters can
usually speed this up considerably by eliminating the need to look at various types of files and
entire sub-folders. It will also help reduce on-screen clutter.
Filename Filters
DiffMerge can filter out temporary, binary, and other machine-generated files that are normally produced
as a by-product of software development. This section handles filtering out various files.
The first text field contains a list of suffixes that should be excluded, such as EXE and DLL. When
DiffMerge sees a file with one of these suffixes during the file system scan, it skips it completely.
The second text field contains a list of filenames that should be excluded. Items in this list can contain
simple glob-style wildcards, such as "*.dll".
The first field is preserved for historical reasons; the wildcard matching now provided by the second field
completely eliminates the need for the first field.
Items in both lists are delimited by whitespace, commas, or semicolons. If you need to add a pattern with
one of those characters, surround the entire pattern in double quotes. To include a double quote within
a filename, double it.
Sub-folder Filters
DiffMerge can filter out entire sub-folders (and everything contained within them). This is useful for
compiler output directories as well as for the various folders of state files that many Version Control
Systems leave in your source tree.
The text field contains a list of sub-folder names that should be excluded. When DiffMerge sees a sub-
folder with one of these names during the file system scan, it skips it (and everything contained within
the sub-folder).
Items within this list can use wildcards too. And have the same delimiters and quoting details as described
in the previous section.
Ignore Case
46
The Options Dialog
The Ignore Case in Patterns controls whether case is ignored or respected when using all of the above
set of filter patterns.
The Ignore Case when Matching Rows controls whether filename case is ignored or respected when
the contents of the 2 directories are matched up. For example, when enabled a file "FOO.TXT" would be
assumed to match up with a file "foo.txt" in the other directory. When disabled, they would appear as 2
peerless items. This option also causes the folder window to be sorted with a case-insensitive sort.
These options are primarily intended for Windows and Mac users which have case-insensitive filesystems.
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
47
The Options Dialog
When a Folder Diff Window scans the file system, it compares each pair of files using one of these 2
techniques:
• Quick Match Mode: When Quick Match is enabled and the file suffix is in the associated list,
DiffMerge will just compare the sizes of the 2 files and report "qm" or "different". This is intended to
help speed up scans when there are large media files in the folders. This method does not require either
file to be read, so the results are an approximation.
• Normal Mode: The contents of both files are read and compared. Pairs that are byte-for-byte identical
are marked equal. Non-equal pairs are marked different.
When a difference is detected, DiffMerge can optionally rescan non-equal file pairs and ignore things
like changes in line termination, changes in whitespace, and etc. in order to avoid reporting trivial
differences. Files which only have ignorable differences as marked equivalent rather than different.
Please note that this second step is expensive and will cause DiffMerge to take longer to complete the
scan. For this reason, there are 2 levels of equivalence testing, each with different levels of complexity:
Simple equivalence mode attempts to address the most trivial reasons for differences that are common to
many types of text files:
48
The Options Dialog
• During the rescan it will ignore differences in line termination characters and/or whitespace.
Simple equivalence mode DOES NOT look at upper/lower case, address character encoding issues, nor
import the files into UNICODE.
Rulesest-based equivalence is a more thorough attempt to determine if the files only have trivial changes.
It uses most of the settings in the corresponding Ruleset for each pair of files; this includes:
• ignoring differences in character encoding by using the settings on the Character Encodings Page of the
Ruleset Dialog and importing the files into UNICODE;
• ignoring differences in line termination, whitespace, and letter case by using the settings on the
Equivalence Mode Page of the Ruleset Dialog; and
• stripping out lines matched by the Lines to Omit settings on the Ruleset.
Ruleset-based equivalence DOES NOT use the settings on the Line Handling Page of the Ruleset Dialog.
Ruleset-based equivalence operates as if the Detail Level is set to Lines Only and therefore does not use
any of the Content Handling “Context” settings.
For Ruleset equivalence to work, Rulesets and automatic suffix matching must be enabled. For an
individual Ruleset, character encoding selection must be automatic. If a Ruleset or character encoding
cannot be automatically chosen, equivalence testing will either be skipped or the Default Ruleset chosen
instead.
NOTE: Do not enable the Default Ruleset if you have binary files in your folders since the attempt to
import the files into UNICODE will generally fail and just waste time.
As a performance consideration, you may want to set an upper file size limit for Ruleset equivalence
testing. No ruleset-based equivalence testing will be done on files that exceed this limit.
Each of the message dialogs has a “Do not show again!” option.
The following check boxes let you re-enable any message dialog that you turned off.
49
The Options Dialog
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings.
The Explorer Integration Page lets you control the DiffMerge integration with Windows Explorer. This
feature allows DiffMerge to add commands to the context menu of Windows Explorer. These commands
allow Windows Explorer to launch DiffMerge with the selected file(s) and folder(s).
50
The Options Dialog
Personal Settings
The integration feature is provided by a DiffMerge-supplied library that is loaded by Windows Explorer.
This library must be registered with the operating system before Windows Explorer will use it. This is a
system-wide registration and will affect all users of the computer.
Once the library has been registered with the system, you may personally enable or disable the feature
in your user account.
The Restore Personal Defaults button restores your personal settings to their original factory settings; it
does not affect the system-wide registration of the library.
When 1 file of folder is selected, the context menu will look something like this:
51
The Options Dialog
DiffMerge shows the long version of the context menu. You can launch DiffMerge with the single item
(and interactively fill in the other file or folder), remember the item's pathname in the list, or compare the
item with something from the remembered list.
DiffMerge allows you to remember 5 file pathnames and 5 folder pathnames for use in future comparisons.
When you compare with something from the list, DiffMerge will put the older file/folder in the left panel;
you may override this using the Swap button in the Select Files to Compare or Select Folders to Compare
dialogs.
When 2 files or folders are selected, the context menu will look something like this:
52
The Options Dialog
DiffMerge shows the short version of the context menu. With it you can launch DiffMerge to compare the
2 items and choose which will appear on the left and right.
53
The Options Dialog
The Restore Defaults button restores all the fields on this (and only this) page to their original factory
settings. This will also delete all of your External Tool configurations.
Overall Configuration
Indicates if the suffixes for all of the files in the set must match or if only one needs to match.
You probably don’t want this turned on. Temp files often get a system-defined temp name rather than the
proper suffix. Turning this off allows you to ignore the temp file suffix when it is being compared against
a properly named file in your workspace.
54
The Options Dialog
The list box contains all of the currently configured External Tools. By default, no External Tools are
configured.
The Add / Delete / Clone buttons let you create/delete tool configurations.
You can double-click an item or click the Edit... button to edit or view a configured tool. See the chapter
on External Tools for more information.
55
Chapter 7. Rulesets
Overview
Rulesets allow you to fine-tune DiffMerge to handle different types of files. This includes things such as
character encodings, end of line conventions, and whitespace handling.
DiffMerge uses the Ruleset settings and the list of Rulesets defined in the Options Dialog to control how
a set of files are loaded from disk and compared in a File Diff or Merge Window.
DiffMerge includes a Default Ruleset and a list of Custom Rulesets. The Default Ruleset is used when the
use of Custom Rulesets is disabled or when none of the Custom Rulesets is appropriate.
All of the various Ruleset settings are grouped by category into a series of Pages whose titles are listed on
the left side of the dialog. You can click on these titles to visit each of the various Pages.
This Page does not appear when you are editing the Default Ruleset; it is only present for Custom Rulesets.
Ruleset Name
This is a “human-readable” name for the Ruleset. This name is for information only; it is displayed in
various places to help you identify the Ruleset.
56
Rulesets
File Suffixes
This is a list of suffixes that should be assigned to this Ruleset. Entries should be separated by spaces and
should not contain dots.
If a Ruleset has a matching suffix for a particular file, then that Ruleset might be used when the File
Window is created.
DiffMerge uses this information to convert the files from their on-disk encoding into UNICODE before
comparing them. This allows, for example, DiffMerge to compare the effective content of 2 files that were
created with different encodings.
After the files are loaded, DiffMerge displays the character encoding(s) of the files in the status bar.
57
Rulesets
Note
If a file is loaded in multiple File Diff or Merge Windows, it will only be read from disk once.
Subsequent windows will share the in-memory copy of the file. Therefore, when the file is loaded
into the first window, the character encoding settings for the Ruleset in that window will be used
to convert the file into UNICODE. When the file is “referenced” by a subsequent window, no
conversion is required, so the encoding settings in the (possibly different) Ruleset in the second
window will not be used for that file.
Automatic Detection
When BOM Detection this is enabled, DiffMerge looks for a UNICODE Byte-Order-Mark (BOM) when
reading the files. If a BOM is present, DiffMerge assumes the indicated encoding. If a BOM is not present,
DiffMerge uses the Fallback Options below.
Fallback Options
The Fallback Options are used when no BOM is present.
DiffMerge assumes that files are encoding using the local system default character encoding.
DiffMerge will raise the Choose Character Encoding Dialog and ask you to select an encoding when
the File Diff or Merge Window is created.
58
Rulesets
Use this if you have files of this type in multiple encodings on your system, but will only be comparing
files that have the same encoding.
DiffMerge will raise the Choose Character Encoding Dialog once and ask you to select an encoding FOR
EACH FILE when the File Diff or Merge Window is created.
Use this if you have files of this type in multiple encodings on your system and need to do arbitrary
comparisons. This gives you maximum flexibility and lets you select an encoding on a file-by-file basis.
This option allows you to specify a primary and upto 2 alternate character encodings. DiffMerge will first
try to use the primary character encoding. If that fails, DiffMerge will attempt to use the alternates.
Named Encoding
Each of the controls in the Named Character Encoding section have a list of all character encoding
converters on the system.
59
Rulesets
The Lines to Omit Page of the New/Edit Ruleset Dialog lets you describe lines that should be completely
omitted from the difference analysis. For example, lines containing RCS revision or date keywords.
The list box presents a list of the patterns already defined. You may create as many of these patterns as you
want. You can think of these as a series of grep -v commands applied to the each file before DiffMerge
compares them.
60
Rulesets
Pattern
Here you can enter a regular expression that will be used to search for lines to omit.
For convenience, there are buttons to the right to supply patterns for some commonly omitted items.
Lines to Skip
This field indicates how many lines should be omitted with each match. You might use this, for example, if
you know that there are 2 lines of page headers after each page break. Most of the time this field will be 1.
61
Rulesets
Note
Unless you have specific needs, everything on this Page should always be enabled.
Line Termination
Different platforms use different line termination characters. Such differences can cause two otherwise
identical files to look like completely different files.
• When enabled, DiffMerge treats all CR, LF, and CRLF characters as a generic end-of-line (EOL) marker
and excludes them from the line. Line termination differences are not detected or indicated in any way.
This lets you compare files from different platforms with different EOL conventions.
When enabled, EOL characters are grayed-out to indicate that they are being ignored:
• When disabled, the original CR, LF, and CRLF characters are preserved and used in the analysis. The
EOL characters are treated as part of the line. So 2 otherwise identical files with different EOL characters
will appear to be 2 completely different files (with 1 change spanning the whole file).
When disabled, EOL characters are not grayed-out; they are part of the line and drawn just like other
characters on the line.
62
Rulesets
Line Matching
These options let DiffMerge ignore whitespace and letter case when vertically aligning and matching up
lines. Generally, this allows DiffMerge to achieve the best vertical text alignment.
Note
Changes in whitespace and letter case on a line will still be detected and indicated, but they will
not throw-off the vertical alignment. This is very useful when source files are re-indented.
These settings are only used in File Diff and Merge Windows when the Detail Level is set to Lines and
Characters.
Within source code there are usually three types of content. These are called Contexts:
63
Rulesets
Literal Context Quoted strings and other such text where you want exact matching.
For example, changing the whitespace or letter case within a string
prompt may change the behavior of a progrem.
Comment Context Within a source code comment you may want to relax the rules
some and disregard some of the changes. For example, suppose you
have a large block of comment text and you re-wrap it in one version
of the file. You might like to hide the change and pretend it's not
there.
Default Context (Everything Else) Any content that cannot be assigned to one of the above contexts is
said to be in the Default Context. For source code, this is generally
the bulk of the file.
Matched Contexts
Literals and Comments are said to be Matched Contexts because we need to have a pattern to identify
them.
The list box shows all of the defined context patterns. The Add... and Edit... buttons will let you create a
new pattern or modify an existing one using the Context Dialog.
This option lets you declare that the overall context is either important or unimportant. If it is important,
you can refine the context further to make commonly ignored things unimportant.
64
Rulesets
This option is only enabled if you elected to keep EOL characters in the analysis (not Ignore/Strip EOLs
on the Line Handling Page).
This option will mark changes as Important/Unimportant that are caused by inconsistencies in the EOL
characters within a file.
Generally, this option should be turned on -- unless you are in a case-insensitive language like VB.
This option will mark changes in whitespace as Important/Unimportant. this can mean SPACES-only or
SPACES-and-TABS depending on the next field.
In languages like C/C++ you should turn this option off for the Default Context because whitespace is
not significant within code.
In languages like Python you should turn it on for the Default Context because leading whitespace is
significant in Python.
65
Rulesets
A Context is defined as a Start Pattern and an optional End Pattern. Patterns must be valid Regular
Expressions. The End Pattern may be omitted if Ends at EOL is checked. Set the Escape Character if
the context has a special character (such as a backslash) to prevent premature matching of the End Pattern
or EOL.
The text that matches the Start Pattern is not considered part of the matched context; only the text following
it (and including the text matching the End Pattern).
See the Default Context Guidelines for an explanation of the Context Guideline fields on this dialog.
Equivalence Mode
The Equivalence Mode Page of the New/Edit Ruleset Dialog lets you control what differences are
ignored in Folder Diff Windows when the Equivalence Mode is set to Ruleset-based.
Note
The settings on Equivalence Mode Page are very similar to the settings on the Line Handling Page.
The settings here are only used by Folder Windows; the others are only used for File Windows.
66
Chapter 8. External Tools
Overview
Whenever DiffMerge is asked to compare or merge a set of files and the External Tools feature is enabled,
DiffMerge can either open the files in a File Diff or Merge Window or it can hand them to an external
application and let it process the files.
You can use this feature, for example, to let other applications handle binary files types (such as word
processor documents) or XML files and then use a DiffMerge Folder Diff Window to compare 2 folders
of documents (using the built-in Exact Match Only Equivalence Mode). And when you double-click on a
pair of files, the external application will be launched to actually show you the changes.
DiffMerge uses the suffixes of the files and searches the list of configured External Tools for a match. The
tools are searched in the order listed in the Options Dialog. DiffMerge then tries to use the first matches.
If no tool matches, DiffMerge creates a normal File Diff or Merge Window.
When DiffMerge gets a match for an interactive request, DiffMerge just launches it as a peer application
and does not wait for it to complete.
For each External Tool that you configure, you can decide if the tool is enabled for File Diffs, File Merges,
or both. You can select different executables and command line argument templates for each mode.
All of the various tool settings are grouped by category into a series of Pages whose titles are listed on the
left side of the dialog. You can click on these titles to visit each of the various Pages.
67
External Tools
Name
This is a “human-readable” name for the tool. This name is for information only; it is displayed in various
places to help you identify the tool.
File Suffixes
This is a list of suffixes that should be assigned to this External Tool. Entries should be separated by spaces
and should not contain dots.
68
External Tools
This check box determines if this tool should be used for File Diffs.
Pathname
This field contains the pathname of the executable that should be used for File Diffs.
Tip
On OS X, you can give the path to either the application bundle (the foo.app folder) or the name
of the actual executable inside the application bundle (foo.app/Contents/MacOS/foo).
Since each external application seems to have its own unique argument ordering and command flags, we
define the command line arguments using a template containing place-holder tokens. When DiffMerge
is ready to launch the external application, it will substitute pathnames and labels into the template and
build the actual command line.
69
External Tools
%LEFT_LABEL% The labels for the left and right files. In a DiffMerge File
%RIGHT_LABEL% Diff Window, these labels are displayed above the panel; other
applications may display them differently or not use them at all.
When DiffMerge is handing off the initial set of files received on the
command line to an external tool, the values for these tokens come
from the /title1 and /title2 arguments given to DiffMerge.
Otherwise, they default to the pathnames of the corresponding files.
The Left and Right buttons are for your convenience and can be used to insert the corresponding token
(with quotes) at the current insertion point into the text field.
Tip
It is highly recommended that you enclose each token in quotes so that whitespace in the titles
and/or pathnames are properly received by the external application.
70
External Tools
The descriptions for most of these fields are identical to the descriptions on the previous page for File Diffs.
%WORKING_LABEL% The labels for the “working” (left) and “other” (right) files.
%OTHER_LABEL%
When DiffMerge is handing off the initial set of files received on the
command line to an external tool, the values for these tokens come
from the /title1 and /title3 arguments given to DiffMerge.
Otherwise, they default to the pathnames of the corresponding files.
When DiffMerge is handing off the initial set of files received on the
command line to an external tool, the value for this token come from
the /title2 argument given to DiffMerge. Otherwise, it defaults
to the pathname of the destination result or the common ancestor
baseline file.
%WORKING_PATH% The pathnames of the “working” (left) and “other” (right) files.
%OTHER_PATH%
%BASELINE_PATH% The pathname of the “baseline” (center) file. This is the common
ancestor.
71
Chapter 9. Printing
Printing File Windows
You can print the contents of File Diff and Merge Windows and see the differences highlighted as they
are on the screen.
Tip
With the addition of HTML Export in 4.2, if you want to print or share file differences, you might
want to use the new HTML Export feature to export the differences to a .html file and let the
browser handle the details of print and/or share the .html file with co-workers, rather than using
the native print feature described in this section.
I feel that the look of the HTML output is much nicer than the output produced by the original
native DiffMerge print commands. For example, the HTML output supports line wrapping and
3 different layouts whereas the native printing does not wrap and only handles side-by-side on
facing pages.
The native printing output is due for overhaul; until then you might consider the HTML option.
72
Printing
DiffMerge uses all of the current display settings, such as the Detail Level, Display Mode, various hiding
options, and etc. So for example, if you are have selected Show Differences Only in the window, the output
will also only contain the differences.
Changes are printed in color using a bold font. Conflicts are printed in color using a bold and underlined
font. DiffMerge uses the same coloring rules for text as on the screen; however, it does not use the
background colors.
The page footer gives a summary of the settings that affected the output.
When DiffMerge prints a File Window, it actually prints both/all of the files in the window simultaneously.
Each File Panel is printed on a separate page, 2 or 3 pages across. The page numbers are augmented with
73
Printing
the letters a, b, and c to help you track the printed pages. Vertically, files are synchronized like they are on
screen so that content lines up on each page. For example, when printing a File Merge Window, you should
be able to place pages 10a, 10b, and 10c side-by-side and have everything line up just like on the screen.
For your convenience, DiffMerge can print the files sequentially (1a, 2a, ..., 1b, 2b, ...) or interleaved (1a,
1b, 2a, 2b, ...). This is controlled in the Options Dialog.
Currently, DiffMerge does not line-wrap long lines. Lines that do not fit across a single page are truncated.
If long lines are a problem, try printing in landscape mode and/or using a smaller font.
Tip
With the addition of HTML Export in 4.2, if you want to print or share the summary of differences
in the folder pair, you might want to use the new HTML Export feature to export the differences
to a .html file and let the browser handle the details of print and/or share the .html file with co-
workers, rather than using the native print feature described in this section.
I feel that the look of the HTML output is much nicer than the output produced by the original
native DiffMerge print commands. For example, the HTML output has a single column layout
similar to "unified" diffs which is helpful when there are long pathnames.
The native printing output is due for overhaul; until then you might consider the HTML option.
74
Printing
DiffMerge uses all of the current Show/Hide settings and the same line icons and text coloring, so the
folder listing on paper should match the listing on screen.
75
Chapter 10. Command Line Arguments
DiffMerge allows a variety of different command lines formats. These allow DiffMerge to launch with
different types of initial windows and to be invoked by other applications. Each usage is summarized in
the following sections.
DiffMerge Command Flags/Options have a long and short form and may either be prefixed by a '/' or a
'-' depending upon your platform. For example: -h, -help, --help, /h, or /help.
For options that require a value, they must have a COLON, EQUAL, or SPACE separator character
between the keyword and the value. And the value should be quoted if it contains spaces or special
characters. For example, /caption="Hello World!".
Generally, DiffMerge will exit with 0 status when there are no errors and a 3 status when there is a
command line syntax error.
diffmerge
Exit Status
Opens a File Diff Window with the given files. If only one file is given, you will be prompted for the
second. File1 will appear in the left panel; file2 will appear in the right panel.
If you do not specify /ro2, file2 will be editable and you can apply patches to it from file1.
Opens a Folder Diff Window with the given folders. If only one folder is given, you will be prompted for
the second. Folder1 will appear in the left panel; folder2 will appear in the right panel.
Flags
-c, -caption=message
-ro2
76
Command Line Arguments
This is used by the Windows Shell/Explorer Integration feature. This option forces the Open Files or
Folders dialog to appear (even when not necessary) before opening the first window to allow you the
opportunity to swap the pathnames if necessary.
-t1, -title1=message
-t2, -title2=message
Exit Status
Open a File Merge Window with the 3 given files. File1 will appear in the left panel and is traditionally set
to your version of the file. File2 will appear in the center panel and should be the common ancestor of the
other 2 files. File3 will appear in the right panel and is traditionally set to the repository version of the file.
If you do not specify /ro2, file2 will be editable and you can apply patches to it from file1 or file3.
Flags
-m, -merge
-r, -result=pathname
Specifies a pathname for saving the merge result. It omitted, the merge result (if saved) will overwrite
the center file. This flag causes DiffMerge to return an exit status based upon the merge result in
the window.
-t3, -title3=message
The meanings of the other flags are described in the Flags for Opening a Diff Window [76].
Exit Status
When /result is not used, DiffMerge exits with exit status OK (0) or SYNTAX-ERROR (3) as usual.
When /result is used, DiffMerge sets the exit status to reflect the state of the merge:
0: MERGE-RESOLVED - you saved the merge result. This does not mean that there are no conflicts
remaining; it only means that you looked at the files, made whatever edits were necessary, and saved your
edits into the result file.
77
Command Line Arguments
1: MERGE-ABORTED - you gave up the merge by not saving your changes. This means that you either
never saved your edits into the result file or that you closed the window with unsaved edits (possibly after
a checkpoint save).
2: FILE-ERROR - there were file errors/problems that prevented the merge window from being shown.
3: SYNTAX-ERROR - there were syntax errors with the command line arguments.
Showing Help
Synopsis
diffmerge {-help}
Exit Status
Compare 2 files and write the differences to a file (without opening a window).
DiffMerge will use the Ruleset settings and the file suffixes to try to automatically select a Ruleset; if it
cannot automatically pick one, DiffMerge will fall-back to the Default Ruleset.
DiffMerge will use the Ruleset's settings from the Character Encoding, Lines to Omit, and Line Handling
Pages. When appropriate, it will use the last interactively selected tab size.
Since the output will be reported in lines, the Detail Level and the Ruleset's settings on the Content
Handling Page are not relevant.
Flags
-d, -diff=pathname
Compare 2 files and write the results to this pathname. The file is only created if there are differences
to report.
-u, -unified
If there are differences, write them in Unified Format rather than Tranditional Format.
-i, -ignore_unimportant
Suppress "Unimportant" changes by enabling "Hide Unimportant". Note that this feature can cause the
reported diffs to appear slightly differently which may confuse programs like "patch". So it is best to only
use this option for personal use.
Exit Status
78
Command Line Arguments
When diffing files to a file, DiffMerge sets the exit status to:
0: IDENTICAL - the input files are identical (and the output file is not created).
1: DIFFERENT - the input files are different (and the differences are written to the output file).
2: FILE-ERROR - there were file errors that prevented the files from being compared; this includes file
I/O errors and problems detecting the character encoding of the input files.
3: SYNTAX-ERROR - there were syntax errors with the command line arguments.
Compare 2 folders and write the differences to a file (without opening a window).
Flags
-d, -diff=pathname
Compare 2 folders and write the results to this pathname. The file is always created even if there are no
changes to report.
Exit Status
When diffing folders to a file, DiffMerge sets the exit status to:
2: FILE-ERROR - there were filesystem errors that prevented the folders from being compared.
3: SYNTAX-ERROR - there were syntax errors with the command line arguments.
79
Chapter 11. Integration with Third-Party
Software
DiffMerge can be configured as an external compare / merge tool with various third-party version control
systems. Usually this just involves formatting the correct command line template string in the package’s
options dialog or configuration file. Here are instructions for some popular packages.
GIT
The git difftool and git mergetool commands can be used to launch a variety of external diff
and merge tools. For background information on configuring GIT, see:
https://www.kernel.org/pub/software/scm/git/docs/git-difftool.html [https://www.kernel.org/pub/
software/scm/git/docs/git-difftool.html]
https://www.kernel.org/pub/software/scm/git/docs/git-mergetool.html [https://www.kernel.org/pub/
software/scm/git/docs/git-mergetool.html]
Settings for OS X
First confirm that /usr/bin/diffmerge is present. If you used the PKG Installer this was also
installed when /Applications/DiffMerge.app was installed. If you used the DMG file, refer to the
instructions for installing the Extras [5].
The following commands will update your .gitconfig to let GIT use DiffMerge:
80
Integration with Third-Party Software
Since GitHub for Windows is built upon a version of the Git for Windows (MSysGit) package, the
Command Prompt commands in the following section could also be used. The acutal configuration file
settings are provided here to avoid various command line quoting issues in the various shells available
to you.
Add the following lines to your .gitconfig. This file should be in your home directory in C:\Users:
[diff]
tool = diffmerge
[difftool "diffmerge"]
cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe
\"$LOCAL\" \"$REMOTE\"
[merge]
tool = diffmerge
[mergetool "diffmerge"]
trustExitCode = true
cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe
/merge /result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
Note that both the of cmd = ... lines were wrapped for this document and should appear as a single
line in your .gitconfig file. You can verify your settings with the git config --list command.
The pathnames above assume that the MSI installer was used to install DiffMerge in the standard
location. If you installed DiffMerge from the ZIP package, be sure to adjust the pathname to sgdm.exe
accordingly.
81
Integration with Third-Party Software
"C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe
/merge /result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\""
Note that the the line were wrapped for this document. You can verify your settings with the git config
--list command.
The commands above assume that the MSI installer was used to install DiffMerge in the standard
location. If you installed DiffMerge from the ZIP package, be sure to adjust the pathname to sgdm.exe
accordingly.
This version of GIT invokes external diff/merge tools using cygwin-style pathnames, such as /tmp/foo
(which is relative to the root of the cygwin directory). These pathnames are not understood by DiffMerge.
A shell script wrapper sgdm_cygwin.sh has been provided (in the same directory as the sgdm.exe
executable) to translate these pathnames and launch DiffMerge.
The following commands will update your .gitconfig to let the Cygwin version of GIT use DiffMerge:
Note that each of the input pathnames is associated with a /pX= option instead of being an unbound
parameter.
The commands above assume that the MSI installer was used to install DiffMerge in the standard
location. If you installed DiffMerge from the ZIP package, be sure to adjust the pathname to sgdm.exe
accordingly.
Mercurial (Hg)
Information on configuring an external diff/merge tool can be found in:
http://www.selenic.com/mercurial/wiki/MergeToolConfiguration
http://www.selenic.com/mercurial/wiki/index.cgi/MergeProgram
http://www.selenic.com/mercurial/wiki/ExtdiffExtension
The command for comparing 2 versions of a file is hg diff foo.c. This will compare the baseline
and working-folder versions of foo.c and print unified-diffs in the terminal window. If you add the settings
82
Integration with Third-Party Software
below to your mercurial.ini or .hgrc file, you can type hg diffmerge foo.c and have
DiffMerge launched to compare the 2 file versions.
The hg merge and hg resolve commands will merge files. When the settings below are added,
Mercurial will try to use DiffMerge to perform the merge. There are lots of Mercurial options to control
how external merge tools are selected (based upon priority and file type). Please see the above references
for configuration options.
[extensions]
hgext.extdiff =
[extdiff]
cmd.diffmerge = /usr/bin/diffmerge
[merge-tools]
diffmerge.executable = /usr/bin/diffmerge
diffmerge.args = --result=$output $local $base $other
diffmerge.binary = False
diffmerge.symlinks = False
diffmerge.gui = True
diffmerge.premerge = True
[extensions]
hgext.extdiff =
[extdiff]
cmd.diffmerge = C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe
[merge-tools]
diffmerge.executable = C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe
diffmerge.args = /merge /result=$output $local $base $other
diffmerge.binary = False
diffmerge.symlinks = False
diffmerge.gui = True
83
Integration with Third-Party Software
diffmerge.premerge = True
This version of Mercurial invokes external diff/merge tools using cygwin-style pathnames, such as /
tmp/foo (which is relative to the root of the cygwin directory). These pathnames are not understood by
DiffMerge. A shell script wrapper sgdm_cygwin.sh has been provided (in the same directory as the
sgdm.exe executable) to translate these pathnames and launch DiffMerge.
[extensions]
hgext.extdiff =
[extdiff]
cmd.diffmerge = C:/Program Files/SourceGear/Common/DiffMerge/sgdm_cygwin.sh
[merge-tools]
diffmerge.executable = C:/Program Files/SourceGear/Common/DiffMerge/sgdm_cygwin.sh
diffmerge.args = /merge /result=$output /p1=$local /p2=$base /p3=$other
diffmerge.binary = False
diffmerge.symlinks = False
diffmerge.gui = True
diffmerge.premerge = True
Note that each of the input pathnames is associated with a /pX= option instead of being an unbound
parameter.
Mercurial Tips
• It is very important that the --result=$output argument be present. Without this, DiffMerge will
not set the exit status as Mercurial expects and it will save the merge result in the original file, which
in this case is a Mercurial temporary file.
to the diffmerge.args line. This will give you better window titles.
TortoiseSVN
Information on configuring an external diff/merge tool can be found in
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-settings.html#tsvn-dug-settings-progs
The arguments for comparing two files or two versions of a file should be:
84
Integration with Third-Party Software
With this command line, “original version (%bname)” will be in the left panel and the “modified version
(%mine)” will be in the right panel. . If you want to limit yourself to strictly viewing, rather than editing,
the changes, add /ro2 to the beginning of the above command line.
The arugments for merging two versions of a file from a common ancestor should be:
With this command line, “your changes (%mine)” will be in the left panel, the “common ancestor (%base)”
will be in the center panel, and “their changes (%theirs)” will be in the right panel. When you save your
merge changes, they will be written to the “merge result (%merged)” file.
Microsoft TFS
Information on configuring an external diff/merge tool can be found at:
http://msdn2.microsoft.com/en-us/library/ms181446.aspx
This document describes how to configure tools based upon file suffix. A “*” can be used for the suffix
to change the default tool settings.
For a listing of the arguments used to build the command line string, see James Manning’s blog:
http://blogs.msdn.com/jmanning/articles/535573.aspx
The arguments for comparing two files or two versions of a file should be:
/t1=%6 /t2=%7 %1 %2
With this command line, “original version (%1)” will be in the left panel and the “modified version (%2)”
will be in the right panel. If you want to limit yourself to strictly viewing, rather than editing, the changes,
add /ro2 to the beginning of the above command line.
The arugments for merging two versions of a file from a common ancestor should be:
With this command line, “your changes (%2)” will be in the left panel, the “common ancestor (%3)” will
be in the center panel, and “their changes (%1)” will be in the right panel. When you save your merge
changes, they will be written to the “merge result (%4)” file.
85
Integration with Third-Party Software
First ADD an entry for Operation File Difference. Use file extension .* and set the command line to:
C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe
/t1="original version" /t2="modified version" %1 %2
Next ADD an entry for Operation File Merge with the command line:
C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe
/t1="source branch" /t2="base version" /t3="destination branch"
/result=%4 %1 %3 %2
86
Chapter 12. Release Notes
Release 4.2.0 - October 2013
This is the 4.2.0 release of SourceGear DiffMerge [http://www.sourcegear.com/diffmerge/index.html]. It
is available here [http://www.sourcegear.com/diffmerge/downloads.html].
• Added HTML and Text export of file and folder differences to a file.
• Improved visibility of the selected change within File Diff and Merge windows. Solid side bars are now
drawn in addition to the dotted lines and the color was changed to use the selection highlight background
color.
• Added a "quick match" feature to the Folder Window. This is an approximation intended for extremely
large media files. If the files are the same size, they are assumed to be equal. These are marked with a
"qm" icon rather than the regular "==" icon.
• Changed Folder Window to use a background thread to scan and compare the contents of the folders.
Added a per-window progress bar.
• Enable SWAP button in all uses of 2-way Open Dialog. Previously this was only visible when the dialog
was initiated by Windows Explorer integration.
• Enable Drag-and-Drop onto DiffMerge File and Folder Windows. These windows now respond to Drop
messages and will attempt to open a new window with the dropped files. Only the first 2 items in the
drop are recognized and the Open Dialog will be raised first to let you verify the order of the items.
• Moved the functionality provided by the Find and Go To Line dialogs to a set of controls on the File
Window.
• The Folder Window would sometimes not respect the "Allow Default Ruleset" settings when comparing
files.
87
Release Notes
• Added Drag-and-Drop onto text fields within Open Dialog. The change in 4.0 to make those fields auto-
complete on Windows broke Drop support.
• Fixed Paste in file windows to respect the line endings (EOLs) of the destination file.
• Fixed occasional hang seen on Windows when closing last window and error messages seen when
repeatedly clicking on close button while in the hung state.
• Finder integration.
• DiffMerge should now appear in Finder's Open with context menu and the Finder | Services menu
when an appropriate file or folder is selected.
• You should also be able to drop items onto the DiffMerge icon in the Dock.
• Only the first 2 selected or dropped items are recognized and the Open Dialog will be raised first
to let you verify the order of the items.
• You may have to log out and back in before these appear.
• Fixed the Edit | Find, Edit | Find Next, Edit | Find Previous, and Edit | Use Selection for Find,
commands to use the system-wide search text. This is a follow-on to S3363 and allow Command+E and
Command+G to work between apps using the NSFindPboard facility.
• Fixed problems with keyboard input and interactive editing in a file diff or merge window when entering
composed characters. The typical use for this is to enter accented characters in European languages
using various "dead char" sequences.
• Set wxWINDOW_VARIANT_SMALL propery on windows and dialogs so that controls and fonts look
more natural.
• Fixed initial position of Print Preview Windows. Sometimes they would initially appear with the title bar
offscreen, which made them difficult to move or close. This was observed on multiple monitor systems.
• Updated code to populate menu bar so that Folder Windows only have folder-related items and File
Windows only have file-related items. When the original OS X menu bar code was written there was a
problem with changing menu bars once populated (such as when going from an empty window to one
with either a file or folder pair), so the menu was created with all menu items and half of them grayed.
This has been fixed and now the menu content behaves like it does on the other platforms.
• W0972, W3075, W3131: Changed the various folder window show/hide buttons to be per-window
rather than global. Changed the show/hide peerless button to include peerless folders and shortcuts.
88
Release Notes
• W2899, W2646: Simplified (somewhat) the folder window coloring. Got rid of a few colors and softened
a few default colors.
• W2256, W6645, W9218: Added various View | Export Window commands to folder windows. These
allow you to export either a text summary or a CSV file of the changes in the 2 folders to a file or to the
clipboard. These commands replace the original File | Save As which always wrote CSV to a file.
• W6338, W8240: Added ability to compare 2 folders and summarize the differences to a file directly
from the command line.
• W0840, W2194, W5681, W7540: Added Copy Left to Right, Copy Right to Left, and recursive
versions to folder window. For peerless items, these will clone the item in the other tree. For file pairs,
these will overwrite the destination version.
• W8005, W7540: On Linux and Mac: Support for symlinks as first-class items in folder windows.
Symlinks are now identified (rather than implicitly dereferencing the target) and are given a unique
icons and status. Status is computed strictly on the symlink's target pathname. (Do the pair of symlinks
refer to the same absolute or relative path, rather than comparing the referenced files/folders?) Double-
clicking on a symlink raises the Symlink Details Dialog.
• W8005: Annotate symlink line items on Linux and Mac with trailing "@" and shortcuts on Windows
with trailing "^" in folder window.
• S3363: Added Edit | Use Selection for Find command ("Command+E / Ctrl+E"). This command allows
you to use the Find Next and Find Previous commands without needing to raise the Find Dialog.
This feature is available on all platforms, but is intended to emulate a somewhat hidden feature in
OS X. DiffMerge currently does not access the system-wide/global/shared find-string, so Find Next
and Find Previous commands within DiffMerge will only use the last search string set with Command
+F or Command+E within DiffMerge; DiffMerge will not see a find-string set with Command+E by
TextEdit.app or Terminal.app, for example.
• S3363: The Find Dialog's find-string is no longer persisted between DiffMerge invocations. The goal
is to later get the initial value for the dialog from any system-wide setting from the last application to
do a Find rather than a DiffMerge-only value.
• W0886, W6312: New icons for line items within the Folder Window.
• P7454: Fixed handling of ESCape key. Prior to 4.0, the ESCape key could be used to close a file or
folder window. This stopped working in 4.0.
• W9818: The 4.0 release with wxWidgets 2.9.4 would occasionally print a "GLib-CRITICAL" message
on the console when the PRINT button was pressed on the Print Preview window. This has been fixed
in the 2.9.5 release of wxWidgets.
• W2593: Improved support for Windows shortcuts .lnk files in folder windows. The folder window
will now compare the contents of a pair of shortcuts for equality. This is a binary/raw comparison to
89
Release Notes
see if the links have identical content (target, working directory, arguments, etc); it does not attempt
to dereference the targets.
• W3459: Updated folder window printing for the above shortcuts changes.
• W3747, W5281, W7281, W9346, W4964, W2917: Added Shortcut Details dialog. Folder windows
now allow right-click or double-click on Windows shortcut .lnk rows and have a View | Shortcut
Details... menu command. These will raise a dialog showing the contents of the shortcuts (target,
working directory, arguments, icon, etc). For shortcut pairs that have file or folder targets, this dialog
contains a button to open a file or folder window to compare them. (This button isn't present when the
target refers to a printer, for example.)
• W9103: Allow Windows shortcut .lnk files on the command line and automatically dereference them
and open a file or folder window on their targets.
• W7716: Fixed crash when using PageUp/PageDown keys when caret was offscreen.
• W0394: Fixed Control+Mouse bindings in file windows which allow you to select a single line within
a multi-line change. There were changes in wxWidgets from 2.8.* to 2.9.* affecting how modifier keys
are handled that were not properly addressed in the 4.0 release.
• W0394, W2624: Fixed/Updated navigation key bindings (Left, Right, Up, Down, PageUp, PageDown,
Home, End) to account for changes in how modifier keys are handled in wxWidgets 2.9.*. Prior to 4.0,
we used Ctrl+ and Ctrl+Option+ in some bindings. These were inadvertently changed to Command+ and
Command+Option+ in 4.0 with the wxWidgets functionality changes. But there were a few bindings that
didn't work. For the 4.1 release, I've explicitly fixed all the bindings to use Command+ and Command
+Option+ keys and updated the various tooltips.
• W5099: Fixed problem with Cut/Copy/Paste that would happen when a modeless dialog (such as Find
or GoTo Line) was open.
• W0058: Fixed problem with Command+ keys inserting the key into the window when that command
was disabled in the menu.
• W9586: Fixed problem with keyboard input and interactive editing in a file window when using a
Russian (non-English) keyboard. (There are still problems with obscure Ctrl+ keys and AltGr sequences
on any keyboard layout, but this should fix the problems with Russian keyboard layouts not working
at all.)
• Upgrade build to use wxWidgets version 2.9.4. The previous release used version 2.8.12.
• Added code to check our website for the availability of a newer release of DiffMerge. This will happen
approximately once a week. You can force a check immediately using the Tools | Check for Updates...
menu item. If a newer release is available, a dialog will appear with instructions for downloading and
installing it.
90
Release Notes
• Remove the bundled "MoveFromSourceGear" html content from the distribution and the
Help | About SourceGear menu item. They were replaced with the Tools | Visit SourceGear menu
item which opens a browser to a page on our website describing SourceGear and other available
products. This allows us to more easily provide current information and do promotional offerings.
• Added an optional registration mechanism for DiffMerge. This includes the Tools | Registration... and
Tools | Register... dialogs. See the chapter on Registration for more details.
• W4316: Create editor temp files in a system temp directory rather than in the source directory. This
helps keep things tidy, avoids problems when comparing files on a read-only filesystem, and avoids
non-standard layout complaints from Eclipse.
• G9739: Fixed the .DS_Store filtering problem. Added set of filename filters (in addition to the existing
suffix filers) that filter on the whole filename. They can also use wildcards.
• W1671: Allow case-insensitive sorting and matchup in Folder Window. This feature was already present
in the Windows version.
• W2848: Added option to ignore case when using folder filter patterns.
• W8032, 15146: Fixed a problem where the Folder Window would mark a pair of files as different
which should have been marked equivalent. This happened when there was a change within consecutive
omitted lines.
• W0581: Disable the OK button in the File | Open ... dialogs until all of the fields name valid files/folders.
• Created "webhelp" version of manual for the website and added Help | Online Help... Menu command
to open it.
• Removed the splash screen on startup and deprecated the "--nosplash" command line argument.
• W2655: Force cursor and scroll position to top of Support Dialog when opened.
• G9660: Fix default wildcard pattern (from "*.*" to "*") that was passed to the stock File Open dialog.
This was preventing the selection of files without suffixes.
• Added section on using our APT repository on Ubuntu and Mint to the manual.
• W6778: Better support of Windows Shortcuts .lnk files in Folder Windows. Previous versions would
incorrectly try to expand the shortcut target and use the target string in the Folder Window row. This
caused problems when the target was an unavailable network share or a printer... This release does not
attempt to dereference shortcuts, not even to see if a pair points to the same thing. It just lists them as
links with the .lnk suffix (which Windows Explorer hides). A future release will address comparing link
targets and/or matchup with a possible peer without the .lnk suffix.
• W5971, W6608: Disallow Windows Shortcuts .lnk files on the command line and in the File | Open ...
dialogs. Again, this release does not attempt to dereference shortcuts. The changes here are to prevent
91
Release Notes
DiffMerge from trying to open the .lnk file as a plain file and then complaining when the UNICODE
import fails. A future release will address dereferencing link targets.
• W7816: Added sgdm_cygwin.sh to the distribution. This is a cygwin bash shell script wrapper to
translate cygwin-style pathnames to dos-style pathnames and then invoke DiffMerge. See the section
on Git Under Cygwin and Mercurial Under Cygwin for more information.
• The upgrade to wxWidgets version 2.9.4 allowed us to convert from Carbon to Cocoa system libraries.
This gives DiffMerge a more modern look and feel, such as being able to resize a window from any
edge rather than just the bottom right corner.
• The upgrade to the Cocoa system libraries allowed us to offer both 32- and 64-bit Intel versions. Previous
releases were limited to 32-bits because of our dependency on Carbon. This version of DiffMerge is
built as a Universal binary, so both Intel versions are contained within the same application executable.
• W7615: Fixed ugly, ugly, ugly hack to try to raise the initial window when launched from the Terminal
using the DiffMerge executable directly rather than the DiffMerge.app application bundle.
• J6399: Fixed crash in 64-bit versions (observed on Ubuntu 11.04 and 11.10) that happened when
launching the Options Dialog.
• J5726: The Auto-Merge button is now only enabled when the files are first loaded and have not yet been
edited. There were some weird cases where it would enable/disable (seemingly at random) while you
were typing. Since the Auto-Merge button would probably undo any changes you have already made,
it seemed reasonable to disable it and avoid the potential confusion.
• J3388: Fixed bug where the intra-line highlight of a line with changes would be marked unimportant
when it immediately followed a line that ended with a context starting delimiter. For example, in a C
++ source file, if a line ended with slash-slash comment (with no whitespace between the slashes and
the CRLF or LF), DiffMerge would not respect the ends-at-eol setting on the comment context; the
following line would be colored as if the previous line has ended with slash-star.
• J1202: Fixed crash when using the batch output (--diff) feature, a Ruleset that contains a Lines-to-Omit
pattern, and input files that had an added/deleted line immediately following an omitted line.
• J7751: Fixed application icon in Launcher/Dash on Ubuntu 11.10 so that it no longer appears as a
Question Mark. (We now use a PNG rather than an XPM in the .desktop configuration.)
92
Release Notes
• J0693: When launching DiffMerge from a Terminal window on Ubuntu, you may get the following
warning message:
This refers to a missing system library and appears to be harmless. See https://
bugs.launchpad.net/ubuntu/+source/quickly/+bug/853232 [https://bugs.launchpad.net/ubuntu/+source/
quickly/+bug/853232] for details. Installing the following package quiets the message:
• J4544: Some of the CLC and HG examples in the manual still referred to DiffMerge.exe rather than
sgdm.exe.
• J5173: Fixed shell extension to not call DestroyMenu() on the parts of the context menu for better
compatibility with 3rd-party shell replacements.
• X2475: Fix typo in the README file distributed with the DMG regarding the name of the man-page.
• J9340: Updated Makefile to force 10.6 SnowLeopard compatibility when building on a Lion system.
--with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-
version-min=10.6
• Updated company and product logos. (For the 3.3.1 release the screenshots in the manual were not
updated.)
• Fixed the Find and GoTo Dialogs to put initial focus in the search field.
• Added instructions for using DiffMerge as an external diff/merge tool with Mercurial.
• On Linux, we now have both 32-bit and 64-bit builds for both Fedora and Ubuntu. (Item:15100,
Item:15300) You should now be able to use the appropriate per-architecture DEB or RPM and not have
to force install the 32-bit version on a 64-bit machine.
• Updated RPM and DEB installers to add DiffMerge to the Start Menu on both types of systems.
93
Release Notes
• On Windows, we now have 32-bit and 64-bit builds. These are distributed in new per-architecture MSIs.
In the past we had 1 installer that installed the 32-bit EXE and either the 32- or 64-bit Explorer extension
DLL. Now we have per-architecture MSI installers and greatly simplified the setup. The new 32-bit MSI
can only be installed on a 32-bit system. The new 64-bit MSI can only be installed on a 64-bit system.
• Created unique GUIDs for the 32- and 64-bit Explorer extension DLLs so that both may be installed
at the same time on a 64-bit system. The 64-bit MSI was updated to install BOTH versions of the
DLL so that it available to both the 64-bit Windows Explorer and any 32-bit Explorer-like applications.
(Item:15288)
• The core DiffMerge components are now built into a Merge Module MSM package that is simply
included by the published stand-alone DiffMerge MSI installer. While this alone is not a user-visible
change, it does change how the core DiffMerge components are installed on the system so that they
can be shared by other SourceGear products. These are now installed in Program Files/SourceGear/
Common/DiffMerge rather than Program Files/SourceGear/DiffMerge. In the past, Vault installed a
private copy of the DiffMerge executable in the Vault installation directory. Future versions of Vault
will be able to use the shared version. And by sharing the core DiffMerge components, it also means
that they will be updated whenever any of the products are updated.
• The stand-alone DiffMerge MSI installer was changed to be a thin wrapper around the core/common
DiffMerge components (in the MSM). Since the MSI is a publicly visible package with a published
version number, that version number will appear in the Add/Remove Programs Control Panel under
the entry for DiffMerge. But you may have more recent shared components on the system if another,
more recent SourceGear product is also installed. You can always refer to the DiffMerge About Box to
determine if you have newer shared components installed.
• The name of the DiffMerge EXE was changed to "sgdm.exe". In the past the name of EXE was either
"DiffMerge.exe", "sgdm.exe", or "sgdm3.exe" depending upon whether it was distributed in the stand-
alone package or bundled with another product. With the change to a shared component strategy, it
was changed to "sgdm.exe". This also avoids a collision with a program named "diffmerge.exe" that is
distributed as part of Visual Studio.
• The new MSI installer always does a per-machine install. It always installs the Windows Explorer
extension DLL. And it adds "Program Files/SourceGear/Common/DiffMerge" to the system PATH
environment variable.
• The various InstallPath keys in the Registry were moved to likewise be common/shared. See [HKLM]/
SOFTWARE/SourceGear/Common/DiffMerge/Installer. And in particular: [HKLM]/SOFTWARE/
SourceGear/Common/DiffMerge/Installer/Location.
• Bug Fix: Font Dialog appear and immediate disappear problem on OS X 10.6. (Item:15271) This was
a problem in wxWidgets and resolved by the upgrade to 2.8.12.
• Placed a copy of the diffmerge.sh shell script inside the .APP so that programs (such as Veracity) can
use it even if you don't install the script in /usr/bin.
• There is NO 64-bit version of DiffMerge for the Mac because wxWidgets does not support 64-bit (as
of 2.8.12 at least).
94
Release Notes
• The Mac version now ships in PKG package in addition to DMG format.
The Folder Window now has 3 different methods for compairing pairs of files:
• The original, exact (byte-for-byte) method that marks files as identical or different.
• A new Simple Equivlance method that can ignore whitespace and EOL characters and mark files as
identical, equivalent, or different.
• A new Ruleset-based Equivalence method that uses some of the Ruleset settings to mark files as
identical, equivalent, or different.
A new button was added to the Folder Window toolbar to show/hide equivalent files and a new page was
added to the Options and Ruleset Dialogs to help you configure this.
[3] When the /result option is used, DiffMerge now exits with an exit status that reflects the state of
the merge (MERGE-RESOLVED, MERGE-ABORTED, ERROR, etc.)
[4] Added support for saving the contents of a Folder Window to a file. This creates a UTF-8 CSV
containing the rows currently displayed in the window (respecting the various Show/Hide toolbar buttons).
Other Improvements:
• Support for EI on 64 bit XP and Vista. DiffMerge is still a 32 bit application and runs on 32 and 64
bit systems. However, the EI DLL which hooks into Windows Explorer must be the same bit-ness as
the platform. This release contains 2 versions of the DLL.
• Support for Vista and Windows 7 User Account Control (UAC). You can now register and unregister
the DLL from the Options Dialog. It will now prompty for elevation and perform the actual work in
an elevated child process. You no longer have to launch DiffMerge with elevation to do this.
• When 2 items are selected, the context menu is changed to have “Compare A with B” and “Compare
B with A” menu items to try to avoid the need for the SWAP button on the File Open Dialog.
• When 1 item is selected and you choose to compare the file with one from the remembered list,
DiffMerge checks the file date stamps and opens the File Open Dialog with the newest file on
the right.
• Fixed the alignment of our icon in the EI context menu to match other installed extensions.
95
Release Notes
• Updated the list of ignored file suffixes in the Folder Window to include lots of binary file types.
• Major overhaul of the DiffMerge Manual. Updated text to reflect the 3.3.0 release. Converted text to
DOCBOOK. Updated all screenshots.
• Added ADVANCED bit to wxRegEx objects created to parse regular expressions in various dialogs.
This allows the expressions you enter to use the advanced regex features without having to explicitly
add the “***:” syntax.
• Updated the “More From SourceGear” documents and the toolbar icon.
• Added the ability to switch between vertical and horizontal panel layout in File Diff and File Merge
windows. Previously, file panels in these windows were shown side-by-side with a vertical splitter
between them. You can now toggle between that mode and horizontal mode, where panels are shown
above and below. This is useful when your files have long lines and you can’t see the entire line without
horizontally scrolling.
• We now detect binary files (files containing a NUL byte) and give a warning and stop. This keeps us
from showing artifically truncated files in the windows.
• Made the “multi-line intra-line analysis” adjustable for performance reasons. A setting for this can be
found on the “Detail Level” page of the Options dialog. There is a large discussion on this feature in
the DiffMerge manual.
• Added External Tool feature. DiffMerge can now be configured to invoke an external, third-party tool
for various types of files (based upon the file suffixes). This allows you, for example, to select special
tools for XML or Word documents. You can then double-click on a pair of files in a folder window and
have the external tool launched to compare them. For more details see the DiffMerge Manual.
Other Improvements:
• Use the suffix of the /result pathname (in addition to the suffixes of the 3 input pathnames) when
searching for an ruleset. This helps in the case when 3 temp files are used as input to a merge.
• Use the suffix of the /result pathname (in additional to the suffixes of the 3 input pathnames) when
searching for an external tool. This helps in the case when 3 temp files are used as input to a merge.
• Added work-around on Windows for Win32 TextOut() limitations when drawing extremenly long
(>4096 character) lines in the file drawing code.
• Added alternate cut/copy/paste keyboard shortcuts for Windows and Linux versions. We now support
Ctrl+Insert, Shift+Insert, and Shift+Delete.
• Added code to Mac version to try to bring DiffMerge window to the foreground when we are launched
from the command line.
• Added “files are different/same” information to the “binary files cannot be loaded” dialog by doing a
raw comparison of the files.
96
Release Notes
• Turned off EXPAND_ENV_VARS in the Windows version so that ‘$’ characters in pathnames are not
interpreted. This was causing problems when dollar signs and backslashes were both present.
• Fixed problem in “Shell Extension\Approved” registry settings that was preventing explorer integration
from working on some Windows systems.
• Allow /dev/null as command line argument on Linux and Mac versions. This was failing because
the file-or-folder tests were failing because /dev/null is a not a regular file.
• Fixed crash when DiffMerge was given a pathname to a non-existent file and the pathname contained
a ‘%’ character.
• Added registry keys containing the path to the installation directory and the DiffMerge
executable: HKLM\SOFTWARE\SourceGear\SourceGear DiffMerge\InstallDir and
HKLM\SOFTWARE\SourceGear\SourceGear DiffMerge\Location
• Fixed how ruleset chose the actual character encoding for a set of files when it was set to “Use System
Local/Default Encoding”. Previously we were taking the value from the (grayed) “Named Encoding”
field when we shouldn’t be.
• Upgraded DiffMerge to use wxWidgets version 2.8.7 (from 2.8.3). This fixes the crash in glibc reported
on Ubuntu when accessing the menu, so you shouldn’t need the G_SLICE workaround.
• Fixed crash on Windows when clicking and dragging the black bars in the glance window to the top
of the screen.
• Fixed problems with how we create the Shell/Explorer Integration context menus on Windows that was
in certain circumstances causing files to appear multiple times in the context menu.
Major Improvements:
Added integration with Windows Shell/Explorer. A 'Compare with DiffMerge' menu item was added to the
Windows Explorer right-mouse context menu for files and folders. This feature can be enabled/disabled
from the Options dialog.
The .MSI installer is now generated using Advanced Installer. This fixed several installation-related
problems, especially on Vista. Administrative privileges are still required for installation, but under Vista,
the installer will use the privilege elevation mechanism so that you don't need to be logged in as an
administrator to start the installation. If you do not have administrator access to your machine, please use
the .ZIP package.
97
Release Notes
Fixed various crashes when windows were closed using the ESC key while the mouse was captured. Fixed
crash after auto-merge. Fixed various crashes on OS X when comparing files or folders whose pathnames
contained special characters.
Added the ability to use DiffMerge as a command line tool and produce traditional or Unified differences
of two files to an output file rather than opening a window. The output is compatible with GNU diff(1)
and patch(1).
Added File | Save As... feature to editable windows. The editable file is written to the new pathname and
the window titles are updated. Changed behavior of /result:pathname to behave like 'Save As' (and
re-title windows) whenever possible.
Added code to attempt (after prompting) to override the on-disk file permissions when trying to write to
a file that is read-only.
Clicking and dragging in the glance window on the left now cause the file windows to scroll; previously
we only scrolled the file windows on clicks.
Other Improvements:
• Added section to manual giving information on integrating DiffMerge with Microsoft TFS and
TortoiseSVN.
• Added support for uppercase command line switches; these behave identically to lowercase ones.
• Fixed problem where an extra EOL character was being inserted into the edit document when applying
a patch into an initially empty document.
• Added XML Ruleset to the set of builtin rulesets; you may have to hit Restore Defaults on the Rulesets
page before you see it (but this will delete any custom rulesets that you have created).
• Update the installation instructions in the manual to include information for the .ZIP package version
on Windows.
• Added an example shell script to show how to run DiffMerge from the command line on OS X and
updated manual. This can be installed in /usr/bin or /usr/local/bin if desired. Thanks to Curtis Thompson
for suggesting the need for this. See http://blog.iffy.us/?p=33.
• Added a standard MAN page to the Mac distribution. See the Readme.txt for more informatin.
• Added filename and panel name to the Error dialog that informs you that the file could not be imported
using the named character encoding.
98
Release Notes
• We now warp the edit view (in addition to the reference view) to the first change when a window is
created.
• Fixed initial focus/selection on Go To Dialog. And changed how we select the text on the destination
line so that the caret is at the beginning of the destination line.
Improvements:
• Alt+Down and Alt+Up to jump to the next and previous changes. (These are in addition to the F7
and Shift+F7 keys already defined.)
• Alt+Left and Alt+Right to apply the highlighted patch to the file being edited (and automatically
advance to next change if 'Automatically Advance' enabled in the options dialog). These were previously
only available via the right-mouse context menu and the toolbar.
• Ctrl+Alt+Left and Ctrl+Alt+Right to apply the highlighted patch to the file being edited and
advance to the next change.
Also by popular request, fixed/improved the initial placement/size of new windows, both between sessions
and as additional windows are created. This includes remembering the maximized state, cascading
subsequent windows, and better placement when multiple monitors are present.
Added a local web page containing information about SourceGear to the stand-alone version of the
program.
In addition to the usual Windows .MSI installer package, created a .ZIP package. This allows DiffMerge
to be used by simply unpacking the .ZIP file and running DiffMerge.exe and without running any kind
of installer. This can be used to run DiffMerge from portable drives or on systems where you don't have
administrator access.
DiffMerge.exe looks for the various help files in the same directory as the .EXE, so for best results, please
maintain the package directory structure and run DiffMerge.exe from the package directory.
99
Release Notes
Please note that this version uses the registry (HKCU only) to store per-user configuration information,
last window geometry, recently used files, and etc. So it does not completely satify the portable application
[http://en.wikipedia.org/wiki/Portable_application] definition; but this is a first step.
This is a new implementation of diff/merge functionality and is based upon the wxWidgets [http://
www.wxWidgets.org] library.
This version replaces a previous Windows-only implementation that was shipped with SourceGear Vault
3.5.
This version recognizes the same command line arguments as the previous version and can be used
with Vault 3.5 by simply installing the Windows stand-alone version and changing the pathnames in the
Program fields in the Diff/Merge section of the Vault options dialog.
• Graphically shows interline and intraline differences between two or three files.
• Allows changes between files to be interactively applied using keyboard and mouse.
• Suports automatic three-way merge (when safe to do so) of changes between two branched file versions
into common ancestor version.
New file window features in this version not available in previous version:
• Offers three display modes: everything, differences only, and differences with context.
• Supports file printing (and print preview) in all three display modes.
• Offers two views of files when editing: the currently edited version and a reference view of the files
as originally loaded.
• Supports 'Display Invisibles' feature to show whitespace and end-of-line (EOL) characters.
• Supports 'Manual Alignment Markers' feature allowing vertical alignment of files to be overridden.
• Supports configurable 'Rulesets' feature allowing many program behaviors to be controlled based upon
file type (suffix):
100
Release Notes
• Supports all EOL conventions and can ingore or respect them based upon file type.
• Allows definition of 'Comment', 'Literal', and 'Regular' Contexts based upon file syntax.
• Allows changes within each type of context to be defined as 'Important' or 'Unimportant' and
treated differently; for example, changes in case or whitespace within comments can be marked
'Unimportant' and handled differently than changes within string literals.
• Supports omitting/ignoring lines matching specified patterns (such as page headers) from the
difference analysis; these may be shown or hidden from the display.
• Supports 'Inter-line Smoothing' and 'Intra-line Smoothing features allowing groups of nearby changes,
separated only by a short equal section, to be aggregated into a single change.
• Displays vertically lined up changes within files (using voids) instead of using arrows in the gutter to
identify the corresponding parts.
• Detects when files on disk have changed and offers to reload them.
• Performs side-by-side comparison of two folders, showing which files are only present in one folder or
the other, as well as file pairs which are identical or different.
• Supports file suffix and folder filters to eliminate generated files from analysis.
New folder window features in this version not available in previous version:
101
Appendix A. SourceGear License
Agreement
IMPORTANT – READ CAREFULLY. This License Agreement (Agreement) is a legal agreement
between you (either an individual or a single entity) and SourceGear LLC for SourceGear DiffMerge,
which includes computer software and online or electronic documentation and may include associated
media and printed materials (SOFTWARE PRODUCT or SOFTWARE). By installing, copying, or
otherwise using the SOFTWARE PRODUCT, you agree to be bound by the terms of this Agreement. If
you do not agree to the terms of this Agreement, do not install or use the SOFTWARE PRODUCT.
The SOFTWARE PRODUCT is protected by copyright laws and international copyright treaties, as well
as other intellectual property laws and treaties. The SOFTWARE PRODUCT is licensed, not sold.
1. GRANT OF LICENSE. This Agreement grants you certain limited, non-exclusive rights. SourceGear
LLC reserves all rights not expressly granted to you.
2. COPYRIGHT. All rights, title, and copyrights in and to the SOFTWARE PRODUCT (including, but not
limited to, any images, photographs, animations, video, audio, music, text, and "applets" incorporated into
the SOFTWARE PRODUCT) and any copies of the SOFTWARE PRODUCT are owned by SourceGear
LLC or its suppliers. The SOFTWARE PRODUCT is protected by copyright laws and international treaty
provisions. Therefore, you must treat the SOFTWARE PRODUCT like any other copyrighted material,
except that you may make one copy of the SOFTWARE PRODUCT solely for backup or archival purposes.
You may not copy the printed materials accompanying the SOFTWARE PRODUCT.
3a. Limitations on Reverse Engineering, Decompilation, and Disassembly. You may not reverse engineer,
decompile, or disassemble the SOFTWARE PRODUCT, except and only to the extent that such activity
is expressly permitted by applicable law notwithstanding this limitation.
3b. Rental. You may not rent or lease the SOFTWARE PRODUCT.
3c. Software Transfer. You may permanently transfer all of your rights under this Agreement, provided
you retain no copies, you transfer all of the SOFTWARE PRODUCT (including all component parts, the
media and printed materials, any upgrades, and this Agreement), and the recipient agrees to the terms of
this Agreement. If the SOFTWARE PRODUCT is an upgrade, any transfer must include all prior versions
of the SOFTWARE PRODUCT.
3d. Termination. Without prejudice to any other rights, SourceGear LLC may terminate this Agreement
if you fail to comply with the terms and conditions of this Agreement. In such event, you must destroy all
copies of the SOFTWARE PRODUCT and all of its component parts.
3e. Distribution. You may not distribute this product, or any portion thereof, or any derived work thereof,
to anyone outside your organization.
4. EXPORT RESTRICTIONS. You agree that neither you nor your customers intend to or will, directly
or indirectly, export or transmit the SOFTWARE PRODUCT or related documentation and technical data
to any country to which such export or transmission is restricted by any applicable U.S. regulation or
statute, without the prior written consent, if required, of the Bureau of Export Administration of the U.S.
Department of Commerce, or such other governmental entity as may have jurisdiction over such export
or transmission.
102
SourceGear License Agreement
5. U.S. GOVERNMENT RESTRICTED RIGHTS. The SOFTWARE PRODUCT and documentation are
provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to
restrictions as set forth in subparagraph (c)(1)(ii) of The Rights in Technical Data and Computer Software
clause at DFARS 252.227-7013 or subparagraphs (c)(1) and (2) of the Commercial Computer Software -
Restricted Rights at 48 CFR 52.227-19, as applicable. Manufacturer is SourceGear LLC, an Illinois LLC.
MISCELLANEOUS
This Agreement is governed by the laws of the State of Illinois. Should you have any questions concerning
this Agreement, or if you desire to contact SourceGear LLC for any reason, please access our website at
http://www.sourcegear.com or contact us at [email protected].
NO WARRANTIES. To the maximum extent permitted by applicable law, SourceGear LLC expressly
disclaims any warranty for the SOFTWARE PRODUCT. The SOFTWARE PRODUCT and any related
documentation are provided "as is" without warranty of any kind, either express or implied, including,
without limitation, the implied warranties of merchantability or fitness for a particular purpose. The entire
risk arising out of use or performance of the SOFTWARE PRODUCT remains with you.
LIMITATION OF LIABILITY. SourceGear LLC entire liability and your exclusive remedy under this
Agreement shall not exceed five dollars (US $5.00).
____________________________
103