Merging two conflicted branches with MPS can be painful even for developers, not to speak of regular language users who are not well versed in Git and conflicts.
Modelix promises to solve this problem with operational transformation while bringing MPS to the Web but it is not ready for production yet. So what can we do in the mean time?
A certain portion of conflicts happens due to the way the model is persisted to disk. MPS can resolve such conflicts automatically but it’s not always desirable to start the full-blown IDE to resolve such conflicts.
To reduce the probability of such “accidental” conflicts, we need to split our models into multiple files. Our first option could be to split the model conceptually: if one user often edits one part of the model while another user often edits a different part of the model, perhaps there should really be two models.
Another straightforwad solution is to convert the model to file-per-root persistence. This changes the storage format
of the model so that each root node is stored as a separate file (.mpsr
) in the model directory. Having a separate
file for each root node means that conflicts would only occur if two users touch the same root node.
However, file-per-root persistence has a few disadvantages:
- It is not the default, which means that you may encounter bugs. It mostly works fine though.
- Since it is not the default, you will need to take additional steps if you want to ensure that your users use this form of persistence. For example, you might need to replace the standard action to create a new model with your own and/or introduce a check to make sure that users don’t accidentally commit new models with default persistence.
- File-per-root persistence can be slower on large models because MPS now has to read many files to load the model into memory.
You can convert a model to file-per-root persistence via a context menu action.
There is no way to convert the model from file-per-root back to the default file-per-model persistence but it is in the works.