Using the Diff tool
The Diff tool compares two files: a read-only base copy of the file and a working copy. It is integrated into Code Editor.
Comparing files
To select files to compare, select
.The Diff tool automatically selects the Diff base file and flags differences between the base file and the working copy with color-coded markups in the Code Editor gutter. Colors can be changed in preferences.
- Green - added lines
- Orange - modified lines
- Red - deleted lines
- Use Generated File
- The default for generated files, this option compares the document with the file generated by the application generator. This is the generated file before POINTs and BLOCKs are injected into the file. This option is made available only if the file has been generated.
- Use Repository File
- The default for versioned files, this option compares the document with the file in the repository for the current SVN version of the file. This option is enabled only if the file is versioned.
- Use File on Disk
- Compares the document with the contents of the file as it was on disk when the file was opened. If you select this option again after the file has been opened, the diff data will be refreshed by comparing the document with the actual content of the file on disk.
You can change the base file used with
.Specify how the tool compares white space and case in preferences.
Display modes
You can select a Diff display mode from the menu.- Normal View
- This view opens the file in normal editing mode.
- Diff View
- This view displays differences between the base file and working copy in a single pane document. This is also called single pane diff mode. New and modified lines are clearly marked by color. This view identifies the location of deleted lines, but does not display them.
- Diff View with Deleted Blocks
- This view displays differences between the base file and working copy in a single pane document with deleted blocks highlighted in red.
- Vertical Dual Diff View
- This view displays the two files vertically, with a left and right pane. It opens the base file (read-only) in the left pane and the editable working copy in the right pane. This is also called two pane diff mode.
- Horizontal Dual Diff View
- This view displays the two files horizontally, with a top and bottom pane. It opens the base file (read-only) in the top pane and the editable working copy in the bottom pane. This is also called two pane diff mode.
Example: Diff View
This figure shows Diff View. Lines 28-32 are marked with green blocks to indicate newly added lines. The orange block in the gutter of line 24 indicates a modified line (a new comment, highlighted in green, has been added to the existing line). The red line between line 22 and line 23 flag the location of a deleted line/lines.
Example: Vertical Dual Diff View
This figure shows Vertical Dual Diff View. Side-by-side comparison of the base file in the left pane and the editable working copy in the right pane give you a before and after record of changes. Red blocks in the gutter of the base file pane show the contents of lines deleted in the working copy.
Diff navigation
- First Difference
- Locate the first difference.
- Previous Difference
- Locate the previous difference.
- Next Difference
- Locate the next difference.
- Last Difference
- Locate the last difference.
Reverting a difference
To revert a difference, place the cursor in the line of marked code that you want to revert. Select
. The action replaces the difference in the working copy with the original values from the base copy. Select to Right to revert all changes.Restricting the differences shown
- Ignore case
- Ignore differences between uppercase and lowercase.
- Ignore all white space
- Ignore white space, including tab, vertical tab, form feed, carriage return, and space. For example, the following are treated as the same:
- Ignore space changes
- Ignore internal and trailing white spaces, but not spaces at the end.
- Try hard to find a smaller set of changes
- Show a smaller set of differences. You might want to select this option if your Diff output is too large, although it might cause Diff to run more slowly.
You can choose these options when you first select your two files, or use the toolbar at the bottom to add or remove options.
Command line option
Usegenerostudio
-diff file1 file2
at the command line to open the
given files in Diff mode.