Book a Demo

Author Topic: Howto work with Version Control branches  (Read 9167 times)

grossh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Howto work with Version Control branches
« on: July 10, 2008, 12:19:57 am »
Hello,
I read through all the version control documentation and searched the forum, but I could find nothing concerning branches within Version Control.

Our scenario:
We have business analysts working on the requirements model. To hand it over to the development, they check it in (V1.0) and start working on the requirements for the next release (V1.1).
During development some problems have been found in the requirements model and need to be corrected. Here normally a Version Control branch would be opened for V1.0.
Unfortunatelly I found no way in EA to checkout an older version for editing. I always end up with the latest version from the repository.
I tried to workaround this by checking out using EA, retrieving a sticky version using my VC client and importing this XMI. But then my package got locked again by EA.
Is there an offical way managing branches, or any hint for a workaround.
Thanks in advance.
H.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Howto work with Version Control branches
« Reply #1 on: July 10, 2008, 12:41:46 am »
The Version attribute is not linked in any way to version control. It is there for (any other) user-defined purpose.
No, you can't have it!

grossh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Howto work with Version Control branches
« Reply #2 on: July 10, 2008, 12:53:41 am »
Sorry, I did not mean the Version of the Properties page for the package but the version of the release. Normally I set a baseline / version within the version control system.
I simply need to open a branch within the VC for a package with an older revision and would like to edit this "old" revision.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Howto work with Version Control branches
« Reply #3 on: July 10, 2008, 02:00:33 am »
Now I've got it, but I don't have the answer.

Ideas, anyone?
No, you can't have it!

chrisHauert

  • EA User
  • **
  • Posts: 37
  • Karma: +0/-0
    • View Profile
Re: Howto work with Version Control branches
« Reply #4 on: July 10, 2008, 02:23:13 pm »
what about redirecting your working copy to a branch in the version control repository (after having created a branch)?
« Last Edit: July 10, 2008, 02:23:43 pm by chrisHauert »
Cheers, Christoph

HowardB

  • EA Administrator
  • EA User
  • *****
  • Posts: 55
  • Karma: +0/-0
  • I love YaBBies!
    • View Profile
Re: Howto work with Version Control branches
« Reply #5 on: July 10, 2008, 04:06:16 pm »
Currently, Version Control Branching is not directly supported by EA. We have some ideas that we are investigating on how we might achieve it in the future, but it will be some time before we can implement a solution.

The XMI package files that are exported by EA for version control purposes, contain the name of the associated VC configuration. This allows functions such as "Get All Latest" to recursively populate an entire model from just the root package. However, it also makes it difficult to change the VC configuration that is used by a model.

The XMI file format is one that cannot be merged in the same way that program source code can be merged. Yes, it is human readable text, but it must be treated as a binary file for VC purposes. (Google search "merge XMI" for the current state of play in this area.)

EA's VC configuration data is stored in your Windows registry and in a file in your Application Data directory. Currently, EA's VC configurations can be associated with only one working copy folder at any given time. You can change it, but that change will affect ALL package file access using that definition.

So, at present, you can make a copy of your EA model, say "Model-1_0", but it will still be using the same VC configuration and therefore still accessing the same set of XMI package files, namely the HEAD revision of those files.

If you create a branch in your version control system, so that you have a separate set of files in the VC repository and a corresponding separate set of files in a "revision 1.0" working copy directory, you can point EA's VC configuration to the "revision 1.0" working copy folder, but both models, "Model--1_0" and "Model--1_1", are still using the same VC configuration, so both models are using the same set of working copy files.

You can point the VC config to the "rev 1.0" working copy, perform a "Get All Latest" and your model is reverted to revision 1.0. If you then point the VC config to the "rev 1.1" working copy and perform a "Get All Latest", the model will be updated to revision 1.1.


It is possible to save copies of EA models at different revision levels and to have them associated with the appropriate revision in version control, but to maintain two different revisions on the same PC would be difficult and would require careful (manual) management of which VC revision is in use at any particular time.

If particular users will be working with their own particular revision of the model, then conceivably each group could be set up to use just the revision they are interested in, without causing any conflicts.

