Updating a Snapshot View


The rules in the config spec of your view are usually designed to select a discrete set of versions from the VOB. For example, your view is usually intended to contain a set of versions that build successfully. However, when other developers check in new versions from their views, a snapshot view may become out of date or inconsistent with the versions in the VOB. To make sure that your view contains the set of versions the config spec selects, you must update it.

This chapter explains

An update operation copies versions of elements from a VOB to your view. Only the checkin operation copies changes from your view back to a VOB.

Starting an Update Operation

You can start an update operation for

Updating the Entire View

Update the entire view periodically to make sure you have the correct version of all loaded files and directories.

To update the view, use cleartool update with any of the following options:

cleartool update [ –print ] [ cti·me | –pti·me ] snapshot-view-path

The snapshot-view-path argument is optional if you enter the update command from the root directory of the view.

Use these command options as follows. (For a description of all available command options, see the update reference page in the Command Reference.)

–print
Produces a preview of the update operation: instead of copying or removing files, update prints a report to standard output of the actions it would take for each specified element.

–cti·me
Sets the time stamp of a file element to the current time, that is, the time at which the version is copied into the view.The command option –ctime has no effect on directories (directories always use the current time). The initial default for the time stamp is set by the mkview command. Thereafter, the most recently used time scheme is retained as part of the state of the view and is used as the default behavior for the next update.

–pti·me
Sets the time stamp of a file element to the time at which the version was checked in to the VOB. The command option –ptime has no effect on directories. (Directories always use the current time.)

For example:

cleartool update ~/pat_1.4_cropcircle_sv 

Note: You can use the Update Tool instead of the command line to update the view.

To Start the Update Tool

To start the Update Tool, enter the following command:

cleartool updategraphical snapshot-view-path

The snapshot-view-path argument is optional if you enter the update command from the root directory of the view. When the update is complete, the Update Tool window displays a categorized list of the actions taken to update the view (see Figure 37). For a description of this window, see the Help.

Figure 37 Update Tool Window

Updating Files and Directory Trees

To save time, you can update individual files or directories. (Rational ClearCase updates directories recursively.) Updating only specific parts of your view may eventually cause the view to contain an inconsistent set of versions.

Enter the following command:

cleartool update [ –print ] [ cti·me | –pti·me ] paths-of-loaded-elements

For information about these command options, see Updating the Entire View. For information about all available command options, see the update reference page in the Command Reference.

Note: You cannot update a checked-out file. To undo changes to a checked-out file and start over with the version in the VOB, cancel the checkout. See Canceling Checkouts.

Under the Hood: What Happens When You Update a View

When you start an update operation, ClearCase compares the version of the elements loaded in the view with the version the config spec selects in the VOB. If the config spec selects a version in the VOB that is different from the version loaded in your view, ClearCase copies the version from the VOB into your view (Figure 38). ClearCase does not make this comparison or otherwise modify versions currently checked out to the view.

The update operation takes into account the fact that changes may be occurring in the VOB during the update. As ClearCase updates your view, other developers may check in new versions of elements that the load rules of your view select. To avoid loading an

inconsistent set of versions, the update operation ignores versions in the VOB that meet both of the following conditions:

The update operation adjusts for the possibility that the system clocks on different hosts in a network may be out of sync (clock skew).

Unloading Elements

If the config spec of a view no longer selects an element, ClearCase removes, or unloads, it from the view. Unloading does not affect view-private files or view-private directories.

Updating can cause an element to be unloaded from a view in the following situations:

Unloading Files

The action that ClearCase takes to unload a file depends on the current state of the file:

Figure 38 Update Operation

Unloading Directories

ClearCase unloads directories recursively. To unload a directory element, ClearCase unloads the files in the directory. If any view-private objects, hijacked files, or checked-out files are in the directory, or if the directory is currently in use (for example, if your current working directory is in or below the directory) ClearCase appends .unloaded to the name of the directory. For example, if the directory src contains view-private files, ClearCase renames the directory to src.unloaded.