Code conflicts will arise when the local copy has different contents in the same location as the content that is present in the server.
The resolution of conflicts in version control systems is a painful fact that every developer must face sooner or later.
Let's check how to solve code conflicts with Subversion and NetBeans.
For more information on how to setup NetBeans and Subversion, please refer to the first Getting Ready section at the beginning of this chapter.
How to do it...
As mentioned in the introduction of this recipe, a conflict will arise whenever different code is present in the same line in both local and remote copies. In the previous screenshot we have introduced conflicts.
NetBeans presents the developer with a window divided in three parts. The Local Working File is the file which we are editing and, most probably, started the conflict; the Remote File is the one in the Subversion server; and the Result After Merge, the lower pane, is how the file will look after the conflict is resolved.
In our particular case we resolve the conflict by accepting the changes from the server and merging them, automatically, when the Accept button on the Remote File side was clicked.
In the following screenshot, blue indicates changes since the first version, and green that changes that have been added since the previous version. Red indicates lines removed since the previous version.
Resolving conflicts turns the previously red highlighted sections of code into blue and green.
3.144.116.69