Chapter 9. Comparing and merging documents

In large teams composed either of developers or technical writers, the usage of a shared repository for the source or document files is a must. Often many authors are changing the same file at the same time.

Finding what has been modified in your files and folders can be hard. If your data is changing, you can benefit from accurate identification and processing of changes in your files and folders with <oXygen/>'s new features: Compare files and Compare directories. These are powerful and easy to use tools that will do the job fast and thoroughly. With the new possibilities of differencing and merging, it is now easy to manage multiple changes.

<oXygen/> provides a simple means of performing file and folder comparisons. You can see the differences in your files and folders and also you can merge the changes.

There are two levels on which the comparison can be done, namely comparing directories or comparing individual files. These two operations are available from the Tools menu.

Also the comparison tool can be started using command line arguments. In the Oxygen installation folder there are 2 executable shells (diffFiles.bat and diffDirs.bat if running on Windows). You can give one or two command line arguments to each of these shells.

For example, to start the comparison between 2 directories on Windows use:

diffDirs.bat "c:\Program Files" "c:\ant"

Note that if there are spaces in the path names, the paths need to be surrounded by quotes. Also one argument can be missing in which case the second directory will be chosen manually by the user.

The same goes for the files diff utility as well.

 Directories Comparison

The directories comparison result is presented as a tree of files and directories.The directories that contain different files are expanded automatically, so you can focus directly on the differences. You can merge the directories' contents using the copy actions or you can compare and merge the different files by double-clicking on them.

 

Figure 9.1. The Compare directories window

The Compare directories window

 The directories comparison user interface

The directory comparison user interface is comprised of the following components:

 The Operations Menu

This menu contains the functions available for directories comparison:

 

Figure 9.2. The Operations Menu

The Operations Menu

OperationsPerform directories differencing : Performs the comparison of the directories.

OperationsPerform files differencing : Performs the comparison of the files.

OperationsCopy change from left to right : Copies the selected file or folder to the corresponding directory from the right (only available if the file or folder to be copied exists in the left directory)

OperationsCopy change from right to left : Copies the selected file or folder to the corresponding directory from the left (only available if the file or folder to be copied exists in the right directory)

OperationsClose (Ctrl+W) : Closes the Compare directories window.

 Compare Toolbar

 

Figure 9.3. The Compare toolbar

The Compare toolbar

The available functions are presented in the Operations menu.

For the Algorithm and Diff Options buttons look below at File Comparison / Compare Toolbar

 File Filter options

File filters are available; you can choose to see the differences only for XML files, or XSL files for instance.

 

Figure 9.4. File filter

File filter

 Directories Selector

 

Figure 9.5. The Directories Selector

The Directories Selector

To open the directories you want to compare, select a folder from each "Browse for local file" button. <oXygen/> keeps track of the folders you are currently working with and those you opened in this window. You can see and select them from the two combo-boxes.

 The comparison result

The directory comparison result is presented using a tree of files and directories.

 

Figure 9.6. Comparison result

Comparison result

For the files and folders from the compared directories you can see their name, size and their modification date.

If a file or a folder exists only in one of the compared directories, the name of the file or folder will be blue and marked with an "X".

If a file exists in both directories but the content is different, the name of the file will be red and marked with a "not-equal" sign. <oXygen/> offers an useful option here: you can double-click the line marked with the "not-equal" sign and a new "File Content Comparison" Window will be opened, showing the differences between the two files.