Merge conflict resolution

Hi Everyone,

I’m trying to use Capella and its Git capability (with Atlassian BitBucket as the remote repo) with the intent to enable collaborative working of a small number of individuals, however, I’m struggling with how to resolve merge conflicts.

In my fictional setup, I have a master branch which then spawned a User A branch and a User B branch.
Some changes were made in the User A branch and merged back into master which worked just fine (see attached image ‘User A and Master model’).
Some changes were made in the User B branch (see attached image ‘User B model’) and I’m now trying to merge those changes into master as well, however, I’m struggling a bit with the conflict resolution.

I tried to merge the changes from the User B branch into master by first checking out the master branch and then right clicking on the User B branch and selecting merge. Of course Capella warned me there were conflicts that needed resolving and promptly closed the model as expected (see attached image ‘repo branch history’ for the state immediately prior to the merging the User B branch).

  1. Even though I made only a small number of changes to an already very small model (I added just a couple of functions and functional exchanges) the reported number of differences between the models is huge (267 + 1 + 114 = 382). Is this to be expected and is there a quick way to merge all the changes into the master branch without going through all of them individually? Many of the changes appear to be really low level attributes/properties of the model that I didn’t change myself, but I guess have been automatically changed by Capella?

  2. In the diff/merge window (see attached image 'diff-merge aird file), I’m confused as to why the middle column i.e. the master branch model, only includes the ‘Kevs Test Repo Model.aird’ entry as opposed to the right column i.e. the User B branch, which also includes the ‘Metadata’ and ‘Kevs Test Repo Model’ entries. The master branch model contains elements that the User B branch doesn’t and vice-versa, so I expected to see as a minimum a ‘Kevs Test Repo Model’ folder in the middle column with a bunch of stuff highlighted red. You can see this in the diff/merge view of the .capella file (see attached image ‘diff-merge capella file’) which is exactly what I expected to see, however, only resolving these differences corrupts the model as the .aird file becomes out of sync with the .capella file. Also, in this tutorial capella/doc/plugins/org.polarsys.capella.git.doc/html/GitAdapter/GitAdapter.mediawiki at master · eclipse/capella · GitHub under the ‘Merge conflicts’ section the guidance is to resolve the conflicts in the .aird file as it will handle both conflicts in the model structure and also its representation.

Having resolved conflicts in the ‘Kevs Test Repo Model.aird’ entry, the models were successfully merged in Git and I can open the .aird file, however, there appears to be nothing in it and the diagrams are greyed out (see attached image ‘resulting broken project explorer’). There is also an ‘Invalid Representations’ folder. I assume this is related to the issue in the diff/merge window which did not show any of the model elements in the master branch model as per above?

If anybody has any clue as to what is going on or can provide any guidance on how they use Git branching to manage work between different people I would really appreciate it

I’m using Capella 6.1.0






Hi Kev,

I’m not quite sure what happened, apart from something went wrong…
As you have identified, models diff/merge can quickly prove complex. There are many ways to make mistakes and introduce inconsistencies. Especially if it is to be a repetitive action.

So, if your main objective is to enable collaborative working of a small number of individuals, my main advice would be to have a look at Team for Capella. It’ll certainly make your job easier.

Feel free to reach me for further info.

BR

Samuel

Thanks for taking the time for posting this.

I am using Capella for the first time for one of our smaller projects, and I have one colleague that would be a natural fit for collaborative work on this project.

I am also looking for community experience on best practices for collaborative model development.

Maybe you can have a look at the EAS presentation from the Capella days, they talk about this topic: Capella Days 2023

1 Like

Two more thoughts (N.B. - I have never even attempted a diff/merge. But when I do, I will try to use a simple model like yours to get a feel for it).

  • Did you try opening the merged model in a restarted Capella session?
  • This may be a bug in Capella. Maybe submit a ticket on the GitHub page, attaching the relevant files.

Best,

Thanks everyone for taking the time to respond. I don’t profess to fully understand what is going on, but I have managed to make some progress and got to a point where I can reliably merge two overly simple models without corrupting it in any way. I’ve detailed the steps I took below in the hope it will help others. FYI, I only added elements and I only added them to new diagrams. I have yet to try removing elements, which by its nature will of course modify existing diagrams, or modifying elements.

My primary concerns with this approach to collaborative working are that for a real-world model where there will likely be many changes made between commits, the diff/merge will be quite onerous and complex as Samuel said and, more concerningly, fraught with danger as it seems all to easy to make a tiny mistake and corrupt the model by rendering the .aird file and .capella files out of sync. Of course with Git you can always revert back to previous versions, however, unless your well versed in doing so, I found this quite cumbersome as well.

Process Steps:

Warning - Always close the .aird file before switching branches!

Make changes to your local feature branch:

  • Fetch the latest remote master branch
  • Rebase your local feature branch onto the master branch to ensure you’re starting from the latest version of the model and push the rebased local feature branch to the remote repo
  • Make any/all changes to your local feature branch model then commit and push the changes

Merge the changes into your local master branch:

  • Close the .aird file
  • Check out local master
  • Right click local master → merge
  • Select local feature branch to be merged into master
  • Merge → Assuming there are merge conflicts, this should return a “result: conflict” warning
  • Close any pop-up windows
  • Right click the blue project folder → team → merge tool
  • Finish

Resolve differences in the model_name folder (not the metadata folder or the model_name.aird folder)

  • Add additional elements on the right to the left
  • Ignore / remove additional elements on the left
  • Resolve conflicts (to leave master as is, ignore changes on the right). There should now be no differences in the model_name folder

Resolve differences in the model_name.aird folder:

  • Add additional diagrams (and all child-elements) from the right to the left
  • Ignore / remove additional diagrams on the left
  • There should now be no differences in the model_name.aird folder

Resolve differences in the metadata folder

  • Ignore differences on the right at the folder level

Save, commit and push the changes to the remote repo
Confirm the merge in Capella git history (see attached image below)
Confirm the merge in remote repo

Successful merge