To merge selective versions from a subbranch

About this task

Complete each of the tasks:

Procedure

  • To prepare a destination view for merging selective versions from a subbranch:
    1. Start a dynamic view or change directories to a snapshot view. The view must select the target version (the latest version on the branch that will contain the results of the merge). In this scenario, the view must select opt.c@@/main/8. (See the figure.) If such a view does not exist, create one.
    2. If the target version is checked out to your view for other revisions, check it in.
  • To find changes before merging selective versions from a subbranch, you can use any (or all) of the following methods:
    • View element history to see checkin comments. Depending on the quality of the comments, you may be able to narrow your search to a smaller set of versions.
    • Display the element version tree to see the versions arranged graphically by branch. Position the mouse pointer over a version to see its checkin comment.
    • Compare versions.
    • Open a version in an editor to see its contents.

      In a snapshot view, use the cleartool get command to see the contents of versions not loaded into your view.

      On the Windows® system, you can also use the Send To command in the Version Tree Browser or History Browser to see the contents of versions not loaded into your view.

  • To merge changes from selective versions of a subbranch, you can use either XML Diff Merge to merge XML files, or Diff Merge to merge text files and directories:
    1. Check out the target version. For example, in this scenario,
      cleartool checkout opt.c
    2. Issue the cleartool merge command with the -insert -graphical arguments. (You cannot start a selective merge from Diff Merge.)
      cleartool merge [ -graphical ] -to target-path -insert contributor-version-selector  [contributor-version-selector]

      Use -graphical to complete merges in the Diff Merge tool.

      Specify two contributors to define an inclusive range of versions; only the changes made in that range of versions are merged.

      Examples

      For example, the following command merges only the changes in version 4 on the r1_fix branch:
      • On the UNIX® system or Linux®:
        cleartool merge -graphical -to opt.c -insert -version /main/r1_fix/4
      • On the Windows® system:
        cleartool merge -graphical -to opt.c -insert -version \main\r1_fix\4
      This command merges only the changes in versions 2 through 4 on the r1_fix branch:
      • On the UNIX® system or Linux®:
        cleartool checkout opt.c  cleartool merge -graphical -to opt.c -insert -version /main/r1_fix/2 /main/r1_fix/4
      • On the Windows® system:
        cleartool checkout opt.c  cleartool merge -graphical -to opt.c -insert -version \main\r1_fix\2 \main\r1_fix\4 
    3. Resolve conflicting differences in the merge window. Depending on the type of contributors you chose, either the Diff Merge or XML Diff Merge window opens.
    4. Save the merge results.
  • To test and check in merge results:
    1. In the view that contains your merge results, build and test the results, resolving any build errors.
    2. When you are satisfied with the build and test results, check in the target version.
    Tip: In a selective merge, a merge arrow is not created; such an arrow indicates that all of the data of a version is merged, not merely some of its data.