How merging works

A merge combines the contents of two or more files or directories into a single new file or directory. The HCL VersionVault merge algorithm uses the following files during a merge (see Figure 1):
  • 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.) The HCL VersionVault merge algorithm 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 1. Versions involved in a typical merge

A version tree of element opt.c is shown with two branches: main and r1_fix.

Merging files and directories involves the following actions:
  1. The base contributor is identified.
  2. Each contributor is compared against the base contributor. (See Figure 2.)
  3. Any line that is unchanged between the base contributor and any other contributor is copied to the merge output file.
  4. Any line that has changed between the base contributor and one other contributor is accepted in the contributor.

    Depending on how you started the merge operation, the change may be copied 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.

  5. For any line that has changed between the base contributor and more than one other contributor, you are required to resolve the conflicting difference.
Figure 2. HCL VersionVault merge algorithm

Versions B, C1, and C2 are shown as a triangle.

To merge versions, you can use the graphic user interface (GUI) tools or the command-line interface.