If users attaching to a (single) Shared model, were accessing different revisions in Version Control, this could only result in chaos.


EA does offer a facility to create baselines from selected packages within your model. You can subsequently compare differences to baselines and merge changes back into your model. It is possible to import baselines from previously exported XMI files (including those exported for version control) and to import baselines that are stored in other models (so long as it is the same package).


When it comes to running two separate branches of development on distinct revisions of the same model, the following procedure should achieve the result you are looking for;

1. Apply version control to the model root node

2. Export the model root node as a "model branch" (Right-click, "Package Control | Export as Model Branch".)

3. Outside of EA, use your VC product to create a version control branch (based on the revision appropriate to your needs).

4. Outside of EA, use your VC product to create a working copy, derived from the branch created in the previous step.

5. Outside EA, use a text editor that provides a "Replace in Files" function (PSPad is a good example), to modify the name of the VC configuration referenced in each and every XMI file, as well as the model branch file. If your original configuration's UniqueID was "myConfig", replace every occurrence in every file with say, "myConfig-1_0".

NOTE: If you are using Subversion as your VC product, all of the XMI have a "needs-lock" property set on them. You must apply a lock before you can modify the file and commit the changes.

6. Check-in or commit the modified files, to your VC repository.

7. Back in EA, create a new, empty project.

8. Open the VC Settings dialog and create a new VC configuration to use with this new project, called "myConfig-1_0".

(Use the new name that was used in the "replace" operation in step 5.)

9. Right-click the existing root node and choose "Package Control | Import a Model Branch". Choose the configuration "myConfig-1_0", then choose the model branch file that you exported in step 2. Import the branch.

10. When prompted, choose to import XMI as a model root.

The result should be a copy of the model, associated with VC branch "revision 1.0".

regards,
Howard.

Emilio

  • EA User
  • **
  • Posts: 78
  • Karma: +0/-0
    • View Profile
Re: Howto work with Version Control branches
« Reply #6 on: July 10, 2008, 06:13:04 pm »
Not in as much detail as the previous post but here are some ideas...

Merging an XML (XMI is an XML file) is not an easy task, you need special tools for that. I have no idea how a regular version control "merge" would work in this situation as I have only used that functionality for source code.

If your model is in version control it is most likely stored there as an XMI/XML file. What you do is that outside EA (would be a nice feature!) you go to your version control application and apply a LABEL to the branch, say "MODEL_1". Once your whole model branch (branch in VC not in EA terminology) you can always do a "Get Labeled Version" and select one of your previous labels (the one you are interested in). That "Get Label" operation you will also have to do outside EA (your VC application).

The so called "baseline" feature mentioned in the previous post is only available in the Corporate version of EA.

grossh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Howto work with Version Control branches
« Reply #7 on: July 10, 2008, 10:49:59 pm »
Hello Howard,
thank you for the in detail explanation.
I gave it a try but did not succeed.
After step 10 I end up with an Model where all subtrees are empty. In the branch directory where I had set a sticky tag for the branch, all files are replaced with those from the main trunk.

I'm using EA 7.1 Build 831 with CVS as Version Control system.

Do you have any additional suggestions?

Thanks, Harald

p.s.: I'm aware that it is not possible to merge the XMI files. We planned to store older revisons as baseline within EA too, and make a compare / merge within EA if this would be necesarry.

Rinaldo

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Howto work with Version Control branches
« Reply #8 on: July 11, 2008, 04:30:33 am »
Hi Howard.

I think the explanation you gave us would fit well on the help of the product, IMHO.

I am about to start using EA and Team Foundation Server and this kind of information can help me to decide how to use VC and EA.
Regards,
Rinaldo

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Howto work with Version Control branches
« Reply #9 on: July 11, 2008, 09:22:55 am »
And a version of Howard's explanation is indeed being added to the Help.
Best Regards, Roy

HowardB

  • EA Administrator
  • EA User
  • *****
  • Posts: 55
  • Karma: +0/-0
  • I love YaBBies!
    • View Profile
Re: Howto work with Version Control branches
« Reply #10 on: July 11, 2008, 02:53:53 pm »
Harald,

You are quite right, this procedure does NOT work with CVS.  I had tested it yesterday using Subversion (but not CVS), before I knew which VC product you were using.

