3.5 Checking In Files

Until you check in a file, ClearCase has no record of the work in your view. Checking in a file or directory element creates a new version in the VOB, which becomes a permanent part of the element's history. We recommend that you check in a file or directory any time you want a record of its current state.

Ideally, your organization's development strategy isolates your checked-in work from official builds and requires you to merge your work to official project versions at specified intervals.

To Check In Files

  1. In ClearCase Explorer, select one or more files.

  2. Right-click a selected file. On the shortcut menu, click Check In.

  3. In the Check In dialog box, ClearCase displays the comments you entered when you checked out the file. You can reuse these comments or modify them.

Merging with the Latest Version

If the version you checked out is not the latest version in the VOB and you try to check in your modifications, ClearCase requires you to merge the changes in the latest version into the version checked out in your view (Figure 16).

Figure 16 Merging with the Latest Version

In Figure 16, version 2 of prog.c is the one that you checked out. Before you check in your modifications, someone else checks in version 3 of prog.c. When you check in your modifications, ClearCase tells you that the version you checked out is not LATEST on the branch. (The section Under the Hood: What Happens When You Check Out a File or Directory describes the situations in which you may have to merge before checking in.) Note that the reserve status of the checkout is not relevant to whether your modifications can be checked in.

You need to merge the latest version in the VOB (prog.c@@/main/LATEST) to the version in your view before you can check in your modifications. This merge creates a version that reconciles modifications made in the latest version with your modifications. Then, when you check in the merge results, the system sees the merge arrow from version 3 to your checked-out version containing the merge results. The checkin creates a version 3 successor, version 4 of prog.c.

To Merge with the Latest Version

When you issue the Check In command for a nonlatest version, you are prompted to merge. If you choose to merge, ClearCase attempts to merge automatically, starting the Diff Merge tool if it needs your input to complete the merge. For information about using Diff Merge, see ClearCase online help. After the merge, ClearCase prompts you to check in the file.

Under the Hood: Checking In Files

The steps ClearCase follows when you issue the checkin command vary depending on the kind of view you use.

From a Snapshot View

When you issue a checkin command from a snapshot view, ClearCase handles the request as follows:

  1. It copies your modifications to the VOB as a new version.

  2. The version you check in remains in the view, regardless of the view's config spec.

  3. It removes write permission for the file.

For any other instance of the file loaded into a snapshot view, ClearCase copies the new version from the VOB into your view. (If your load rules specify an element that appears in more than one VOB location, the element is copied into each of the appropriate locations in your view's directory tree.)

When you check in a symbolic-linked directory from a snapshot view, ClearCase does not update any other instances of the directory loaded in your view. As you add file elements to source control, ClearCase adds a copy of the element to all instances of a parent directory loaded in your view.

From a Dynamic View

When you issue the checkin command from a dynamic view, ClearCase handles the request as follows:

  1. It copies your modifications to the VOB as a new version.

  2. It uses the config spec's version-selection rules to select a version from the VOB. If the config spec selects a version other than the one you checked in, ClearCase displays a message. ClearCase may select another version if, for example, your view selects versions based on labels or time rules.

  3. It removes the view-private file and provides transparent access to the version checked in to the VOB.

Checking In Files in a VOB Enabled for ClearQuest

If you use the base ClearCase-ClearQuest integration (see Checking Out Files in a VOB Enabled for ClearQuest), the version you are checking in must be associated with at least one change request; otherwise, the checkin cannot proceed. When you check in the version, the base ClearCase-ClearQuest integration displays those change-request IDs whose associations you made during checkout. Using the options in Table 1, you can do the following:

If the associations are correct, use the OK option to continue the checkin.

The base ClearCase-ClearQuest integration creates associations for new change-request IDs that you add, removes associations for change-request IDs that you delete, and updates information on existing ones.

View the Versions for a Change Request from ClearQuest

To view the ClearCase versions associated with a ClearQuest change request:

  1. In ClearQuest, run a query to find the desired set of change requests.

  2. In the query result set, select a change request to display its Record form.

  3. On the Record form, click the ClearCase tab.

The ClearCase tab shows the last known names of the versions of ClearCase elements associated with the change request.