This chapter provides an overview of the Compare Tool's features and capabilities. For more detailed information on how to use this tool, choose Help: On Compare. You can print Help topics using the HyperHelp Viewer.
Compare allows you to compare the contents of two files and
display the results of the comparison in a window, using either
lines or filled polygons to indicate the differences between the
two files.
It is similar to
dxdiff
, which is
available as a standalone tool on Digital UNIX systems.
Key elements are the major window panes running from the top to the bottom of the window:
Displays the current project and working directory.
Presents a graphical view of the highlighted differences between the selected files in a scrollable window.
Let you move through the differences.
Displays information messages and Quick Help on menu items when you press and hold MB1 on the item.
Compare does the following:
Provides an integrated graphical interface
to
diff
Displays differences between two files or two revisions
Allows you to move through the differences (if the file is too large for the window)
Displays line numbers in the difference display area
Allows you to open a new window and compare a different pair of files
Allows you to merge the differences of two files interactively based on a common parent file
Integrates with the Code Manager and FUSE Editor
Compare assumes that the following system utilities are present in your directory path:
diff
sh
You must be able to execute these utilities in command-line mode without having to specify a relative pathname. For example:
% diff test1.c test2.c
Compare, like
diff
, allows you to perform
a comparison of the contents of text (ASCII) files only.
You can start the Compare tool in several ways:
Use the command line.
If you have CDE installed, use the Compare icon.
Use the FUSE Control Panel once FUSE is running.
Use the Tools menu from most FUSE tools.
You can start Compare from the command line using the following command:
% fusecompare [-Xt-Options] [-cwd] [file-1] [file-2]
See Appendix
Appendix D
and the specific
reference pages for the command syntax and options.
Appendix
Appendix D
also has syntax for the
fusemerge
command, which starts the Compare tool in merge mode.
If the Control Panel is not running, it starts automatically as a minimized icon. If FUSE is already running, Compare is placed in the current project..
When you have CDE installed, FUSE provides a FUSE application group icon and icons for the individual tools that make up the FUSE environment.
To invoke Compare:
Double click on the Application Manager icon in the CDE Front Panel to display the application group icons.
Double click on the FUSE application group icon to display the icons in the FUSE application group.
Double click on the Compare icon to start the tool.
To start Compare from the FUSE Control Panel, select Compare from the Tools menu. Like all tools, Compare inherits its configuration data from the project settings.
Most FUSE tools have a Tools menu. To start a tool, select the tool from the Tools menu.
To perform a comparison between the contents of two text files:
Step | Action |
1 |
Choose Compare... from the File menu. Compare displays the Compare dialog boxes, allowing you to specify the respective locations of the files to be compared. |
2 |
In the Left File field, enter the full pathname and file name of one of the files to be compared. Optionally, use the Pick button to display Select Left File dialog box and choose the pathname and file name. |
3 |
In the Right File field, enter the full pathname and file name of the second file to be compared. Optionally, use the Pick button to display Select Right File dialog box and choose the pathname and file name. |
4 |
Optionally, click on the New Window toggle to display the results of the compare in a new window. This is useful when you want to compare the contents of numerous pairs of files. |
5 |
Click on OK. |
Compare displays the contents of the two files in the main window, using lines in the difference display area to highlight the differences between the contents of the files.
The items in the Display menu allow you to alter Compare's display mechanism so that you can interpret the information in the main window more easily. There are three areas in which you can customize the main window:
Moving between differences
Compare allows you to restrict scrolling activity (either vertical or horizontal) to just one of the two selected files, temporarily deactivating scrolling of the other file. By default, scrolling of the two files is linked.
You can also use the Next Diff and Prev Diff buttons to move backward and forward from one difference to the next.
Highlighting difference blocks
You can choose between lines and filled polygons to highlight the difference blocks in the difference display area. By default, Compare uses filled polygons.
Displaying line numbers
You can display line numbers at the beginning and end of each difference block. By default, Compare displays line numbers.
For information on how to customize these features, see the online Help for Compare.
The Options menu in the Compare main window allows you to modify various features of your local Compare environment, such as colors, fonts, and the size and position of tool windows.
After displaying the differences between two files, you can invoke the FUSE Editor. There are several ways to load a file into a FUSE Editor buffer. Choose one of the following:
Choose the Annotate Left option from the Edit menu; FUSE loads the left file into an editor buffer. It then annotates all the difference lines, using <, and positions the cursor at the beginning of the first line of the first difference block.
Choose the Annotate Right option from the Edit menu; FUSE loads the right file into an editor buffer. It then annotates all the difference lines, using >, and positions the cursor at the beginning of the first line of the first difference block.
Choose either Edit Left or Edit Right from the Edit menu; FUSE loads either the left or right file into the editor buffer.
Double click on a specific line of the selected file. FUSE loads the file into a buffer and positions the cursor at the corresponding point in the file. In this way, you can browse through a file in a FUSE Editor buffer by clicking on the difference lines in the Compare window.
At this point, you can then edit the file using all the functionality normally associated with the FUSE Editor.
Compare allows you to merge the differences of two files based on a parent file (that is, a common ancestor). When you merge two files, Compare displays the differences as with a normal Compare operation, and allows you to choose which differences from the left and the right file that you want to merge into a new file. It also shows any conflicts between the files and lets you step through the conflicts. For additional information on how to perform a merge operation, see the online Help for Compare.