You are on page 1of 6

CLEARTOOL IS THE PRIMARY COMMAND-LINE INTERFACE TO

CLEARCASE

VERSION-CONTROL AND

CONFIGURATION MANAGEMENT SOFTWARE. IT HAS A RICH SET OF SUBCOMMANDS THAT CREATE, MODIFY,
AND MANAGE THE INFORMATION IN

VOBS

AND VIEWS.

Clearcase View
Each developer must create a view to work in Clearcase. View can be named using the following
information: <username_project_task> or any other name which is preferable to the user. There is
no hard rule to have a specific view name.
The Clearcase view creation script is located at /auto/edatools/cisco/bin/cc_mkview.
Usage: cc_mkview -t <view tag> <view space directory> -s blr-atg-lnx
Example: cc_mkview -t skb_dv /ws/skarapur/ -s blr-atg-lnx
This will create the view skb_dv under /ws/skarapur/skb_dv/

Instructions to follow while checking in and out files


You must check out a file or directory before you can modify it:
1) The revision files all reside in the Clearcase file system, so you cant circumvent
and make a non-checked out file by changing its protection
2) Directories must be checked out before you can add files to or delete files from them
cleartool checkout <file or directory name> ...
cleartool checkout -unreserved <file or directory name>
cleartool co -c <comment> <file or directory name> ...
cleartool co -nc <file or directory name> ...
Two types of check-outs:
Reserved : Only one user is allowed to have a reserved check-out on a file or
directory and only that user is allowed to check-in a new version
Unreserved: Multiple users can have unreserved checkouts on a file or directory
and there is no guarantee of checking in before others
Check-outs can be changed between reserved and unreserved later:
cleartool reserve <checked out file or directory>
cleartool unreserve <checked out file or directory>
To add a new file to the revision control tree you must first create the element, and then
check it in:
1. The parent directory must be checked-out to do this
2. The parent directory, as well as the element that was added, must be checked-in
before the file will be visible in other views

cleartool co
cleartool mkelem
cleartool ci
cleartool ci

<Checkout Parent Directory>


<Element/file to be added>
<Checkin New element/file name>
<Check-inParent Directory>

Creating New Directories:


1. Check-out the parent directory
2. Create the new directory
3. Check the parent directory back in
cleartool co
cleartool mkdir
cleartool ci

<Checkout Parent Directory>


<directory to be added>
<Check-inParent Directory>

Commands to see the checkout and check in status:


cleartool lshistory <file_name> View the history of the file. If the file argument is omitted,
the history of all files in the directory will be shown.
cleartool lsco -cview -me -all
Display all files that are checked out by you in the
current view and in the current VOB only.
CLEARTOOL DESCRIBE <FILE-OR-DIR> List file or directory information. Lists branch and
version
of file and configspec used in view

Config Specs
Every Developer is responsible for maintaining his or her config spec. A view's config spec
(configuration specification) contains an ordered set of rules for selecting versions of elements.
The view's associated view_server process populates a view with versions by evaluating the
config spec rules. The basic config spec may look like this:
element * CHECKEDOUT
#element /vob/sse/asic/shared/ver/cvc/uvmpl/... /main/LATEST
include /vob/sse/lib/release/skybolt/chip.cs@@/main/221

Clearcase Quick Reference Commands


Some of the commonly used simple commands are listed below for quick reference:

COMMAND LINE

USAGE

Help and Information commands


cleartool MAN <CLEARCASE-COMMAND>
cleartool MAN <ENV_CCASE>
cleartool APROPOS <SEARCH-WORD>
cleartool HELP
cleartool HELP <CLEARCASE-COMMAND>
cleartool -VER
cleartool DUMP <ELEMENT-OR-DO>
ECHO $CLEARCASE_ROOT

Man page for Clearcase command


List Clearcase environment variables.
List commands and man page summaries for
related Clearcase command.
Help facility (simple). Lists possible command
arguments.
Display Clearcase, cleartool, db_server and
VOB database schema version.
Print internal Clearcase info.
Print current view path.

