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\UModel2020\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 C#_Alice and C#_Tom; the project name can remain as is.
|Tip:||Use the Project | Save 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 C#_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 C#_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 C#_Alice folder.
2.On the Project menu, click Merge Project (3-way), and select the project file changed by Tom from the C#_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 C#_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 C#_Alice folder should now be used as the common ancestor file for future 3-way merges between the project files in folders C#_Tom and C#_Alice.|