The K Desktop Environment

2.5. Resolving conflicts

Conflicts may occur whenever you have made changes to a file which was also modified by another developer. The conflict is detected by CVS when you update the modified file. CVS then tries to merge the modifications commited by the other developer into your working copy. The merge fails if both your and his modifications are in overlapping parts of the file, and the CVS server issues and error message.

It is your job now to resolve these conflicts before you commit the file. CVS will refuse to commit any files with conflicts until they have been edited. Of course, you have a great amount of freedom when resolving a set of conflicts: you can for each conflict decide to take one of the two alternative versions. You can also decide that both approaches are are broken and rewrite a whole routine or the complete file from scratch.

In Cervisia's main view, files with conflicts are indicated with "Conflict" in the status column and with a red color. From the main view, you can of course resolve conflicts the traditional way: just doubleclick the file in question and edit it with your favourite editor. But you can also choose to use the dialog available via File->Resolve....


Figure 2-2. A screenshot of Cervisia's resolve dialog


On the top of the dialog, you see your version the file on the left hand side and the version in the repository on the right hand side. The differences between them are marked in red color. Below these two versions, you can see the merged version which will be saved as soon as you click the Save button.

You can switch between the differing sections by pressing << and >>. In the lower middle of the dialog you can see which section is currently marked. For example, 2 of 8 means that you are currently at the second differing section of 8 total. Now can can decide section by section which of the both versions you want to have in the merged file. By pressing A, you take over the version you edited. By pressing B, you take over the version from the repository.