Resolve Conflicts in Projects Using System Composer Three-Way Merge Tool
This example shows how to use the System Composer Three-Way Merge Tool to investigate and resolve conflicts in System Composer™ architecture models in a project. You can view and merge the System Composer architecture model differences in the resulting report.
The Merge tool automatically merges non-conflicting changes before you open the merge report. This example demonstrates how to:
Review the automatic merge choices.
Apply your desired edits to the target file.
Decide how to resolve any remaining differences.
After you resolve the conflicts, you can commit the resolved architecture to source control.
System Composer Architecture Changes and Conflicts
The example project, RobotArchitectureProject
, is under Git™ source control. When you attempt to merge the changes of a colleague on the main
Git branch into your taskBranch
, the operation results in conflicts.
To resolve the conflicts using the Three-Way Merge tool, examine your local file (Mine, in this example, the taskBranch
branch), the conflicting revision (Theirs, in this example, the main
branch), and the common ancestor of these two files (Base).
Theirs - A colleague, working on the
main
branch, updated theMotion
component and updated the query used in theComponent View
view.Mine - You updated the name of the
Motion
component and updated the query in theComponent View
view on thetaskBranch
branch.
Open System Composer Three-Way Merge Tool
In the Project panel, look for conflicted files. The RobotArchitecture
file shows a red warning icon in the source control column, which indicates a conflict.
To see a detailed report of conflicts, in the Source Control panel, in the Modified Files section, right-click the RobotArchitecture
file and select View Conflicts.
View Changes
The Three-Way Merge tool shows the changes to the two System Composer architecture models that cause this file conflict.
The main, taskBranch, and Base panes show the differences between the conflicting revision, your revision, and the base ancestor of these files.
The Target pane shows the file into which you merge changes. The tool copies this temporary file into the project when you choose to accept the merged result.
The summary table in the bottom right corner shows that the merge tool automatically resolved nonconflicting differences. The table also shows that you must resolve the remaining changes.
You can visually examine individual differences in the architecture model files.
To examine a difference, click a row in one of the trees. The Merge tool displays the change for each model in an editor, for example, the System Composer canvas, to the right of the Three-Way Merge window.
On the Merge tab, in the Highlight section, choose the models to display by clicking Top Model or Bottom Model buttons.
Resolve Conflicts
The Merge tool automatically merges most nonconflicted differences before opening the Three-Way Merge report. In this example, you can see ten differences were automatically merged.
The Merge tool cannot resolve the conflicted differences. You must choose which design to keep in the target file in the Target tree.
To resolve conflicts, follow these steps.
1. Use the Next button to navigate to the conflict. The Name
property is conflicted because you and your colleague changed it. In the Target pane, by default, the tool selects the change from your branch taskBranch
.
2. To resolve the conflict using the default selection, mark the conflict as resolved. In the Target pane, click the conflict icon in the Name row and click Mark as Resolved.
3. On the toolstrip, use the Next button to review the next conflict. The Component View
view is conflicted because you and your colleague changed the color and the query of the view.
For the
Color
property of theComponent View
, if you want to keep the change from the base revision, select the option button in the basecolumn.
For the
Component Selection Query
property of theComponent View
, if you want to keep the change from themain
branch, select the option button in themain
branchcolumn.
4. On the toolstrip, use the Next button to navigate to the next conflict. The Motion Component
is conflicted in the Component View
view because you and your colleague changed the component name of the Motion
component and this change propagated to the view.
To stay consistent with the change you selected previously, select the option button in the
taskBranch
branch column.
5. Check the summary table to verify you resolved all conflicts.
In this example, the summary table shows that you have successfully resolved all conflicts.
If you resolve all conflicts in the current view but the summary table title indicates that you have remaining changes, disable the filters to view and resolve the remaining conflicts. On the Merge tab, in the Filter section, turn the filters off.
Accept Changes
1. After you resolve all filtered and unfiltered changes, click Accept & Close. The Merge tool closes the report and the models, accepts the merge result in targetFile
, and marks the conflict as resolved in the source control tool.
2. Before you commit the resolved model file to source control, perform a final review by comparing the merge changes against the current branch.
In the project Source Control view, right-click the model and select View Changes.
See Also
System Composer Three-Way Merge Tool | System Composer Comparison Tool | Resolve Conflicts in Project Using Simulink Three-Way Merge