The Diff utility in MPLAB X® compares two files and displays the results in textual and graphical views. The following will explain how to access the Diff Utility, How to view Diff utility results and other features offered by MPLAB X® Diff utility.
Accessing Diff Utility
To access the Diff utility to compare two files -
From the Project tree, double click on the filename that you want to compare with. This will open the file in the editor window.
Select second file that you wish to compare with the first and Click 'Diff'.
By default, this will generate the graphical two-paned diff viewer that displays the two files side-by-side with the differences highlighted.
You can also select the Textual View mode by clicking on the Textual tab.
Some of the highlights of this view are
- The differences in the two files are highlighted with color code (Blue for actual differences, Green where blank spaces are not ignored and Pink where changes in inner white spaces are not ignored).
- Total number of differences are indicated on the top of the page
- The center arrows indicate locations of differences.
If you click on the center arrow, the file on right side instantly gets updated with the corresponding contents in the file from the left side.
The textual view displays the differences in a text format. The textual format is useful when the Diff file is to be shared with other users. MPLAB X® can use the textual Diff file and modify a file with the Diff file instantly.
DIFF Viewer Menu
The Graphical and Textual Viewer also has additional menu as shown below.
DIFF Viewer Options
Additional options in the DIFF view include the setting if the user wants to use the internal DIFF utility provided in the MPLAB X® or use external DIFF tool such as Windiff®.
Under Internal DIFF setting, user can also set the option to not use white spaces / changes within white spaces or case changes during DIFF. The diff results with these options selected are marked with color code as mentioned above.
The options menu can also be accessed within MPLAB X® menu by Tools > Options > DIFF tab.