Examining Differences |
16 |
![]() |
Moving Between Differences
You can navigate through differences using either the Next and Prev buttons or the up arrow and down arrows. Merging automatically moves to the next difference immediately after you resolve the current difference.
Resolving Differences
A difference is represented by a blank line in the merged (output) file in the lower text pane. To resolve a difference, you edit the line displayed there by either:
The content of each line in the example helps to identify whether or not it was changed, and how. The ancestor file contains only twelve lines and is shown in Code Example 16-1.
Code Example 16-2 shows the contents of file_1. This file is identical to matriarch with the following exceptions:
Code Example 16-2 Descendant File (file_1) |
2 This line is in all three files
3 This line is deleted in file_2
4 This line is in all three files
&&& Added to file_1 &&&
5 This line is in all three files
6 This line is modified in file_1 from matriarch
7 This line is in all three files
8 #&# Changed in file_1 and file_2 #&#
9 This line is in all three files
10 This line is changed in file_2
11 This line is in all three files
12 This line is in all three files
Code Example 16-3 Descendant File (file_2) |
1 This line is deleted in file_1
2 This line is in all three files
4 This line is in all three files
5 This line is in all three files
6 This line is altered in file_2 from matriarch
7 This line is in all three files
8 #&# Changed in file_1 and file_2 #&#
9 This line is in all three files
10 ### Changed in file_2 ###
11 This line is in all three files
### Added to file_2 ###
12 This line is in all three files
![]() | Go to the directory in which matriarch, file_1, and file_2 are stored.
Type the following to start Merging in background mode and load the
three files:
|
In the upper left of the window, Merging has reported finding seven differences, of which only one remains unresolved--six differences were resolved by automerging, and are marked by glyphs in outline font.
The meaning of the glyphs is as follows: a vertical bar means a change in the marked line, a plus sign signifies a line added, a minus sign means a line was deleted. Unresolved states are marked by solid glyphs, unresolved by outline. These glyphs are highlighted in color except when the color map is full. The default significance is: red indicates a change, green indicates a deletion, yellow shows an addition.
The unresolved difference (line 6) is marked by a vertical bar.
Proceed to the next difference by choosing the down arrow above the appropriate file, or Navigate: Next Difference. The next difference becomes the current difference.
Proceed through the differences by clicking on the down arrow.
Auto Merge preserves a change that was made to one file if no change was made in the other file.
When a difference has not been resolved by Auto Merge, as indicated by the solid highlighted glyph next to the lines involved in the difference, you need to resolve the difference by making a choice. The vertical line indicates that the line has been changed (as opposed to added or deleted). In this case, Auto Merge failed because the same line was changed differently in the two files, and Merging could not decide which change was more valid.
You could resolve this difference in one of the following ways:
>>> This line edited by hand <<<Choose the Edit:Mark Selected as Resolved. This menu item marks the difference as resolved. In this example there are no more unresolved differences, so the next difference remains the current one.
Note that the message in the upper left part of the window now indicates that all differences have been resolved. Nevertheless, proceed to verify the automerged differences.
Continue through the differences by clicking on the down arrow.
The final difference results from a line that was added only to file_2. Merging places the new line in the output file just as it did when a new line was added to file_1, which resulted in the third difference.