ClearCase
frĺn kommandoraden
STARTING CLEARCASE
GUI: xclearcase & OR xcc & when prompted, select view "default"
Command Line: cleartool or ct (" cleartool " has been
aliased to " ct ").
You can run clearcase two ways from the command line, single-command mode,
or interactive.
Single-Command Mode: Enter clearcase commands preceded by a " ct " from
the shell (you must first set a view). The benefit of preceding all commands
with ct is that you are still in the shell and have access to UNIX features
like VI that you won’t have in interactive mode. Because you have more features
available to you, you may prefer single-command mode.
Interactive Mode: Enter clearcase with the ct command and issue commands
without the preceding " ct ". If you are in clearcase in single-command mode,
you can return to the shell by typing exit. If you are in this mode, commands
may work differently than if you were in the shell (i.e. using single quotes
around search strings parameters is required in interactive mode, but not in
all cases in single-command mode) . You may wish to be in interactive mode
if you really don’t want to precede all commands with " ct ".
VOBS (Versioned Object Bases)
Mounting a VOB is not necessary unless the server is rebooted. After a reboot
you have to mount the VOB. Only one person needs to mount the VOB to make
it accessible to everyone. To work on files found in our exclusive SSI VOB,
you must change to that directory after you set your view.
List a VOB: ct lsvob *pm_2008 (use single quotes if using Clearcase
exclusively, search text optional) In the list displayed, a '*' indicates VOB
is mounted.
Mount a VOB: ct mount <name of vob>
Unmount a VOB: ct umount <name of vob >
ELEMENTS
To create an element, you must first (1) check out the directory ( ct co <directoryname > ?).
The element is (2) created, (3) checked out, and the (4) element and (5) directory
are checked back in. Remember that all config spec rules apply. If you want
this element to be in the main node, you must make sure your config spec does
not make or place it in a branch you did not intend.
List Version Tree of an element: ct lsvtree -merge <filename.c >
Graphical image of tree: ct lsvtree -graphical <filename.c>
Creating a New Clearcase Element: ct mkelem <filename> (Copy file
to new location and then convert it to a Clearcase element.)
VIEWS
Set a View: ct setview <view-name>
Display the Current Working View: ct pwv
List all active views: ls -F /view
Deactivate a View: ct endview
Create your own view: ct mkview -tag viewname /ccviews/viewstore/viewname.vws
What views exist (yours and everyone elses)? ct lsview -short (without
path name)
May use wildcards (single quotes required in shell): ct lsview -short ‘specificViewName*’
Deleting a View:
1. Exit all processes that are accessing the view.
2. Ensure that no checkouts remain in the view. ct lsco -cview -avobs
3. Check for any view-private files you may wish to keep. To get a list of
view-private files (excluding DOs and checkouts), set the view in a shell and
enter: ct lsp -other. Copy any files you wish to save to a location
outside of the VOB, or convert them into Clearcase elements. Once you've completed
these steps, the view can be removed.NOTE: You cannot delete a view while you
are set into it!
4. ct rmview -tag <VIEW-TAG>
CHECKOUTS/CHECKINS
co can be used instead of checkout. unco can be used insted of uncheckout.
Checkout, no comment: ct checkout -nc <filename(s)>
Checkout, comment: ct checkout -c ‘Testing Check-ins’ <filename(s)>
Checkout particular version: ct checkout -nc bios.h@@/main/int_bios_p01_00/4
This might be a good time to use ‘ct lsvtree <filename>’ to make
sure that your check out was completed on the intended version. Depending on
how your config spec is set, this could change.
List Checkouts: ct lscheckout -short (lists all files checked out. Omit ‘-short’ for
all file information) Important: lscheckout will only list those files that
are checked out in the current directory.
Check File Back In: ct ci <filename > (Multiple file names may
be specified on the same line)
Uncheckout: ct uncheckout <filename >
Note: A branch will still exist and must be removed as well
TYPES OF CHECKOUTS:
- Reserved - guarantees no merging, no one else can check it out, others
who check out the element unreserved must wait until you put it back to do
a merge.
- Unreserved - May need to merge or wait until a reserved checkout has been
completed
- Branch - Almost always merge the branch back to the mainline. Assures
that you are not affecting the mainline and allows checkin of incremental
version of the element without affecting others looking at the main line.
These incremental checkins allow you to share your work with others before
you are ready to merge
CONFIG SPEC
Edit Config Spec: ct edcs
Display Current View’s Config Spec: catcs (do not precede with ct even while
running in the shell)
Set Config Spec: setcs <config spec name > (do not precede with ct even
while running in the shell)
Config Rule Meaning
| element * CHECKEDOUT |
Selects your checkouts |
| element * /main/LATEST |
Selects latest version on main branch |
| element * .../<branch_name>/LATEST |
Selects latest version on branch <branch_name> |
| element * <LABEL> |
Selects elements that have label <LABEL> |
| element * <some rule>-time <time> |
Selects elements satisfying the rule <some rule> that existed prior
to time <time> -time
Time examples: 15-Nov.11:00, yesterday, 19:05, Tuesday |
| element * <some rule > -mkbranch < branch_name > |
Checkouts from elements selected by the rule <some rule >automatically
occur on branch <branch_name >, creating that branch if necessary |
| element /vobs/apps/UIDemo/* <LABEL> |
Selects all elements in the directory /vobs/apps/UIDemo that have label <LABEL> |
HISTORY
List History of Record: ct lshistory
BRANCHES
The easiest way to create a new branch is to create a new branch type. Then
in your config spec, change the -mkbranch command to read this new type.
When a file is checked out, the branch (as defined in the config spec) is
created automatically.
Defining Branch Type: ct mkbrtype -c ‘<comment >’ <branch name>
Removing a Branch: ct rmbranch <branch name >
LABELS
ct mklbtype <labelname>
MERGE
Merging a version to a branch, a proven demonstration:
1. ct ci <file>
2. <change your config spec so the destination branch is visible>
3. ct co <file>
4. ct merge -to <file> -version <from branch>
5. ct ci <file>
Example of a Merge:
Say you're working on file "xyz" and your config spec looks like this:
element * CHECKEDOUT
element * .../dev/LATEST
element * .../int/LATEST -mkbranch dev
element * /main/LATEST -mkbranch int
You've just finished making your changes (to version xyz@@/main/int/dev/CHECKEDOUT)
and you want to merge those changes into the "int" branch.
1) Check in the file: ct ci xyz
2) Change your config spec so that the branch to which you are merging is
the visible one (i.e., remove the "dev" branch). So now your config spec looks
like this:
element * CHECKEDOUT
element * .../int
element * /main/LATEST -mkbranch int
3) Check the file out: ct ci xyz (Now you've checked it out from int,
and you're looking at version
xyz@@/main/int/CHECKEDOUT.)
4) Merge your changes into the checked-out version: ct merge -to xyz -version
main/int/dev/LATEST
Things to notice about this command: a) the "-to xyz" clause points to the ".../int/CHECKEDOUT" version
because your config spec points it there; and b) the "-version main/int/dev/LATEST" clause
tells it the version to copy from.
5) Check the (now updated) file back in: ct ci xyz
Merging a version to a branch, according the clearcase manual:
1. First set your config spec to read as follows:
element * CHECKEDOUT
element * .../int_bios_p01_00/LATEST
element * /main/LATEST -mkbranch int_bios_p01_00
2. Check-in the file to your branch, ct ci <filename > (branch
name does not need to be specified)
3. ct findmerge <filename > -fversion /main/int_bios_p01_00/nameofbranch/LATEST
-merge
4. Check-in your file to the integration node, ct ci <filename > (node
does not need to be specified)
Process of a merge, a textbook example:
1. Make sure no element is checked out on the major branch.
ct ls checkout -avobs | egrep ‘(automotive|trans).*/major/’
2. ct setview <any team view name> (Perform any directory merges
that must take place)
3. ct findmerge /proj/automotive/trans -type d -fversion /main/LATEST -merge
(as in above step)
4. ct findmerge /proj/automotive/trans -fversion /main/LATEST -print -merge
-xmerge (lots of output)
5. cat findmerge.log.04-Feb-96.10:01:23 (this log file is output from
above command)
6. ct lock -nusers henry,allison,david,george brtype:major (lock branch)
HELP
| ct help |
Lists all cleartool subcommands |
| ct help <command> |
Syntax of Command |
| ct man <command> |
Man page on <command> |
| apropos <command> |
Display summary information on cleartool subcommands |
BUILD
Force everything (including libraries) to build: clearmake -u
Prevent "wink-in" derived objects from other views during build: clearmake
-V
DERIVED OBJECTS
List Derived Objects: lsdo
Remove Derived Object from VOB: rmdo
Wink-in Derived Objects: winkin
INVOKING GRAPHICAL COMMANDS
Some commands can invoke the GUI Clearcase. For those times when a picture
is the only way.
lsvtree -graphical
merge -graphical
lshistory -graphical
diff -graphical
lsvob -graphical
man -graphical
CLEARCASE COMMANDS
VIEWS
pwv (print working view)
lsview (list all views)
setview
mkview
rmview
startview
endview
recoverview
reformatview
lsvtree (version tree of a file)
CONFIG SPEC
edcs
catcs
setcs
LOCK
lock
unlock
lslock
ATTR
mkattr
rmattr
mkhlink
rmhlink |
CHECKOUTS
lscheckout | lsco
checkout | co
uncheckout | unco
checkin | ci
reserve
unreserve
BRANCHES
mkbranch
rmbranch
mkbrtype
MERGE
merge
rmmerge
findmerge
find
POOL
mkpool
lspool
rmpool
chpool
TRIGGER
mktrigger
rmtrigger
TAG
mktag
rmtag |
VOBS
checkvob
mkvob
rmvob
lsvob
reformatvob
mount
unmount
TYPE
lstype
rmtype
chtype
cptype
mkeltype
mkbrtype
mklbtype
mkattype
mkhltype
mktrtype
REGION
mkregion
rmregion
lsregion
DERIVED OBJECTS
lsdo
rmdo
LABEL
mklabel
rmlabel |
| OTHER CLEARCASE COMMANDS |
rmver
lsreplica
lsreplica
catcr
diffcr
lsprivate
winkin
hostinfo |
register
unregister
annotate
relocate
space
getlob
lsclients |
chevent
mkelem
complete-migration
protect |
|