-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handling Changes, Conflicts, and Merges #4
Comments
:-) SImple answer: we can use git to detect that a model file has been changed, but nothing more. We have to take over and implement our own diff/merge tool and then force git to commit the result. That's something doable with command line git (you can configure it to load external diff/merge tools for pre-defined types of files), and I can we can do it too (in a way or another) with JGit. So we have to code ourselves a logic similar to what git does:
|
Additional inputs and comments for this... Good readings on this topic:
Finding the common ancestor can be done using
This means we'll have to create some classes for that:
Of course, this will involve comparing all objects between two versions of the same model and I'm sure we can find some tricks to help on that. I don't know if they already take all cases into account, but
A conflict is found when two
Several options here:
Note: at this step, A and B no more contain conflicts as they have been removed at step 4 to create C. Important edit: There is still a need for additional "intelligence" to solve some edge cases like:
|
For reference: Even though git might successfully merge a branch or pull from remote the resulting model might no longer be valid. So we have to check model integrity in all cases. Here are some examples (from @jbsarrodie): Start with a model containing an element E
Start with a model containing two elements A and B, an a relationship R from A to B
And one from me: Start with a model containing a Note that has a custom image
|
Taking the first example from the previous comment.
The pull is successful and a new merge commit is created from merging theirs and mine, called However, the model is broken so we need to fix and resolve it. As in coArchi 1, this will result in another commit with the restored objects. Perhaps another way to do this is to do a kind of dry run:
See https://stackoverflow.com/questions/17222440/is-there-a-git-pull-dry-run-option-in-git |
Yes. In fact the real target for me is to no more rely on git for diff and merge so that we know exactly what changed (even for a simple commit) and are sure that everything is valid (in case of a merge). |
Is it possible to support a PR workflow? That would really fit for us so that we can also have branch protection rules. |
No, PR workflow is managed at Git Server level (such as GitHub or GitLab) and can't work with Archi as Archi absolutely has to manage all git operation or else the model will end up corrupted very quickly (coArchi includes an anti-corruption layer which fixes issues created by merge operations).
If you use branches in Archi, you can already setup a very similar workflow: people with no right on |
Are there some good practices on how to set up branch protection rules and/or also do ownership for parts of the repository? I am looking for some mechanism where we can managed the reviews as a task (hence the PR). And I was hoping to do something with a CodeOwners file to assign review responsibility to different people based on the elements / diagrams that are impacted from a branch. |
@RaimondB I'd like to keep this issue focussed on the main topic. I've just enabled Discussions, so you could start a discussion there, if you like. |
What about having a container based tool that can fix up the model as a github action? And validate model integrity as a test before allowing the merge? I have not yet look into all of the Archi CLI options, but it feels that it could work as long as we have a good pipeline setup to integrate the models and validate the result of it. |
Thinking about this more, I'm not even sure how we can manage changes, conflicts, and merges if we are storing one
*.archimate
file in the git repository.There could be a textual change or conflict but not a logical model change or conflict (hence the reason for using
grafico
XML files). So we can't rely on git's usual mechanisms for detecting changes and conflicts.But I'm not sure I'm thinking about this clearly...maybe this won't be a problem. After all, a
grafico
View XML file is also a large file...The text was updated successfully, but these errors were encountered: