Merging a Branch to the Trunk
Top  Previous  Next


From time to time, you need to merge changes performed on the branch to the trunk. This merge requires the following steps which are explained further on this page:
1.Map the current work area to the trunk.  
2.Merge branch changes to the work area. Solve merge conflicts (if any exist).  
3.Perform manual merges (if any).  
4.Test the merged version.  
5.Commit the merged version to the Repository.  

The remainder of this section covers these steps in detail.

Note: This section also applies to merging from a nested branch to the parent branch that is referred to as the "Trunk" during this merge. After merging changes to the parent branch, changes can be merged from the parent branch to the main trunk.

Step 1 - Map the Current Work Area to the Trunk

Before merging, map the current work area to the trunk.

To map the current work area to the trunk:
 
1.Open the ComponentSoftware Administrator (refer to Using the ComponentSoftware Administrator in Branching and Merging).  
2.From the Project drop-down list, select the project that the branch is a part of.  
3.From the Branch drop-down list, select the desired branch.  
4.From the Project menu, click Set Work Area for Merge.  
5.A message appears confirming that the work area has been mapped to the trunk.  
6.Click OK.  
 
 
Step 2 - Merge Branch Changes to the Work Area

After mapping the current work area to the trunk, merge branch changes to the work area.

To merge branch changes to the work area:
1.From the Project menu in the ComponentSoftware Administrator, click Merge Branch to Work Area. This command loops through all documents that need merging and lists those files which require special treatment.  
2.If any files require merging, the File Merge Dialog will appear. This dialog will allow you to analyze the merge results and to resolve any merge conflicts which may exist in the files which are to be merged. For more details, refer to File merging, later in this chapter.  
3.From the Project menu, click Launch Explorer.  
The Document Explorer appears.  
Note the files with the following status:  
·Modified – Files merged manually or automatically by CS-RCS.  
·Added on Branch – Files added on the branch.  
·New Files removed by the branch. Merging removes the working file to assure the trunk is built correctly.  
Note: This command also locks the branch revision to avoid further revision updates before the merge result is committed to the trunk.  
 
 
Step 3 - Perform Manual Merges

Manual merging is required for binary files which have been changed on both the branch and the trunk. These documents are marked with the Manual merge status on the Document Administrator. Using the appropriate editor, manually merge changes into the work area.

For example, if you have a VISIO drawing that is changed on both the trunk and the branch, to perform a manual merge:
1.Open the Revision Manager (refer to Using the Revision Manager Tool in CS-RCS Tools in the User Guide chapter).  
2.Select the branch head revision.  
2.Click View Revision to open the branch head revision with VISIO.  
3.Open the normal working file with VISIO. (This is the trunk head revision.)  
4.Visually analyze the changes on both drawings. You can use the revision history comments to determine the changes done on each revision.  
5.Copy changes from the branch revision and paste them to the working file (i.e., the trunk revision).  
6.Save the working file.  

Step 4 - Test the Merged Version


Since merging integrates many changes to the trunk, it is recommended to fully test the merged version (by verifying its functionality) before committing it to the Repository. Additionally, it is recommended to review all changes made to the files with the Modified status by using the Document Explorer and CSDiff. You may reject any merged changes or edit any file. You may also execute Check-out on specific files if you wish to ignore all branch changes made on those files.

Step 5 - Commit the Merged Version to the Repository

From the Project menu in the ComponentSoftware Administrator, click Check-in Work Area to Trunk to commit the tested merged version to the Repository. This command performs the following:
1.Checks-in all Modified files within the work area to the trunk.  
2.Adds new files added by the branch.  
3.Removes files made obsolete by the branch.  
4.Releases the lock from all branch revisions used on this merge.  
5.Saves the current branch/trunk status to enable future merges. CS-RCS supports multiple branch merges.  

Notes:
·If you accidentally performed a normal check-in, you must still click Check-in Work Area to Trunk to perform all the required merge sequences.  
·Merge from trunk to branch or from branch to non-parent branch is rarely used. Such a merge is supported by copying the desired files to the destination branch and rejecting unwanted changes by using the CSDiff tool. For more details, refer to the Branching and Merging section of the FAQ.