Skip to content

[Discussion for main 2018 Sprint#3 feature] Merge of an 'external model' into 'main model'

Jean-Baptiste Sarrodie edited this page Feb 18, 2019 · 2 revisions

This page is intended as a way to discuss and collaborate about the main feature developped during 2018-Sprint#3

Overall Sprint goal

The main goal of this sprint is to add support for merging external model (stored in a single file) into a model already imported in the collaboration workspace. This will support several use-cases such as:

  • Share a model with someone who doesn't use collaboration plugin and import it back at a later time (while being able to create a commit with those "offline" changes)
  • Import an architecture reference model (having its own lifecycle) into a model while still allowing later updates
  • Import some generated architecture model (from a CMDB, an inventory tool, some code-to-model solution...) into a model while still allowing later updates

Conventions

In the following, I'll use the following conventions:

  • main-model refers to the model which is already in collaboration mode and has been imported in a collaboration workspace
  • external-model will refer to the model stored in a .archimate file that we'll import into the main-model
  • orphan-branch refers to the collaboration branch which has been created as orphan (in git terminology)

Experimentation

Here is the raw list of operations I tried to do a POC for this new feature (I still have to edit this to apply the convention and make it digest).

  • Using latest version of Collaboration plugin (ie. Including branches support)
  • Import "Let's Test" model into Workspace
  • Clean up (removed) unwanted branches (keeping only master and web)
  • Creating orphan branch "ref-model" (git checkout --orphan ref-model)
  • The new branch doesn't show up in Archi (Branches view is not updated, and the Collaboration Workspace show "Let's Test []"
  • Close "Let's Test" model in archi model tree
  • Replace temp.archimate file of "Let's Test" model by Archisurance.archimate
  • Open "Let's Test" model : this now contains Archisurance
  • Save/Commit/Publish : Plugin shows an error
  • Checked in SmartGit : branch doesn't shows up
  • Clean up the working tree (git rm -rf .), add an empty file (echo > empty; git add empty) and commit (git commit -m "bla bla bla")
  • Now the branch does show in SmartGit and Archi !
  • Save/Commit/Publish : I choose to amend last commit to have a clean history
  • This worked but has a small side effect: the model object itself is changed so the name in Collaboration Worksapce is impacted.
  • Switching to master
  • Merging "ref-model" into master:
    • Choosing online merge
    • Asking me to commit (why? Maybe related to new version of Archi and XML/EMF version changed)
    • As expected Model itself is in conflict, but also top level folders: image
    • Remark: at EMF level all these objects have differents ID (because they come from different models), but Grafico create them with predefined name so conflict is raised (which is good)
    • Keeping "Mine" for all (ie: master, ie: Let's Test)
    • Don't delete ref-model branch when prompted (will serve later)
  • Models have been merged - Yeah !!!

Issues:

  • If a concept from the imported model is deleted inside the other model, then later merges from the (originaly orphan) branch will not restore them.
  • A partial workaround is to import the model through a new orphan branch, but this will not remove concepts deleted on the original (reference) model
  • A true workaround is to:
    • Import the original version of the (reference) model through another orphan branch: this will union-merge both models, making sure that any deleted concepts are there again
    • Update the (reference) model in its (originaly orphan) branch
    • Merge the branch into the model: this will update model as expected

Proposed feature list

Still a work in progress, but should be something like:

  • Being able to import an external-model into a new orphan branch, which should involve
    1. Prompt the user for the external-model file path and the name of the branch to create
    2. Check-out a new, empty, orphan branch
    3. Load the external-model and export it as grafico into the working tree
    4. Commit (which makes the new orphan-branch visible)
  • Being able to replace a main-model by an external-model
    1. Prompt the user for the external-model file path and confirmation (content of the main-model will be erased and replaced)
    2. Load the external-model and export it as grafico into the working tree
    3. Commit