I have now discovered that CVS implements its branches using sticky tags, but EA, for many of its VC operations, issues CVS update commands using the "-A" option, specifically to remove the sticky tags, ensuring that we have the latest revision.  CVS retrieves the latest revision from the main line, NOT from the branch and therefore all of the udpates to the VC config names are lost, as well as any updates that you wanted to make to the branch revision of your model.

With Subversion, the repository is managed differently.  When I update, I get the latest revision of the branch associated with the working copy folder, not the latest revision of the main line.

If I were to modify EA such that it didn't use the "-A" option, it would break much of the CVS functionality that we now have and make many of EA's VC functions with CVS unreliable.

At this stage, I'm not sure if there is a workable solution to this problem for CVS.


The reason that the information in my previous post is NOT in the EA User Guide (and had not previoiusly been made public) is that it has not been tested with each of the twenty or more version control products that can be integrated with EA.

Indeed, it doesn't work with CVS, which probably represents about 10 to 15 per cent of all our VC users...


best regards,
Howard

HowardB

  • EA Administrator
  • EA User
  • *****
  • Posts: 55
  • Karma: +0/-0
  • I love YaBBies!
    • View Profile
Re: Howto work with Version Control branches
« Reply #11 on: July 11, 2008, 05:40:11 pm »
Testing shows that the procedure outlined earlier will work with MS Visual Source Safe.  That is, once you work out how to create a separate branch with that product.

cheers,
Howard

Wowbagger

  • EA User
  • **
  • Posts: 69
  • Karma: +0/-0
    • View Profile
Re: Howto work with Version Control branches
« Reply #12 on: September 10, 2009, 05:53:13 am »
One way Sparx could help make this work better would be to have a tool (either within EA or a separate tool) that would handle a two- or three-way merge of the exported XMI files, so that when a conflict is found by the VCS tool, the user could then instruct the VCS to give them the two files and submit them to the merge tool. The merge tool could then read the XMI files into DOM structures in memory, and using the knowledge of the specifics of the XMI format, resolve differences in a higher level fashion than a simple text merge (e.g. ignore timestamp differences, canonicalize the data structures, identify moves by detecting the GUIDs, etc.).

Especially for tools that can provide all the files for a three-way merge (ancestor, branch 1, branch 2) then the merge tool would have a much better chance to resolve the differences intelligently.


Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: Howto work with Version Control branches
« Reply #13 on: September 15, 2009, 07:04:08 pm »
We have been experimenting with a solution that appears to work for ClearCase version control, but I suspect that this is because ClearCase uses a virtual file system that is constructed for each client from a 'view configuration'. In short this means that files remain at the same file-path location irrespective of the version and branch that the 'view configuration' has selected.

We have split our original model up into a model of models. Each model is configuration managed set of packages (hence XMIs in CC). A separate team is responsible for each model and each team has their own MySQL EA database and EA model. Each team's model is populated with a set of models as required for their role in the project. All members of a team have their client ClearCase 'view configuration' rules for selecting the required version of each model set to the same versions (this is very important).

What this allows is for each team to have a version controlled set of models that can differ from the other teams within the same project. Essentially each team has their model of models to manage exclusively and they issue releases of that/those models to the other teams who can then do a controlled update by updating their 'view configurations' and then a 'get all latest' in EA to bring their database into alignment with their ClearCase view.

On our experimental model this seems to work, and we are about to tear apart our working model and rebuild it as a model of models with each model in its own model folder. This basically requires us to move each model's set of XMIs from the original jumbled up model folder to their new separate model folders.

If we've missed something and this is a bad idea please shout now!

Otherwise, for those of you using ClearCase I hope this helps.

Regards
Dave B.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: How to work with Version Control branches
« Reply #14 on: September 15, 2009, 07:56:26 pm »
Hi Dave,

Could you recast your explanation using model less often?  I'm having trouble figuring out which model is which...  :)

part of the problem is that model is an overloaded term in modelling (pun intended!).

One way out of it is to talk about the physical repository containing a set of models composed of packages.

The approach appears interesting and a variant may be applicable to other source control systems so it would be really good to have your proposal crystal clear...

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!