Clearcase View commands


CLEARTOOL LSVIEW
CLEARTOOL LSVIEW <VIEW-TAG>
CLEARTOOL MKVIEW -TAG <VIEW_NAME> -HOST
<SERVER_NAME> -HPATH <VIEW_PATH_DIR>

List all views


List view path.
Create a new view in "viewstore" Clearcase
server view mount point.
List view storage locations:
CLEARTOOL LSSTGLOC

CLEARTOOL SETVIEW <USER-NAME_VIEW>


CLEARTOOL STARTVIEW <COMMON_VIEW>

CLEARTOOL ENDVIEW

<COMMON_VIEW>

CLEARTOOL ENDVIEW -SERVER <USERNAME_VIEW>


CLEARTOOL RMVIEW -TAG <TEMP_VIEW>
OR
CLEARTOOL RMVIEW <TEMP_VIEW>
CLEARTOOL PWV

Set current view to user-name_view.


Set current view to common_view without
starting a Clearcase shell environent. It allows
one to view (only) the files. This will make the
view active.
Deactivate a Clearcase view. (First exit view)
This can be useful when a view is not
performing as expected. End the view and
restart it to see if the problems resolved.
Useful if you get stale NFS handles.
Remove view temp_view.
Shows current working directory and view.

Configspec commands
CLEARTOOL CATCS
CLEARTOOL catcs -tag

<view_tag>

CLEARTOOL EDCS
CLEARTOOL SETCS -DEFAULT

Print rules of current view (configspec)


Look at the configspec associated with another
view.
Edit current rules of view (config spec):
Change from:
Reset to default view rules.

CLEARTOOL SETCS -CUR


CLEARTOOL UPDATE -ADD_LOADRULES

Re-evaluate current configspec.


Updates elemets in snapshot view. GUI tool.
Reevaluates config spec and reselects VOB
elements to show. The option "-add_loadrules"
allows you to load rules to your config spec and
load elements which satisfy the rules.

Working on Files and Directory commands


cleartool mkdir <directory name>
cleartool rm <directory name>
cleartool mkelem eltype <file_type>
<file_name>

cleartool mv <file> <new_file>


cleartool RMELEM -RM <FILE_NAME>
cleartool RMVER
<FILE_NAME>@@/MAIN/LATEST

Make a directory element


Remove a directory name
Create a new file element of type file_type. If
you create the file in the directory before
running the mkelem command, you can omit
the -eltype<file_type> portion of the command
and clearcase will determine the file type for
you.
Rename a file or directory
Remove file from Clearcase control.
Remove latest version checked in of the file
from Clearcase

Checkout and Check in commands


cleartool co <directory_name>
cleartool co <file_name>
cleartool ci <directory_name>
cleartool ci <file_name>

cleartool unco <file_name>

CLEARTOOL RESERVE

<FILE-NAME>

CLEARTOOL CHEVENT C <NEW COMMENT>


-REP <FILE1>@@/MAIN/<LATEST>/3
CLEARTOOL PROTECT -R -CHMOD <775>
<DIRECTORY-OR-FILE-NAME>

Checkout the directory


Check out the file. The version checked out is
version selected by the config spec.
Check in the directory
Check in changes. The file can not be identical
to the version that was checked out, and it
must be checked in from the view that checked
it out.
Un-checkout a file. This is useful when you
experimented on a file and no longer want to
save the changes.
Lock file. Convert unreserved checkout to
reserve.
Replace the comment string for file1
Set directory/file/element protection.

File and Directory listing commands


cleartool ls -l
cleartool LS -VOB_ONLY
cleartool LSTYPE -KIND LBTYPE -LIST LABELS
cleartool LSVTREE -ALL <FILE-NAME.EXT>
cleartool LSVTREE -ALL <PREF*>

Using current view, show files, private files, file


