A merge combines the contents of two or more files or directories into a single new file/directory. The ClearCase merge algorithm uses the following files during a merge (see Figure 44):
Contributors, which are typically one version from each branch you are merging. (You can merge up to 15 contributors.) You specify which versions are contributors.
The base contributor, which is typically the closest common ancestor of the contributors. (For selective merges, subtractive merges, and merges in an environment with complex branch structures, the base contributor may not be the closest common ancestor.) ClearCase determines which contributor is the base contributor.
The target contributor, which is typically the latest version on the branch that will contain the results of the merge. You determine which contributor is the target contributor.
The merge output file, which contains the results of the merge and is usually checked in as a successor to the target contributor. By default, the merge output file is the checked-out version of the target contributor, but you can choose a different file to contain the merge output.
Figure 44 Versions Involved in a Typical Merge
To merge files and directories, ClearCase takes the following steps:
It identifies the base contributor.
It compares each contributor against the base contributor. (See Figure 45.)
For any line that is unchanged between the base contributor and any other contributor, it copies the line to the merge output file.
For any line that has changed between the base contributor and one other contributor, it accepts the change in the contributor; depending on how you started the merge operation, ClearCase may copy the change to the merge output file. However, you can disable the automated merge capability for any given merge operation. If you disable this capability, you must approve each change to the merge output file.
For any line that has changed between the base contributor and more than one other contributor, ClearCase requires that you resolve the conflicting difference.
Figure 45 ClearCase Merge Algorithm
To merge versions, you can use the GUI tools, described briefly in the next section, or the command-line interface, described in Using the Command Line to Merge Elements.
ClearCase provides three graphical tools to help you merge elements:
Merge Manager
Diff Merge
Version Tree Browser
The Merge Manager manages the process of merging one or more ClearCase elements. It automates the processes of gathering information for a merge, starting a merge, and tracking a merge. It can also save and retrieve the state of a merge for a set of elements.
You can use the Merge Manager to merge from many directions:
From a branch to the main branch
From the main branch to another branch
From one branch to another branch
You can start the Merge Manager in several ways:
Click Start > Programs > ClearCase > Merge Manager.
In ClearCase Explorer, click Base ClearCase, and then click Merge Manager.
The Diff Merge utility shows the differences between two or more versions of file or directory elements. Use this tool to compare up to 16 versions at a time, navigate through versions, merge versions, and resolve differences between versions.
You can start Diff Merge in several ways:
On the shortcut menu in Windows Explorer, click Compare.
In the Merge Manager, click Compare.
The Version Tree Browser displays the version tree for an element. The version tree is useful when merging to do the following:
Locate versions or branches that have contributed to or resulted from a merge
Start a merge by clicking on the appropriate symbol
The merge can be recorded with a merge arrow, which is implemented as a hyperlink of type Merge.
You can start the Version Tree Browser in several ways:
Click Start > Programs > ClearCase > Version Tree Browser
On the shortcut menu in Windows Explorer, click Version Tree.
Use the following commands to perform merges from the command line:
For more information on these commands, see the Command Reference.
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |