Tuesday, January 21, 2014

ClearCase CheatSheets

1. ClearCase CheatSheet


ct help <command>                       Usage statement for command
ct man <command>                        Manual page for command

ct lsvob                                List VOBs
ct mount <vob-tag>                      Mount VOB
ct umount <vob-tag>                     Unmount VOB

ct lsview                               List views
ct startview <view-tag>                 Start view
ct setview <view-tag>                   Set view (UNIX)
ct endview <view-tag>                   Stop view
ct endview -server <view-tag>           Stop view and kill view server process
net use <drive:> \\view\<view-tag>      Map drive to view
net use <drive:> /d                     Disconnect drive from view

ct lsvtree <pname>                      Version tree browser
ct lsvtree -gra <pname>                 Version tree browser (graphical)

ct pwd                                  Print working directory
ct pwv                                  Print working view
ct ls                                   List contents of directory with ClearCase info
ct ls -view                             List only private files in directory
ct ls -vob                              List only vob elements in directory

ct lsprivate                            List private files in the view
ct lsco [-all] [-cview] [-s]            Find checkouts

ct mkview -tag <view-tag> <stg-dir>                     Create view
ct mkview -tag <view-tag> -stream <stream> <stg-dir>    Create view (UCM)
ct rmview -tag <view-tag>                               Remove view

ct mkstream <stream>                    Create stream (UCM)

ct lsact                                List activities at current stream (UCM)
ct setact <act-id> | [-none]            Set activities (UCM)
ct mkact -headline <headline>           Create activity (UCM)
ct rmact <act-id>                       Remove activity (UCM)

ct co [-unres] <pname>                  Checkout
ct ci <pname>                           Checkin
ct unco <pname>                         Uncheckout
ct reserve <pname>                      Change unreserved to reserved checkout
ct unreserve <pname>                    Change reserved to unreserved checkout

ct mkelem <pname>                       Make new file element
ct mkdir <pname>                        Make new directory element

ct mv <src-pname> <dest-pname>          Move an element
ct rmname <pname>                       Logical delete of element
ct ln [-s]                              Create link

------------------------------------------------------------------------------------------

<cmd> <pname>                           Operate on version selected by view
<cmd> <pname@@\version-id>              Operate on version given the version-id

ct diff [-gra] [-pred] <pname>          Diff tool
ct merge [-gra]                         Merge
ct findmerge                            Batch merge

ct mklbtype <label-type-name>           Create label type
ct mklabel <label-type-name> <pname>    Attach label
ct lock lbtype:<label-type-name>        Lock label

ct mkbl [-incremental | -full] <baseline-root-name>                Make baseline (UCM)
ct chbl [-level <promotion-level>]                                 Promote baseline (UCM)
ct chstream [-recommended <baseline-selector>] <stream-selector>   Recommend baseline (UCM)

ct rebase -gmerge -recommended          Rebase stream (UCM)
ct rebase -complete                     Complete rebase (UCM)

ct deliver                              Deliver activities (UCM)
ct deliver -complete                    Complete deliver (UCM)
ct deliver -activites <act-selectors>   Deliver specific activities (UCM)

ct setcs -stream                        Synchronize view

ct catcs                                View config spec
ct edcs                                 Edit config spec
ct setcs                                Set config spec

ct find                                 Search/Reporting utility

------------------------------------------------------------------------------------------

ct lsstgloc                             List all storage locations
ct mkstgloc                             Create storage location
ct rmstgloc                             Remove a storage location

ct mkvob -tag <vob-tag> <stg-dir>       Create VOB
ct rmvob <stg-dir>                      Remove VOB
ct describe vob:<vob-tag>               Display owner and group of VOB
ct protectvob                           Change owner and group of VOB

clearfsimport <src-path> <target>       Import files and directory structures
clearexport_*                           Export versioned files from another tool
clearimport                             Import versioned files

ct rmver                                Physically remove a version from VOB
ct rmbranch                             Physically remove an entire branch from VOB
ct rmelem                               Physically remove an entire element from VOB

ct relocate                             Relocate elements from one VOB to another

ct protect [-chown] [-chgrp] [-chmod]   Change element permission, owner, group
ct describe <element-path@@>            Display element permission, owner, group

mvfsstorage                             Display location of data container
ct dump                                 Display location of source and cleartext container

ct getlog                               Display error logs

ct mktrtype                             Create trigger type
ct mktrigger                            Attach/apply trigger
ct rmtrigger                            Remove a single instance of trigger
ct rmtype [-rmall] trtype:<trig-type>   Remove trigger type

ct mkattype <type-name>                 Create attribute type
ct mkattr <attype> <value> <pname>      Attach/apply attribute
ct rmattr                               Remove a single instance of attribute
ct rmtype [-rmall] attype:<att-type>    Remove attribute type

------------------------------------------------------------------------------------------

site_prep                               Prepare the ClearCase release area
setup / install_release                 Install ClearCase on client or server
clearlicense [-hostid]                  Display license information
rgy_passwd                              Set the registry password
ct hostinfo -l                          Display host ClearCase information

net stop albd                           Stop ClearCase services (Windows)
net start albd                          Start ClearCase services (Windows)
/etc/init.d/clearcase stop              Stop ClearCase services (UNIX)
/etc/init.d/clearcase start             Start ClearCase services (UNIX)

ct lsregion                             Display ClearCase regions
ct mkregion -tag <name>                 Create ClearCase region
ct rmregion [-rmall] -tag <name>        Remove ClearCase region

ct register (-vob|-view) <stg-path>     Register a VOB or view
ct unregister (-vob|-view) <stg-path>   Unregister a VOB or view
ct mktag (-vob|-view) -tag <tag> <stg>  Create a VOB or view tag
ct rmtag (-vob|-view) <tag>             Remote a VOB or view tag

rgy_check [-vobs] [-views] [-storage]   Verify registry integrity

ct lock vob:<vob-tag>                   Lock VOB
ct unlock vob:<vob-tag>                 Unlock VOB

ct recoverview -syn -tag <view-tag>     Recover stranded view private files

fix_prot                                Fix protection problems
dbcheck -a -k <vob_db>                  Scan RAIMA db for corruption
ct checkvob [-fix] -pool <vob-stg-dir>  Scan db/storage pools for consisten
---------------------------------------------------------------------------
more links:
http://www.yolinux.com/TUTORIALS/ClearcaseCommands.html


--------------------------------------------------------------------------------------------

2. http://www.ibm.com/developerworks/rational/library/836.html

Use this "cheat sheet" as a quick reference and practical aid to efficent use of IBM Rational® ClearCase®. Tips, reminders, and expert advice from one of Rational's in-house ClearCase pros answer the most common user needs.

Views


How many Views do I need?

Generally, one per discrete task is a good idea, though this is not a requirement. Views should be regarded as "cheap" entities that are easily created and destroyed. Create one for each task you need to do and when that task is done, delete the view.

Dynamic versus Snapshot Views

ClearCase and ClearCase LT offer snapshot views as workspaces. Snapshot views work by copying versions of elements from VOBs to your computer. To see the latest versions of elements, you need to update your snapshot view periodically. An update operation copies the latest versions of elements from the VOB to your view.
ClearCase (but not ClearCase LT) also offers dynamic views. A dynamic view uses the Multiversion File System (MVFS) to provide immediate, transparent access to data stored in VOBs. When you work in a dynamic view, you do not need to copy data fromVOBs to your view; you always see the latest versions of elements. Dynamic views also provide advanced functionality such as build auditing and binary sharing.

How to create a Dynamic View

cleartool mkview -tag atag  storage-location
Where atag is the view-tag (the "name" of the view which should be a name that you can easily remember) and storage-location is the location of a place on a disk where the view can store information.
Alternatively, there is a simplified command:
cleartool mkview -tag atag -stgloc -auto
In this example, you don't need to specify a storage location, but rather this command enables you to use a storage location that has been set up by your ClearCase admin.

How to delete a Dynamic View

cleartool rmview -tag atag
Where atag is the view-tag of the view you want to remove.

How to create a Snapshot View

cleartool mkview -snapshot -tag atag -stgloc -auto apathname
Where apathname is the path to which you want your source code (work area) to reside. The -tag atag is optional - if you omit it, ClearCase will make one up based on your username and the workspace you specify in apathname.

How to delete a Snapshot View

cleartool rmview apathname
Where apathname is the path to where your source code (work area) resides.

Modifying files


Checkout

To modify an element you need to check it out. Do this with the following command:
cleartool co anelement
where anelement is the name of the file or directory you want to check out.

Checkin

Once you are happy with the changes you have made to a checked-out element, you can check it in with the following command:
cleartool ci anelement
where anelement is the name of the file or directory you want to check in. Once you check-in an element, the changes you made to that element are usable by everyone on your project.

Uncheckout

If you want to cancel a checkout, you can do so with the following command:
cleartool unco anelement
where anelement is the name of the file or directory you want to check in.

Creating new files


Creation

To create a new file, you can use whatever editor or command you would normally use to create the file. The new file will be a view-private entity until you take the next step to put it under ClearCase control.

Putting a file under version control

