4.2 Working with Checkouts

After you check out a file, you do not need to use ClearCase until you're ready to check it in. However, you may want to use some ClearCase tools for the following tasks:

Viewing an Element's History

The History Browser displays the history of an element's modifications, including version-creation comments (entered when someone checks out or checks in an element).

To View an Element's History

In a view, enter this command:

cleartool lshistory -graphical pathname

You can use this command from a snapshot view whether or not the element specified by pathname is loaded into the view.

Comparing Versions of Elements

As you modify source files, you may want to compare versions to answer such questions as these:

To Compare with a Predecessor

In a view, enter this command:

cleartool diff -graphical -predecessor pathname

The -diff_format option causes both the headers and differences to be reported in the style of the UNIX diff utility, writing a list of the changes necessary to convert the first file being compared into the second file.

To Compare with a Version Other Than the Predecessor
  1. In a shell, enter this command:

  2. cleartool lsvtree -graphical pathname

  3. In the Version Tree Browser, select a version.

  4. Click Version > Diff > Selected vs. Other.

  5. In the Enter other versions dialog box, select other versions and click OK.

If you prefer to use the command line:

  1. Use cleartool lsvtree to list an element's versions.

  2. Use the cleartool diff command with a version-extended pathname. For example, to compare the current version of prog.c with version 4:

  3. cleartool diff prog.c prog.c@@/main/4

You can use the lsvtree and diff commands from a snapshot view whether or not the element specified by pathname is loaded into the view. For more information, see the diff and pathnames_ccase reference pages in the Command Reference.

Comparing with a Change-Set Predecessor

A change set lists all versions you have created while working on a specific activity. In some cases, you create more than one version of an element for a specific activity. For example, for the activity Change copyright strings you check in a version of prog.c and realize later that you missed a string in the file. You then set your view to the activity Change copyright strings, check out prog.c, modify the string, and check in the file.

To see the changes you have made to an element while working on an activity, you can compare a version in the activity's change set with the version that immediately precedes the change set. In Figure 18, the change set predecessor of prog.c is version 2. You can compare any version of prog.c in the change set with version 2.

Figure 18 Compare with Change Set Predecessor

To Compare with a Change-Set Predecessor
  1. Display an activity's properties sheet. For example:

    1. Type clearprojexp.

    2. In Project Explorer, navigate to the stream that contains the activity.

    3. Right-click the activity and click Properties.

  2. In the activity's properties sheet, click the Change Set tab.

  3. Right-click the version you want to compare, and, on the shortcut menu, click Compare with Change Set Predecessor.

Tracking Checked-Out Versions

Depending on how you work, you may forget exactly how many and which files are checked out. To list all the files and directories you currently have checked out to your view, access the view and use the lscheckout command with the following options:

cleartool lscheckout -cview -me -avobs

For more information, see the lscheckout reference page in the Command Reference.

Viewing an Activity's Change Set

You can see which versions are in an activity's change set from ClearQuest, Project Explorer, or with cleartool lsactivity.

To View an Activity's Change Set from ClearQuest
  1. Use a query to find the activity. For example, to use MyToDoList:

    1. Type the following command:

    2. clearquest

    3. In the left pane, click Workspace > Public Queries > UCMUserQueries and run the MyToDoList query.

    4. ClearQuest displays MyToDoList list in the Query builder pane.

  2. In the Query builder pane, select a record.

  3. In the Record form pane, display the Change Set list. Your project manager determines the location of this list when she designs the record's record type.

To View an Activity's Change Set from Project Explorer
  1. Enter the following command:

  2. clearprojexp

  3. In Project Explorer, select a stream and right-click an activity in the stream; on the shortcut menu, click Properties.

  4. In the Properties dialog box, click the Change Set tab.

To View an Activity's Change Set with cleartool lsactivity

To see the change sets for all activities in your stream, enter the following command from your development view:

cleartool lsactivity -long -cview

To see the change set for the currently set activity only, enter the following command from your development view:

cleartool lsactivity -long -cact

The lsactivity output provides the ClearCase activity ID and versions in the change set. For example:

% cleartool lsactivity -long -cact

activity SAMPL051111

05-Aug-01.09:14:17 by Pat (pat.user@bread)

"Created for the cropcircle_1.4 project on 09/17/00 13:25:24."

owner: pat

group: user

stream: pat_1.4_CropCircle

title: changing_copyright_strings

change set versions:

/guivob/prog.c@@/main/stream990805.090736/5

/guivob/spices.c@@/main/stream990805.090736/2

/guivob/onions.c@@/main/stream990805.090736/9

/guivob/tomatoes.c@@/main/stream990805.090736/1

/guivob/flour.c@@/main/stream990805.090736/3

In a project that is enabled for ClearQuest, the ClearQuest record ID is the same as the ClearCase activity ID.

Moving Versions to a Different Activity

If you assign one or more versions to the wrong activity or if you create new activities to better represent your work, you can assign the versions to a different activity that is in your stream.

To Move Versions within a ClearCase Context
  1. Display an activity's change set. (For more information, see Viewing an Activity's Change Set.)

  2. On the Change Set tab, select one or more elements.

  3. Right-click a selected element, and on the shortcut menu, click Move to Activity.

To Move Versions within a ClearQuest Context
  1. Display an activity's change set in ClearQuest. For more information, see To View an Activity's Change Set from ClearQuest.

  2. Select an element from the Change Set list.

  3. Right-click the element, and on the shortcut menu, click Move to Activity.

  4. Follow the ClearCase prompts.