This document attempt to explain what conflicts are, the ways to solve them, and the tools are available to do so.
When working with GeneXus and GeneXus Server using the Merge Mode, conflicts between changes made to the same object by different developers can occur.
A Conflict occurred when changes made by one developer overlap with the changes made by another. Most times there is no automatic way to solve the conflict, so the developer must resolve them manually.
Conflicts will happen when making an Update operation:
========== Partial Update started ==========
Updating Attribute 'CountryInitialsName'... 'ShortCountryName' renamed to 'CountryInitialsName'
warning: Conflict in Attribute 'CountryInitialsName'. The object was updated with the server revision.
Compare with the previous revision and solve the conflict manually (Attribute 'CountryInitialsName', View differences)
Partial Update Success
Also, a warning note will be displayed in the Result tab of the Update dialog:
Note: 'The object was updated with the server revision' means that when GeneXus Server finds a conflict, a new revision with the server-side status will be created on the local Knowledge Base.
The objects in conflict will be maintained in the Pending for commit list marked in red until the conflict is solved.
There are three possible scenarios:
- Merge: This is the most common scenario, where the changes made locally and on the server side must be merged. In this scenario, the developer must solve the conflict manually by checking both sets of conflicting changes and manually reapply the changes made locally to generate a new revision of the object on the local Knowledge Base.
Once the manual merge it's done, the developer can safely execute a new Commit operation to update the objects in the GeneXus Server repository.
- Maintain local changes only: to do so, the developer must restore the Revision to the version that contains the local changes (using History and Set As Active or Restore this revision options from the contextual menu), and then Commit the object to GeneXus Server.
- Maintain server-side changes only: the conflict must be marked as resolved. To do so, open the Commit dialog and right-click on the object and select 'Mark as resolved' option:
Note: The following warning will be displayed in the Team Development output if the conflict has not been marked as resolved and the developer tries to add it in the Commit:
warning: Resolve Attribute 'CountryInitialsName' conflict before committing it.
To ease the task of manually merging the changes, GeneXus offers the following tools:
1) History and Differences: To check both sets of changes (the ones made by the developer locally and the ones made on the server side) open the objects history.
Select the last Revision (before the Revision created in the Update) and select 'Compare With Current Revision' option. Or, if changes were made to the object since the Update, select the revisions by using the options 'Select Left Side To Compare' and then 'Compare With <ObjectName> Revision:<RevisionNumber>':
Note: to maintain only the changes made locally (or restore an older Revision), the developer can use the Set As Active or Restore this revision option.
2) Pending Commits: by right-clicking on the conflicting object from the Commit dialog the following comparisons will be available:
- View changes until conflict: the comparer will be open comparing the Synchronized Object Before Last Update with Before Update revisions (changes made locally by the developer before the last Update).
- View remote changes: the comparer will be open comparing the Synchronized Object Before Last Update revision with the one right after the Update (changes made in the server-side object by other developers).
- View conflict resolution: the comparer will be open comparing the revision right before the Update with the one right after the Update (changes made locally by the developer with the changes made in the server-side object (the changes that caused the conflict)).
Note: when an object is successfully merged (there is no conflict between the changes made locally and the ones made on the server side), it will be displayed in the Pending Commits marked in green.