Compare Directories Against a Base (3-Way)
The Compare Directories Against a Base (3-way) tool allows you to perform three-way comparisons on directories to help you identify and merge changes between multiple modifications of the same directory structure. It is especially helpful for teams that have multiple authors contributing documents to the same directory system. It offers information about conflicts and changes, and includes actions to easily merge, accept, overwrite, or ignore changes to the directory system.
How to Perform 3-Way Directory Comparisons
To perform a 3-way directories comparison, follow these steps:
- Select Compare Directories
Against a Base (3-way) from the Tools
menu.
Step Result: This opens a dialog box that allows you to select the 3 file sets that will be used for the comparison.
Compare Directories Against a Base File Set Chooser
- Select the file sets to be compared:
- Base directory - This is the original (base) file set before any modifications were made by your or others.
- Directory with your changes - This is the file set with changes that you have made. This file set will be displayed in the left panel in the comparison tool.
- Directory with changes made by others - This is the file set with changes made by others that you want to merge with your changes. This file set will be displayed in the right panel in the comparison tool.
- Click the Compare button to compare the file sets and open the comparison tool.
- Use the features and actions described in the next section to identify and merge the changes.
3-Way Directory Comparison Tool: Features and Actions
Compare Directories Against a Base (3-way) Tool
The 3-way directory comparison tool includes the following features and actions:
- Number of Changes and Conflicts
- The first thing you see in the tool is grand total of all the changes made by others, changes made by you, and the number of conflicts.
- Filter Buttons
- You can filter the list of modifications with the following toggle buttons:
- Show all files
- Use this button to show all modified and unmodified files, as well as conflicts.
- Show only files modified by you and others
- Filters the list to show all files that have been modified, including conflicts.
- Show only files modified by others
- Filters the list to only show the files that were modified by others.
- Show only files modified by you
- Filters the list to only show the files that were modified by you.
- Show only conflicting files
- Filters the list to only show files that contain conflicts.
- List of files
- This panel shows the list of files in the compared file sets based upon the filter
button that is selected. You can see the file path and its status. You can
double-click any file to open it in the file comparison panels (the file from your
file set is shown in the left panel while the file from the other file set is shown
in
the right panel). If you right-click a file in the list, you have access to the
following contextual menu actions:
- Show modifications (Double-Click)
- Opens the file in the comparison panels. The file from your file set is shown in the left panel and the file from the other file set is shown in the right panel. If the file only exists in one of the file sets, then the panel for the other file set is blank.
- Accept non-conflicting changes
- Merges all non-conflicting changes made by others (in the selected files) with your changes. For the files that were modified by both you and others, the tool will try to merge the changes automatically.
- Overwrite your changes
- Overwrites the changes you made to the selected files with the changes made by others.
- Ignore changes made by others
- Ignores the changes made by others to the selected files and keeps your changes.
- Accept all non-conflicting changes
- Click this button to accept all non-conflicting changes (in all files) made by others and merge them with your own changes. For the files that were modified by both you and others, the tool will try to merge the changes automatically.
- File Comparison Panels
- If you double-click a file in the list (or select Show
modifications from the contextual menu), the files are opened in this
file comparison section. The file from your file set is shown in the left panel and
the file from the other file set is shown in the right panel. The toolbar includes
the
following actions and options:
- Algorithm
- This drop-down menu allows you to select one of the following diff
algorithms to be used for file comparisons:
-
Auto - Selects the most appropriate algorithm, based on the compared content and its size (selected by default).
-
Lines - Computes the differences at line level, meaning that it compares two files or fragments looking for identical lines of text.
-
XML Fast - Comparison that works well on large files or fragments, but it is less precise than XML Accurate.
-
XML Accurate - Comparison that is more precise than XML Fast, at the expense of speed. It compares two XML files or fragments looking for identical XML nodes.
-
- Diff Options
- Opens the Files Comparison preferences page where you can configure various options.
- Perform Files Differencing
- Looks for differences between the two files displayed in the left and right side panels.
- Ignore Whitespaces
- Enables or disables the whitespace ignoring feature. Ignoring whitespace means that before performing the comparison, the application normalizes the content and trims its leading and trailing whitespaces.
- Synchronized scrolling
- Toggles synchronized scrolling. When enabled, a selected difference can be seen in both panels.
- Format and Indent Both Files (Ctrl + Shift + P (Command + Shift + P on OS X))
- Formats and indents both files before comparing them.
Use this option for comparisons that contain long lines that make it difficult to
spot
differences.
Note
When comparing two JSON files, the Format and Indent Both Files action will automatically sort the keys in both files the same to make it easier to compare. - Copy Change from Right to Left
- Copies the selected difference from the file in the right panel to the file in the left panel.
- Copy All Changes from Right to Left
- Copies all changes from the file in the right panel to the file in the left panel.
- Next Block of Changes (Ctrl + Period (Command + Period on OS X))
- Jumps to the next block of changes. This action is disabled when the cursor is
positioned on the last change block or when there are no changes.
Note
A change block groups one or more consecutive lines that contain at least one change. - Previous Block of Changes (Ctrl + Comma (Command + Comma on OS X))
- Jumps to the previous block of changes. This action is disabled when the cursor is positioned on the first change block or when there are no changes.
- Next Change (Ctrl + Shift + Period (Command + Shift + Period on OS X))
- Jumps to the next change from the current block of changes. When the last change from the current block of changes is reached, it highlights the next block of changes. This action is disabled when the cursor is positioned on the last change or when there are no changes.
- Previous Change (Ctrl + Shift + Comma (Command + Shift + M on OS X))
- Jumps to the previous change from the current block of changes. When the first change from the current block of changes is reached, it highlights the previous block of changes. This action is disabled when the cursor is positioned on the first change or when there are no changes.
- Ignore Nodes by XPath
- You can use this text field to enter an to ignore certain nodes from the comparison.
It will be processed as
XPath version 2.0. You can also enter the name of the node to ignore all nodes with
the
specified name (for example, if you want to ignore all ID attributes from the document,
you could simply enter @id). This field is only available when
comparing XML documents using the XML Fast or XML
Accurate algorithms.
Note
If an XPath expression is specified in the preferences page, that one is used as a default when the application is started. If you then enter an expression in this field on the toolbar, this one will be used instead of the default. If you delete the expression from this field, neither will be used. - First Change (Ctrl + B (Command + B on OS X))
- Jumps to the first change.
- Left-Side File (your changes)
- Above the panel you can see the file path and the following two buttons:
-
- Save
- Saves changes made to the file.
- Reload
- Reloads the file.
- Right-Side File (changes made by others)
- Above the panel you can see the file path and the following two buttons:
-
- Reload
- Reloads the file.
The line numbers on each side and colored marks on the right-side vertical stripe help you to quickly identify the locations of the differences. Adjacent changes are grouped into blocks of changes.
File Comparison Panels
The differences are also highlighted in several colors, depending on the type of change, and dynamic lines connect the compared fragments in the middle section between the two panes. The highlighting colors can be customized in the Files Comparison / Appearance preferences page, but the default colors and their shades mean the following:
- Pink - Identifies modifications on either side.
- Gray - Identifies an addition of a node in the left side (your outgoing changes).
- Blue - Identifies an addition of a node in the right side (incoming changes).
- Lighter Shade - Identifies blocks of changes that can be merged in their entirety.
- Darker Shade - Identifies specific changes within the blocks that can be merged more precisely.
You can edit the files directly in the left pane (your local changes). The two editors are constantly synchronized and the differences are refreshed when you save the modified document or when you click the Perform File Differencing button.
A variety of actions are available in the contextual menu in both editing panes. The tool also includes some inline actions to help you merge, copy, or remove changes. When you select a change, the following inline action widgets are available, depending on the type of change:
- Append right change to left
- Copies the content of the selected change from the right side and appends it on the left side.
- Copy change from right to left
- Replaces the content of a change in the left side with the content of the change in the right side.
- Remove change
- Removes the change from the left side.