version and rule.
-vob_only: List elements and not derived
objects
List labels
List file version label and build label: (version
tree)
List file version label and build label for files
beginning with "pref"

cleartool lshistory <file_name>

cleartool LSCO

View the history of the file. If the file argument


is omitted, the history of all files in the directory
will be shown.
View the history of the directory.
View the differences between the current file
version and its predecessor.
Graphically view the differences between the
current file version and its predecessor.
List all checked out files in current directory.

cleartool LSCO R

Flag "-r" recusivly looks in sub directories.

cleartool LSCO -AVOBS -ME

Display all files checked out to all views.

cleartool lsco cview me -all

Display all files that are checked out by you in


the current view and in the current VOB only.
Display checkouts in view, all VOBs
List files in current directory and subdirectories
checked out to you in current view. Omit -CVIEW
tag to get all.
List all private files in current view.
List files checked out to current view.
Create a symbolic link to path name from link
path name.
List file or directory information. Lists branch
and version of file and configspec used in view

cleartool lshistory -d <directory_name>


cleartool diff -pred <file_name>
cleartool diff -pred g <file_name>

cleartool LSCO -AVOBS -CVIEW


cleartool LSCO -RECURSIVE -ME -CVIEW
cleartool LSPRIVATE
cleartool LSP -CO
cleartool LN SLINK <PATH_NAME>
<LINK_NAME>
CLEARTOOL DESCRIBE <FILE-OR-DIRECTORY>

Working with Tree and Branch commands


cleartool MKBRTYPE -C "COMMENTS"
<BRANCH_NAME>
CLEARTOOL MKBRANCH -NC <BRANCH-NAME>
<FILE-TO-BRANCH.CPP>

CLEARTOOL
CLEARTOOL
TYPE>
CLEARTOOL
CLEARTOOL

RMBRANCH
RMTYPE -RMALL -BRTYPE

<BRANCH-

CHTYPE
MERGE

CLEARTOOL FINDMERGE
CLEARTOOL LSTYPE -KIND BRTYPE
CLEARTOOL LSTYPE -KIND BRTYPE -INVOB
</VOB/VOB-NAME>
CLEARTOOL LSVTREE -ALL *
CLEARTOOL LSVTREE <FILE-NAME>
cleartool FIND ./ -BRANCH 'BRTYPE(<BRANCHNAME>)' -PRINT

Create a new branch type object.


Create a new branch in version tree. Use the
command MKBRTYPE to create the branch type
(name) first. This command also checks out the
file. The config spec needs to include this
branch so file can be viewed.
Remove a branch in version tree.
Remove branch and all files / directories in
branch from Clearcase
Change element type or rename branch.
Merge changes/differences of a file from
another branch.
Determines whether a merge is required for a
file in your view.
List all branches.
List all branches in the vob specified.
List version trees (labels and branches) of files
(even those without labels or branches).
List all branches of specified file.
List files in branch with search name or
attribute.

Working with Label commands


CLEARTOOL MKLBTYPE -C "COMMENT"

Create a label to be used later.

<LABEL_NAME>
CLEARTOOL
CLEARTOOL
CLEARTOOL
NAME.EXT>
CLEARTOOL

LSTYPE -KIND LBTYPE -SHORT | SORT


MKLABEL -R <LABEL_NAME>
MKLABEL <LABEL_NAME> < FILE-

MKLABEL -REPLACE
<NEW_LABEL_NAME> <FILENAME.EXT@@/MAIN/4>
CLEARTOOL RMTYPE -LBTYPE -RMALL
<LABEL_NAME>

CLEARTOOL FIND -ALL -TYPE FILE -VERSION


'LBTYPE(<LABEL-NAME>)' -PRINT

List labels.
Create Label elements in directory tree.
Apply label to a file.
Apply label to a newer version of the file.
Remove a label of the name given. The option
"-rmall" causes the removal of all instances of
the label on all files / directories. Remove label
type and all occurrences of the label.
Find all files with given label in the VOB

You might also like