Example: Manual 3-Way Project Merge
This example illustrates a simple 3-way project merge. Let's suppose that two users, Tom and Alice, created their own copies of a UModel project and made changes to them. There are now three versions of the same project: the original one, Tom's copy, and Alice's copy. In the context of 3-way merging, the original project represents the "common ancestor file".
For the scope of this example, let's assume that the common ancestor file is Bank_CSharp.ump project, available in the folder C:\Users\<username>\Documents\Altova\UModel2022\UModelExamples. The copies of Tom and Alice must be created manually. Therefore, let's first create two copies of the Bank_Csharp.ump project in child folders below the ...\UModelExamples folder. Let's call the child folders Alice and Tom; the project name can remain as is.
Use the File | Save Project As command to create the copies of Tom and Alice. When prompted to adjust the relative paths, click Yes. This way you will avoid introducing syntax errors in the project copies.
The goal of the example is to show how Alice should merge changes not only from the original Bank_CSharp.ump, but also from Tom's project into a new merged model (a so-called "3-way merge").
Step 1: Prepare Tom's project
Tom opens the Bank_CSharp.ump project file in folder Tom, opens the "BankView Main" diagram, and makes changes to the BankView class.
1.Operation CollectAccountInfos():bool is deleted from the BankView class.
2.The visibility of the CollectBankAddressInfos():bool operation is changed from "protected" to "public".
3.The project is then saved.
Step 2: Prepare Alice's project
Alice opens the Bank_CSharp.ump project file in folder Alice, opens the "BankView Main" diagram, and makes changes to the Bank class.
1.The operations CollectAccountInfos and GetBalanceOfAccounts are both changed from "public" to "protected".
2.The project is then saved.
Step 3: Perform the 3-way merge
Alice now starts a 3-way project merge:
1.Open Alice's project from Alice folder.
2.On the Project menu, click Merge Project (3-way), and select the project file changed by Tom from Tom folder.
3.You are now prompted to open the common ancestor file. Select the original Bank_CSharp.ump project file from the ...\UModelExamples folder.
The 3-way merge process is started and you return to the project file from which you started the 3-way merge process, i.e. from the project file in the Alice folder. The Messages window shows you the merge process in detail.
The outcome of the 3-way merge is as follows:
•The changes made to the project by Tom are replicated in Alice's project.
•The changes made to the project by Alice are retained in the project file.
|Note:||The project file in the Alice folder should now be used as the common ancestor file for future 3-way merges between the project files in folders Tom and Alice.|