Compare editor

You can view the differences between two files by comparing them. You can compare different files, you can compare versions in the Workbench with versions in the repository, or with the local edit history.  In some cases you can compare three files (when a common ancestor exists).

After a comparison is carried out, the compare editor opens in the editor area. In the compare editor, you can  browse through all the differences and copy highlighted differences between the compared resources. You can save changes to resources that are made in the comparison editor.

Compare editor allows for two kind of navigation: using differences or changes. A change is a portion of text that has been modified within the line, and the difference is a section of file consisting of one or more lines, and can contain many changes.

 Differences and changes.

Differences are marked with blue color, changes with red.

Here is how the compare editor looks when you open it from a CVS Workspace synchronization..

 Picture of 3-paned editor. Top pane compares project structure; bottom 2 panes (side by side) compare lines of source.

Toolbar

The toolbar of the Compare editor includes the following buttons:

Control Visibility of Ancestor Pane
There are two conditions under which a three way compare will occur, both when using the Team version management support: when comparing a file that is in conflict, and when comparing a file being merged from a branch. In both cases, the system will determine a common ancestor in the repository to compare the conflict or merge against. This button determines the visibility of the third editor. By default, the ancestor pane is not visible.
Perform Three way/Two way Compare
The compare editor can be toggled between performing a three way compare or a two way compare which ignores the common ancestor.
Copy All from Left to Right
Copies the entire contents of the file in the left pane into the file in the right pane, making the contents of the two files identical. 
Copy All Non-Conflicting Changes from Right to Left
Copies all the non-conflicting changes from the right pane into the left pane. Conflicting changes must be copied individually.
Copy Current Change from Left to Right
Merges changes in two files by copying the highlighted change in the left pane into the highlighted fragment on the right.  This will overwrite the highlighted fragment in the right pane.
Copy Current Change from Right to Left
Does the opposite of the one just described.
Select Next Difference
Highlights the next difference that is found between the compared resources.
Select Previous Difference
Highlights the previous difference that is found between the compared resources.
Select Next Change
Highlights the next change that is found between the compared resources.
Select Previous Change
Highlights the previous change that is found between the compared resources.

Related concepts
Synchronizing with a CVS repository
Three way comparisons

Related tasks
Comparing resources
Synchronizing with the repository
Merging changes in the compare editor
Resolving conflicts
Setting preferences for comparing files
Comparing resources with repository versions