To put a file under ClearCase control you must first check-out the directory that will be containing the file, issue the command to tell ClearCase to put the file under version control, and then check-in the directory containing the new file. Here are commands to perform these steps:
cleartool co thedirectory 
cleartool mkelem thefile 
cleartool ci thedirectory
After this sequence is performed, the file thefile is still checked-out and can be modified further before you check it in.

Deleting elements

To remove an element you should use the cleartool rmname command. This command removes the name of the specified element from the directory in which it is contained. Similar to placing an element under ClearCase control, you must first check-out the directory containing the element to be removed, do the cleartool rmname of the element, and then check-in the new version of the directory. Here is an example:
cleartool co thedirectory 
cleartool rmname anelement 
cleartool ci thedirectory
After this sequence, anelement is no longer listed in subsequent versions of thedirectory. It is, however, still listed in previous versions of the directory. If, at a later date you want to re-add anelement to a new version of thedirectory (or any other directory), you can do so easily.

Renaming elements

Renaming an element is similar to deleting it. First you check-out the old directory containing the element, and you also check-out the new directory to which the element is to be moved. Then you use the cleartool mv command to perform the move operation. Be sure to check-in the old and new directories when you are done.
cleartool co . 
cleartool co newdirectory 
cleartool mv anelement newdirectory 
cleartool ci . 
cleartool ci newdirectory
Renaming an element is also accomplished using the cleartool mv command except the old directory and the new directory are the same.
cleartool co . 
cleartool mv anelement anewname 
cleartool ci .
In subsequent versions of the directory, the name anelement will not appear, having been replaced by anewname but the name anelement will still appear in prior versions of the directory. Both the names anewname and anelement will still refer to the same element; only the name associated with the element in the directory will have changed.

Getting information


More about Views

What View am I in?
At any given time you can tell what view you are in by issuing the following command:
cleartool pwv
pwv means "print working view" in the tradition of the UNIX command pwd for "print working directory"

What is my "config-spec"?

Recall that a configuration specification (config-spec) is the set of rules that tells ClearCase what configuration of elements you want to work with. You can see that set of rules by issuing the following command:
cleartool  catcs

How do I change my config-spec?

You can edit your config-spec by issuing the following command:
cleartool edcs
Your favorite editor , as specified by the environment variable WINEDITOR (first choice), VISUAL (second choice), or EDITOR (third choice) will be invoked for the editing operation. If none of these environment variables is set then vi will be invoked for the editing operation on UNIX systems and Notepad will be invoked for the editing operation on Windows systems.

About files/directories


What is checked-out and to whom?

If you want to see who has what checked-out, you can use the cleartool lsco command. This command has a number of possible arguments to use depending on the specific information you want. Here are some common ones:
cleartool lsco
Lists all checkouts of elements in the current directory.
cleartool lsco anelement
List checkout information about the element anelement.
cleartool lsco -recurse
Lists all checkouts of elements in the current directory and below.
cleartool lsco -cview
Lists checkouts of elements in the current directory that are checked-out to the current view.
cleartool lsco -cview -recurse
Lists checkouts of elements in the current directory and below that are checked-out to the current view.
cleartool lsco -me
Lists checkouts of elements in the current directory that the current user has checked-out.
cleartool lsco -user fred
Lists checkouts of elements in the current directory that the user with login id "fred" has checked-out.
Please refer to the ClearCase Reference Manual for more detailed information about the cleartool lsco command.

What is the change history of this file/directory?

If you want to see the change history associated with a particular element, you can use the cleartool lsh command.
cleartool lsh anelement
Where anelement is the name of an element under ClearCase control

What versions of what files/directories am I looking at?

To see exactly what versions of elements are being projected to you by your view and why, you can use the cleartool ls command.
cleartool ls

What are the differences between this version of a file/directory and a different version?

To view the differences between the versions of an element visible in your view and another version of the element you can use the cleartool diffcommand.
cleartool diff -g -pred anelement
Graphically presents the differences between the version of anelement selected by your view and it's immediate predecessor version.
cleartool diff -g anelement anelement@@/main/5
Graphically presents the differences between the version of anelement selected by your view and version 5 on the main branch of anelement.
You can also use this command without the -g option to present the difference information to you textually rather than graphically.
See the cleartool diff entry in the ClearCase Reference Manual for more detailed information on these commands.

What does the version tree look like for this file/directory?

To view a graphical representation of the version tree associated with an element you can use the xlsvtree command.
cleartool lsvtree -g anelement
You can view a textual representation of the version tree associated with an element with the cleartool lsvtree command.
cleartool lsvtree anelement

I want more information about this element?

You can get more detailed information about a particular element with the cleartool describe command.
cleartool describe anelement
Lists information about anelement such as the version selected by your view, who created it and when, the comment associated with the version, the element type and the predecessor version.

2 comments: