clearcase commands
Post on 02-Jun-2018
250 Views
Preview:
TRANSCRIPT
-
8/10/2019 ClearCase Commands
1/25
ZDSCorporation
___________________________________________________________________
Rational ClearCase Commands
Release 1.1
1/27/2004
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
2/25
ZDSCorporation
___________________________________________________________________
Revision History
Rev Date By Change
1/27/2004 Dave Goodall Created
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
3/25
ZDSCorporation
___________________________________________________________________
Table of Contents
asi!s
01 "o Get #elp
02 "o enter !leartool.0$ "o e%it !leartool.04 "o navigate inside !leartool.
0& "o enter graphi!s mode 'slo( )*t gorgeo*s+.
,ile Che!-o*ts and Che!-ins0 "o Che!- o*t a ile.
07 "o !an!el a !he!-o*t.0 "o !he!- o*t a previo*s version o a ile.
0 "o ind (hat o* have !he!-ed o*t.
10 "o ind o*t (hat other iles are !he!-ed o*t.11 "o Che!- in a ile.
12 "o !he!-in or !he!-o*t m*ltiple iles.
3a)els
1$ "o list e%isting la)els.14 "o o)serve the naming !onventions or )ran!hes and la)els.
1& "o a-e a la)el.1 "o la)el a version o a ile.
17 "o appl a la)el to the entire so*r!e tree.1 "o move an e%isting la)el do(n to the latest elements.
1 "o see i a la)el is on the latest version o a ile or on a )ran!h.
,ile and 5ersion 6normation20 "o !hange the !omment or a revision.
21 "o !hange the !ontent des!ription or a ile.22 "o list the histor 'versions (ith !omments+ o a ile.
2$ "o ind o*t (hat iles have )een (or-ed on sin!e ....24 "o ind o*t the ile_tpe o a ile.
2& "o set*p !leartool to send email on a ile !hange.
Dire!tor perations2 "o add a ne( dire!tor to the so*r!e tree.
27 "o rename a dire!tor in the /gl/vo)s/netman/sr! tree.2 "o rename a vo) dire!tor or element.
,ile perations 8 Add ove 9ename2 "o Add a ne( ile to an e%isting dire!tor.
$0 "o *se sm)oli! lin-s avoid d*pli!ating an ar!hive ile in dierent dire!tories.$1 "o move an atria ile rom one dire!tor to another.
$2 "o ma-e a vie( private !op o a ile.
$$ "o remove :rm: a Cleartool ar!hive ile.$4 "o loo- at a ile that has )een Cleartool :rm:d:.
ran!hes
$& "o 3ist e%isting )ran!hes.$ "o a-e a )ran!h.
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
4/25
ZDSCorporation
___________________________________________________________________$7 "o merge a )ran!h )a!- to the mainline.
9eleases
$ "o )*ild a release.$ "o o)tain a dire!tor listing o the so*r!e tree or a release.
40 "o o)tain a list o ile !hanges sin!e the last release.
Administrator41 "o remove 'destro+ the latest version's+ o a ile.
42 "o loo- at o*r !onigspe!.4$ "o !hange o*r !onigspe!.
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
5/25
ZDSCorporation
___________________________________________________________________
1. ntrod!"tion
Rational 'ClearCase' aka 'Cleartool', is a powerful, elegant version control system.Since it's heritage is Unix, the manual is ... obscure. These battle teste commans
shoul get you up an running...
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
6/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # Basi"s
01. "o get help
DOS bigots will appreciate the intuitive nature of the Unix equivalent of 'Help': 'man'
(aka anual !ages"
#o get help on the entire comman$ set enter:cleartool man
#o get help on a specific comman$ enter:
cleartool man command(eg: cleartool man cofor help on the checkout comman$"
02. "o enter Cleartool
cl%returnhe prompt will change to cleartool
0$. "o e%it Cleartool.
exit%return&or
quit%return&
04. "o navigate inside Cleartool
Use the stan$ar$ c$ or c$ comman$s to navigate the $irector tree
Warning! )e aware that if ou exit from *leartool back to the shell after having move$
aroun$ in the $irector tree within *leartool+ that ou will ,O# be returne$ to the
$irector that ou were in when ou entere$ *leartool from the shell
#he pw$ (present working $irector" comman$ can help ou keep track of where ou are
0&. "o enter graphi!s mode 'slo( )*t gorgeo*s+.
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
7/25
ZDSCorporation
___________________________________________________________________
cl xlsvtree filenameor
xcleartool
#hexlsvtreegraphics viewer is a powerful tool for viewing the version tree of a file -t is
ver useful for visual $iffing of one version of the file against another+ labelling versionsor moving labels aroun$
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
8/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # $ile Che"%in Che"%o!t
0. "o !he!- o*t a ile.
cleartool checkout file.extor
cl co file.extcl co -c "comment" file.ext
.n$ comment with: .or
*leartool will prompt for a comment if ou $o not use the thir$ format to suppl one
/lthough ou ma not be use$ to provi$ing a $escription of the changes at checkout timeot is goo$ practice to enter the reason ou are checking out the file
Other team members can then see who has the file out an$ wh
0hen ou check the file back in this text will be presente$ as the $efault ci change
$escription+ which ou can overri$e -f ou are forethoughtful about the comment most
often it will not nee$ to be re1tpe$ when ou $o the checkin
#he file checke$ out stas in the same $irector but the permission changes from rea$
onl to rea$2write
07. "o !an!el a !he!-o*t.
cl unco file.ext
0. "o !he!- o*t a previo*s version o a ile.
#hisshouldbe:
cl co file.ext@@/main/version#>an$ it is a $efect in the tool that this comman$ is not implemente$
-nstea$+ ou will have to $o a tap $ance to get the version ou want in our view:
34 cl co file.ext
35 cl exitto return to the shell
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
9/25
ZDSCorporation
___________________________________________________________________
36pwdto make sure ou are in the right $irector at the shell level -f not+ navigate tothe right $irector
37 cp file.ext/main/version# tmpfile.ext
8ou can then change tmpfile as require$+ cp2cop it to the atria $irector with the correctname+ enter cleartool again an$ check the file in .xit cleartool to the shell to rm2$elete
the temporar file Using a tmp9name will help ensure that ou $on't screw up an$ $eletethe atria archive file b mistake
0. "o ind (hat o* have !he!-ed o*t.
cl lsco -me -all
;emember to $o this at the en$ of our session to make sure ou have not forgotten to
check back in files an$ $irectories
Other team members cannot access the files for up$ate until ou have checke$ them back
in+ an$ will have to waste time $iffing an$ merging our changes with theirs if the areforce$ to use private copies
10. "o ind o*t (hat other iles are !he!-ed o*t.
cl lsco -all
11. "o !he!- in a ile.
cleartool checkin file.extor
cl ci -c "comment" file.ext
*leartool will $ispla the comment ou entere$ at co time as the $efault 8ou ma
overri$e this if ou want to
.n$ comment with %ret&%ret& or %ctrl&1$
Do ,O# use -ncwhich means no comment*omment our versions
12. "o !he!-in or !he!-o*t m*ltiple iles.
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
10/25
ZDSCorporation
___________________________________________________________________
#o 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 2004All rights reserved.
-
8/10/2019 ClearCase Commands
11/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # &abels
1$. "o list e%isting la)els.
cl lstype -lbtype
14. "o o)serve the naming !onventions or )ran!hes and la)els.
branch names: all lower case eg:forwardin! ip! ap
-
8/10/2019 ClearCase Commands
12/25
ZDSCorporation
___________________________________________________________________
36 )e in the top level (2src" $irector#o appl the label throughout the tree:
mklabel -recurse -c "1 *elease" ,yabel .0ait a long time
1. "o move an e%isting la)el do(n to the latest elements.
mklabel -recurse -replace ,2&%
will move existing label 89
-
8/10/2019 ClearCase Commands
13/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # $ile and 'ersion nformation
20. "o !hange the !omment or a revision.
an revision control tools won't let ou change a comment once committe$+ on groun$s
of theolog (#ich $i$n't permit it"+ or control freakieness (tpicall -S installations"
*leartool is realistic+ an$ accomo$ating+ so ou have a chance to correct an$ revisecomments as nee$e$
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
$irector
21. "o !hange the !ontent des!ription or a ile.
0hen ou set up a file initiall on atria with -mkelem+ ou can use the -c "comment"qualifier to recor$ a $escription of the contents of the file
#o change this subsequentl:
chevent -c "content description" -rep file.ext@@/main/version#
22. "o list the histor 'versions (ith !omments+ o a ile.
cl lshist -all -since 9:;99 file.ext
(ill list all !hanges made to the ile sin!e the time spe!iied.
2$. "o ,ind o*t (hat iles have )een (or-ed on sin!e a given date.
-t is sometimes ver useful to get a list of all the changes ma$e to the source tree since agiven $ate
cl lshist -all -since
-
8/10/2019 ClearCase Commands
14/25
ZDSCorporation
___________________________________________________________________
24. "o ind o*t the ile_tpe o a ile.
#his is useful to confirm that a file is store$ b *leartool in an appropriate format
.lement tpe : Use withtext9file : =lat ascii text filefile : /n binar file that ou $on't min$ *leartool compressing for storage
compresse$9file : )inar file that's alrea$ compresse$ an$ ou want *leartool to store
as1is
#o fin$ this out enter:
describe file.extor
describe
2&. "o set*p !leartool to send email on a ile !hange.
8ou ma want to cause e1mail to be sent to email han$le 'supercon' when a particular file
has been up$ate$
#his is particularl useful+ for example+ if ou have patche$ the source in a commercial
librar an$ ou want to be sure that when the librar is upgra$e$ our changes $o not get
overwritten+ as the newest version of the librar ma or ma not have correcte$ the errorour patches peviousl correcte$
#he e1mail notification acts as a helpful remin$er to re1test for the bug which wasencountere$ in the earlier version+ an$ re1up$ate an$ re1buil$ the commercial librar if
the librar ven$or $i$ not fix the problem
How to $o it:
34: >et ?O) access
35: *reate an e1mail notification script in unix format an$ a$$ it to atria =or example:
*ourtes aric kollmer:#8/bin/sh
mailx -s "leartool warnin; *eminder on Aib update" supercon5B,%C 5ew Dersion of dialo.cppcreate; E%*%0&)5 by;E%*%0&F0* omment strin;-------------0omeone has really done it now! they installed a new version of Aib8.$his may cause problems as C made the followin patches to ;dialo.cpp in the ABialoGrame;;create46 method to correct .....
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
15/25
ZDSCorporation
___________________________________________________________________
0o! you had better re-test with the new A%pp libraries linked in andverify that trhe new library fixes this problem-,e 0elf 4(((6 ' KnameLf$rier>
.xample:
cl mktrtype -nc -element -postop checkout -exec/l/vobs/netman/src/Aapp/source/lenayre.sh len$rier
37: /ttach the trigger to an existing element:
cl mktrier -nattach KnameLf$rier> KnameLflement$o%ttachCt$o>
.xample:
cl mktrier -nattach len$rier dialo.cpp
#he examples shown will sen$ e1mail $ocument to supercon when $ialogcpp is checke$1
out
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
16/25
ZDSCorporation
___________________________________________________________________
ClearCase # Dire"tory ()erations
2. "o add a ne( dire!tor to the so*r!e tree.
/gain a multi part operation as+ to achieve transparenc+ $irectories are themselves vob
(versione$" ob@ects
34 =irst checkout the $irector un$er which ou want to create the new sub1$irectorcl co -c "%dd directory xxx" .
#he perio$ in$icates that ou are checking out a $irector
35 mkdir xxx
36 >ive the new $irector privilege level AAB
cl protect -chmod II( .
37 #o verif the privilege level is AAB
ls -adl .
#he $irector attribute string shoul$ be: $ rwr rwr r1x (A A B"
#hese last two steps will ensure that someone else can later manipulate the $irector
without having to come back to ou to beg for the privilege
27. "o rename a dire!tor in the /gl/vo)s/netman/sr! tree.
.g: 2src2ui2thunk9ar
34 *hange to the $irector ou want to rename eg: 2ui2thunk9ar an$ check it out:
cl co .
35 *heckout the $irector above the $irector ou want to rename : eg 2ui
cl cd..cl co .
36 ;ename the $irector b mv'ing it:cl mv thunk&ar thunk&
-
8/10/2019 ClearCase Commands
17/25
ZDSCorporation
___________________________________________________________________
2. "o rename a vo) dire!tor or element.
*heckout the $irector that contains the $irector or element to be rename$
Do
cl mv oldname newnamefor the $irector or element *heck it in
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
18/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # $ile *dd +ove Rename
2. "o Add a ne( ile to an e%isting dire!tor.
#his is multi part operation as to achieve transparenc+ cleartool $irectories are
themselves versione$ So
34 =irst+ ou have to checkout the $irector+ because a$$ing a file will change the$irector .nter a checkout comment which can also serve as the check in comment later
cl co -c "%dd file xxx" .
#he perio$ in$icates that ou are checking out a $irector
35 ake an (empt" file 'element'
cl mkelem -c "file description" file.ext
,O#. #his assumes that the new element has an extension that is known to *leartool -fnot+ an$ ou get a gobble$egook message '*ant pick element tpe from' then ou must
specif an element tpe eg:
cl mkelem -c "onfi stuff" -eltype text&file cb.cf
#he file tpes are:
text_file8 ,lat as!ii te%t ilefile8 An )inar ile that o* don:t mind Cleartool !ompressing or storage.
compressed_file8 inar ile that:s alread !ompressed and o* (ant Cleartool tostore as;is.
36 *op the source co$e to the new file
37 *heckin the file #his will be the first revision
cl ci -c "comment" file.ext
3B *heck the $irector back in
cl ci .
#he $efault comment ou supplie$ in #1above sboul$ be ok
3C 8ou shoul$ check that ou have set up the file with an apppropriate storage tpe See:
#ip 57'#o fin$ out the file tpe of a =ile'
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
19/25
ZDSCorporation
___________________________________________________________________
$0. "o *se sm)oli! lin-s avoid d*pli!ating an ar!hive ile in dierent dire!tories.
Suppose we have $irector / with archive$ fileext eg: 22?O)S22/2fileext an$ we
want to have the same file in Director )
;ather than $uplicate the file+ we can place a link in $irector 22?O)S22) to point tothe 'real' archive file in $irector /
#o setup the link:
Change to the dire!tor
Che!-o*t the dire!tor8 cl co -c "Link to file A" .Change to the A dire!tor
-
8/10/2019 ClearCase Commands
20/25
ZDSCorporation
___________________________________________________________________
#his will remove the archive from the view+ but it is still accessible an$ can be viewe$ orretrieve$ if ou nee$ it again at some later time
Warning!-f ou use rm filenameoutsi$e *leartool ie at the shell level the file is >O,.
$4. "o loo- at a ile that has )een Cleartool :rm:d:.
more .@@/main/(/file.ext@@/main/%$0$
;eplace 'B' with the last version of the $irector that containe$ the file
-nstea$ of moreou can use less1 see man lessfor info
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
21/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # Bran"hes
$&. "o list e%isting )ran!hes.
cl lstype -brtype
$. "o a-e a )ran!h.
34 cl mkbrtype alean$ enter appropriate comments ($oesn't matter where in the tree ou are"
35 mklbtype alebasean$ enter appropriate comments
36 )e in the top level (2src" $irector
mklabel -recurse alebase .to appl the label throughout the tree
0ait a long time
37 .$it our configspec to use the branch,ote that if ou use the graphical (xlsvtree" viewer to look at a file at this point+ the new
branch will not show up ,o+ ou $i$n't $o anthing wrong #he new branch will not be
*reate$ until ou check the file out
$7. "o merge a )ran!h )a!- to the mainline.
=inall+ a chance to screw up bigtime
34 Use 'catcs' ( #ip 56 :
-
8/10/2019 ClearCase Commands
22/25
ZDSCorporation
___________________________________________________________________
0e're not going to tr an$ verif the merge here an$ now *lick '' to accept thegenerate$ merge files+ until all the files are processe$
3B -n the root $irector ou will fin$ a =-se %lsvtree or something e?*ivalent to di the !he!-ed o*t ile against the
prede!essor ile on the main;line.5eri the merged ile is the (a o* (ant it and edit it i not.
*ild the app to veri the !hanges are 'snta!ti!all+ valid.9egression testing the app (o*ld )e ni!e.
Che!-in the veriied iles to the mainline.; rm the ile.!ontri) iles. "r not to rm the ile o)@e!t ) mista-e.
3A ,ote #here is no such thing as a vali$ merge$ $lg file
)ring up the latest mainline an$ latest branch $lg files in a resource e$itor an$ han$ toolthe changes
ClearCase Commands
ZDS Corporation 2004All rights reserved.
-
8/10/2019 ClearCase Commands
23/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # Releases
$. "o )*ild a release.
34 Use catcs 2 e$csto set up our configspec with
element abel$ouildGrom
35 -!O;#/,# ake sure that ou have commente$ out with the '3' smbol:#element /main/%$0$
=ailure to $o this will mean that later file versions up$ate$ /=#.; the labelle$ versions
will get into the buil$
$. "o o)tain a dire!tor listing o the so*r!e tree or a release.
34 Use #ip 46comman$ to get a list of existing labels
0rite $own the label for the release ou want eg ';.
-
8/10/2019 ClearCase Commands
24/25
ZDSCorporation
___________________________________________________________________
-n the $irector at the top of the src tree:
find . -version 3version4/main/%$0$677 8lbtype4*%0&> pooh.bar3
#his will recursivel examine the source tree an$ output to poohbar a list of the fileswith hea$ versions with no label ie the changes since the last label was applie$ to all the
files
Find the last label placed on a file in clearcaseBY BRIANON JULY 1, 2011 INRO!RA""IN!
I#$ %sin& 'cleartool describe#(
assin& in a for$at of ')l# to *%st &rab labels(
+he sed portions strip off the parentheses and all b%t the first label(
Labels are ordered neest to oldest(
1cleartool describe -fmt'%l'my_file_name.txt | sed's/,.*//;s/
(//;s/)//;'
ClearCase Commands
ZDS Corporation 2004All rights reserved.
http://variedthoughts.com/author/brian-2/http://variedthoughts.com/author/brian-2/http://variedthoughts.com/category/programming/http://variedthoughts.com/category/programming/http://variedthoughts.com/category/programming/http://variedthoughts.com/author/brian-2/http://variedthoughts.com/category/programming/ -
8/10/2019 ClearCase Commands
25/25
ZDSCorporation
___________________________________________________________________
ClearCase Commands # *dministrator
41. "o remove 'destro+ the latest version's+ o a ile.
Warning!Don't $o this without being sure ou know what ou are $oing
#his comman$ will chop off the latest version from a file+ inclu$ing versions above it if
the version is not the latest onermver file.exe@@/main/version#
42. "o loo- at o*r !onigspe!.
catcs
#his will $ispla the $irectives that *leartool is currentl using to filter files into ourlogical 's:' $rive eg:
# Setup to access the main branch
element * /main/LATEST
#Setup to build an entire labelled version
#and ONLY iles labelled this !a"
#element */main/LATEST
must be commented out
#or iles added/chaned later than this !ill et included in the build#element *$ELEASE%&'()
# Setup to access the tier branch# element * /main/tier/LATEST
# element * /main/tierase +m,branch tier
# element * /main/LATEST +m,branch tier
4$. "o !hange o*r !onigspe!.
edcs
top related