Professional Documents
Culture Documents
Corporation
___________________________________________________________________
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
Revision History
Rev Date
1/27/2004
By
Dave Goodall
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
Change
Created
ZDS
Corporation
___________________________________________________________________
Table of Contents
Basics
01 To Get Help
02 To enter cleartool.
03 To exit cleartool.
04 To navigate inside cleartool.
05 To enter graphics mode (slow but gorgeous).
File Checkouts and Checkins
06 To Check out a file.
07 To cancel a checkout.
08 To check out a previous version of a file.
09 To find what you have checked out.
10 To find out what other files are checked out.
11 To Check in a file.
12 To checkin or checkout multiple files.
Labels
13 To list existing labels.
14 To observe the naming conventions for branches and labels.
15 To Make a label.
16 To label a version of a file.
17 To apply a label to the entire source tree.
18 To move an existing label down to the latest elements.
19 To see if a label is on the latest version of a file or on a branch.
File and Version Information
20 To change the comment for a revision.
21 To change the content description for a file.
22 To list the history (versions with comments) of a file.
23 To find out what files have been worked on since ....
24 To find out the file_type of a file.
25 To setup cleartool to send email on a file change.
Directory Operations
26 To add a new directory to the source tree.
27 To rename a directory in the /gl/vobs/netman/src tree.
28 To rename a vob directory or element.
File Operations : Add Move Rename
29 To Add a new file to an existing directory.
30 To use symbolic links avoid duplicating an archive file in different directories.
31 To move an atria file from one directory to another.
32 To make a view private copy of a file.
33 To remove 'rm' a Cleartool archive file.
34 To look at a file that has been Cleartool 'rm'd'.
Branches
35 To List existing branches.
36 To Make a branch.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
37 To merge a branch back to the mainline.
Releases
38 To build a release.
39 To obtain a directory listing of the source tree for a release.
40 To obtain a list of file changes since the last release.
Administrator
41 To remove (destroy) the latest version(s) of a file.
42 To look at your configspec.
43 To change your configspec.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
1. Introduction
Rational 'ClearCase' aka 'Cleartool', is a powerful, elegant version control system.
Since it's heritage is Unix, the manual is ... obscure. These battle tested commands
should get you up and running...
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : Basics
01. To get help
DOS bigots will appreciate the intuitive nature of the Unix equivalent of 'Help': 'man'
(aka Manual Pages)
To get help on the entire command set enter:
cleartool man
To get help on a specific command enter:
cleartool man command
(eg: cleartool man co for help on the checkout command)
cl<return>
The prompt will change to cleartool.
exit<return>
or
quit<return>
Warning! Be aware that if you exit from Cleartool back to the shell after having moved
around in the directory tree within Cleartool, that you will NOT be returned to the
directory that you were in when you entered Cleartool from the shell.
The pwd (present working directory) command can help you keep track of where you are.
05. To enter graphics mode (slow but gorgeous).
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
cl xlsvtree filename
or
xcleartool
The xlsvtree graphics viewer is a powerful tool for viewing the version tree of a file. It is
very useful for visual diffing of one version of the file against another, labelling versions
or moving labels around.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : File Checkin Checkout
06. To check out a file.
cl unco file.ext
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
#3. pwd to make sure you are in the right directory at the shell level. If not, navigate to
the right directory.
#4. cp file.ext/main/version# tmpfile.ext
You can then change tmpfile as required, cp/copy it to the atria directory with the correct
name, enter cleartool again and check the file in. Exit cleartool to the shell to rm/delete
the temporary file. Using a tmp_name will help ensure that you don't screw up and delete
the atria archive file by mistake!
cl lsco -all
ZDS
Corporation
___________________________________________________________________
To check in, or check out multiple files at once with the same comment:
cl ci -c "comment" *
cl co -c "comment" *
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : Labels
13. To list existing labels.
cl lstype -lbtype
cl mklbtype BETA_1.1B
Note: The convention for labels is as above: all caps.
This is typically done for alpha, beta, final releases so that the entire set of files with the
label can be built.
#1 Use 'catcs/edcs' (Tip 43) to set up your configspec with
element * MyLabel
element * /main/LATEST
#2 mklbtype MyLabel and enter appropriate comments.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : File and Version Information
20. To change the comment for a revision.
Many revision control tools won't let you change a comment once committed, on grounds
of theology (Tichy didn't permit it), or control freakieness (typically MIS installations).
Cleartool is realistic, and accomodating, so you have a chance to correct and revise
comments as needed.
chevent -c "comment" -rep file.name@@/main/version#
will replace an existing comment for revision n on the main trunk.
chevent -c "comment" -rep *
will replace the existing comments on the latest revisions of all files in the current
directory.
When you set up a file initially on atria with -mkelem, you can use the -c "comment"
qualifier to record a description of the contents of the file.
To change this subsequently:
chevent -c "content description" -rep file.ext@@/main/version#
It is sometimes very useful to get a list of all the changes made to the source tree since a
given date.
cl lshist -all -since 31-Jul-96.23:59
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
24. To find out the file_type of a file.
You may want to cause e-mail to be sent to email handle 'supercon' when a particular file
has been updated.
This is particularly useful, for example, if you have patched the source in a commercial
library and you want to be sure that when the library is upgraded your changes do not get
overwritten, as the newest version of the library may or may not have corrected the error
your patches peviously corrected.
The e-mail notification acts as a helpful reminder to re-test for the bug which was
encountered in the earlier version, and re-update and re-build the commercial library if
the library vendor did not fix the problem.
How to do it:
#1: Get VOB access.
#2: Create an e-mail notification script in unix format and add it to atria. For example:
Courtesy aric kollmyer:#!/bin/sh
mailx -s "Cleartool warning: Reminder on zLib update" supercon
ENDMAIL New Version of dialog.cpp
create: $CLEARCASE_PN by:
$CLEARCASE_USER Comment string:
------------Someone has really done it now, they installed a new version of zLib!.
This may cause problems as I made the following patches to :
dialog.cpp in the zDialogFrame::create() method to correct .....
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
So, you had better re-test with the new zApp libraries linked in and
verify that trhe new library fixes this problem
-Me Self (555) 123-4567 Quincy, CA meself@hotmail.com
ENDMAIL
#3: Register the script file as a trigger.
cl mktrtype -nc -element -postop checkout -exec
<nameAndFullPathOfScriptFile> <nameOfTrigger>
Example:
cl mktrtype -nc -element -postop checkout -exec
/gl/vobs/netman/src/zapp/source/glenayre.sh glenTrigger
#4: Attach the trigger to an existing element:
cl mktrigger -nattach <nameOfTrigger> <nameOfElementToAttachItTo>
Example:
cl mktrigger -nattach glenTrigger dialog.cpp
The examples shown will send e-mail document to supercon when dialog.cpp is checkedout.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase : Directory Operations
26. To add a new directory to the source tree.
Again a multi part operation as, to achieve transparency, directories are themselves vob
(versioned) objects.
#1 First checkout the directory under which you want to create the new sub-directory.
cl co -c "Add directory xxx" .
The period indicates that you are checking out a directory.
#2 mkdir xxx
#3 Give the new directory privilege level 775
cl protect -chmod 775 .
#4 To verify the privilege level is 775
ls -adl .
The directory attribute string should be: d rwr rwr r-x (7 7 5)
These last two steps will ensure that someone else can later manipulate the directory
without having to come back to you to beg for the privilege!
Eg: /src/ui/thunk_ar
#1 Change to the directory you want to rename eg: /ui/thunk_ar and check it out:
cl co .
#2 Checkout the directory above the directory you want to rename : eg /ui
cl cd..
cl co .
#3 Rename the directory by mv'ing it:
cl mv thunk_ar thunk_31
#4 Check in the directories:
cl ci .
cl cd thunk_31
cl ci .
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : File Add Move Rename
29. To Add a new file to an existing directory.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
30. To use symbolic links avoid duplicating an archive file in different directories.
co -unreserved
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
This will remove the archive from the view, but it is still accessible and can be viewed or
retrieved if you need it again at some later time.
Warning! If you use rm filename outside Cleartool ie at the shell level the file is GONE!
more .@@/main/5/file.ext@@/main/LATEST
Replace '5' with the last version of the directory that contained the file.
Instead of more you can use less - see man less for info.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : Branches
35. To list existing branches.
cl lstype -brtype
#1 cl mkbrtype Eagle
and enter appropriate comments (doesn't matter where in the tree you are).
#2 mklbtype Eaglebase and enter appropriate comments.
#3 Be in the top level (/src) directory.
mklabel -recurse Eaglebase .
to apply the label throughout the tree.
Wait a long time.
#4 Edit your configspec to use the branch.
Note that if you use the graphical (xlsvtree) viewer to look at a file at this point, the new
branch will not show up. No, you didn't do anything wrong. The new branch will not be
Created until you check the file out.
ZDS
Corporation
___________________________________________________________________
We're not going to try and verify the merge here and now. Click 'y' to accept the
generated merge files, until all the files are processed.
#5 In the root directory you will find a FILExxxx log, listing all the files merged. Print it.
#6 Using the log printout as a control:
Use xlsvtree or something equivalent to diff the checked out file against the
predecessor file on the main-line.
Verify the merged file is the way you want it and edit it if not.
Build the app to verify the changes are (syntactically) valid.
Regression testing the app would be nice.
Checkin the verified files to the mainline.
- rm the file.contrib files. Try not to rm the file object by mistake.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : Releases
38. To build a release.
This is useful when you want to do a code review prior to a new release.
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands
ZDS Corporation 2004
All rights reserved.
ZDS
Corporation
___________________________________________________________________
ClearCase Commands : Administrator
41. To remove (destroy) the latest version(s) of a file.
Warning! Don't do this without being sure you know what you are doing!
This command will chop off the latest version from a file, including versions above it if
the version is not the latest one!
rmver file.exe@@/main/version#
catcs
This will display the directives that Cleartool is currently using to filter files into your
logical 's:' drive. eg:
# Setup to access the main branch
element * /main/LATEST
#Setup to build an entire labelled version
#and ONLY files labelled this way
#element */main/LATEST
must be commented out
#or files added/changed later than this will get included in the build
#element *RELEASE_3.01
# Setup to access the tigger branch
# element * /main/tigger/LATEST
# element * /main/tiggerBase -mkbranch tigger
# element * /main/LATEST -mkbranch tigger
edcs
[End Document]
ClearCase Commands
ZDS Corporation 2004
All rights reserved.