This page is my own personal work. Anyone can use it for their own edification, but must realize that this material is not supported by me and the site is not affiliated with IBM Rational Software or Atlassian.
Create an attribute type.
CLI (Windows & UNIX) | string (no limit on length) |
Windows Type Explorer | integer |
xclearcase | no default |
# ct mkattype [option(s)] attribute-nameSome common options:
-vty.pe | integer, real, time, string or opaque (see above for default) |
-vpe -vpb -vpv (scope) | Attributes can only be applied to elements, branches or versions respectively (default is all 3). |
-enu.m | Specify a comma separated list of permitted values. |
-def.ault | Supply a default value. |
-glo.bal | Allow the attribute to be used by other VOBs. |
[ -gt | -ge ][ -lt | -le ] | Allowed value ranges can be used for integer, real and time attribute types. |
-sha.red | Multiple CCMS sites can rmattr and mkattr on this type, but not if the object to which it is attached is mastered elsewhere. |
Modify an attribute type.
# ct mkattype -replace [option(s)] attribute-name
Attach an attribute.
$vob_o->AttributeType("My_Attribute_Type")->Apply($version_o,"My_New_Value","",1,0);
ct mkattr attribute-name \"value\" object-selectorSome CLI common options:
-rep.lace | Change an existing attribute to a new value. |
-con.fig derived object | Apply the attribute to all elements that went into a build. |
-r.ecurse | If applying to a directory, apply it recursively. |
-v.ersion version-selector | Apply it to a version other than selected by your view. |
-default | Use the predefined default value instead of providing one. |
Remove an attribute from an element.
# ct rmattr attribute-name elementA useful option:
-ver.sion version-selector | Specify a version other than selected by your view. For example, -ver '/main/{TESTED="False"}'. |
Modify an object's attribute value.
# ct mkattr -replace attribute-name new-value elementTable of Contents
Rename an attribute type.
# ct rename attype:old-name new-nameTable of Contents
Find objects with a certain attribute/value.
Versions: # ct find . -version "attr_sub(attribute,operator,value)" -print Elements: # ct find . -element "attr_sub(attribute,operator,value)" -print Branches: # ct find . -branch "attr_sub(attribute,operator,value)" -print
On UNIX: # ct find . -ver "lbtype(BLD1.1)" -exec 'cleartool mkattr -replace status \"tested\" $CLEARCASE_XPN' On Windows: # ct find . -ver "lbtype(BLD1.1)" -exec "cleartool mkattr -replace status \\\"tested\\\" %CLEARCASE_XPN%"If using the "cmd" executable to, say, copy files around, invoke it as "cmd /c copy ..." instead of simply "cmd copy ..." in the exec option's argument.
Change an attribute type's constraints.
# ct mkattype -replace constraint attribute-nameThe constraints are -vpe, -vpb and -vpv for one per element, branch and version respectively. No constraint argement means no constraints.
Include spaces in the value on the CLI.
Read an attribute value.
ct describe -fmt "%[attribute]a\n" object
$element_o = $vob_o->Element("My_File"); $attr_o = $element_o->Attribute("My_Attribute"); if ( "$attr_o" ne "" ) { $value = $attr_o->Value; }Table of Contents
Prevent certain users from modifying an attribute value.
Create a branch.
# ct mkbranch branch-type element-name
element * LABEL -mkbranch branch-typeTo set up automatic creation of nested branches:
element * CHECKEDOUT element -directory * /main/LATEST element * /main/branch1/branch2/LATEST element * /main/branch1/LABEL2 -mkbranch branch2 element * /main/branch1/LATEST -mkbranch branch2 element * /main/LABEL1 -mkbranch branch1 element * /main/LATEST -mkbranch branch1
element * CHECKEDOUT element -directory * /main/LATEST element * /main/branch1/branch2/LATEST mkbranch branch2 element * /main/branch1/LABEL2 element * /main/branch1/LATEST end mkbranch mkbranch branch1 element * /main/LABEL1 element * /main/LATESTFor the above example, EOF can be used in lieu of "end mkbranch".
Remove a branch.
# ct rmbranch element-name@@/main/branch-nameTable of Contents
Create a branch type.
# ct mkbrtype branch-nameSome useful options:
-rep.lace | Change the parameters of an existing branch type. |
-glo.bal | Declare it so that other VOBs can use it (see adminstrative VOB). |
-pbr.anch | Override the default to allow more than one branch of this name per element (not recommended). |
Rename a branch or branch type.
# ct rename brtype:old-name new-name
Branch instance:
# ct chtype new-branch-name element@@old-branch-path ex: # ct chtype dev1.1 foo.c@@/main/dev1.0
Set up a private branch. (Windows only)
Finish a private branch. (Windows only)
Find all elements that have an instance of a branch type.
# ct find path -element brtype(branch-name) -printThe path is the directory in which you want the search to begin.
Overview. (Windows only)
use Win32::OLE; $CC = Win32::OLE->new("ClearCase.Application"); if ( "$CC" eq "" ) { print "ERROR: Can't create ClearCase application object via call to Win32::OLE->new(): $!\n"; exit 1; } # Basic objects. $vob_o = $CC->VOB("\\vobtag"); $element_o = $CC->Element("relative_path\\file.txt"); $version_o = $CC->Version("file.txt\@\@\\main\\1");
Error messages.
$attribute_o = $element_o->Attribute("Attribute_Name"); if ( Win32::OLE->LastError() ) { print "ERROR: Unable to read the \"Attribute_Name\" attribute on file.txt.\n".Win32::OLE->LastError(); exit; } $value = $attribute_o->Value;
$attribute_o = $element_o->Attribute("Attribute_Name"); if ( "$attribute_o" ne "" ) { $value = $attribute_o->Value; }Table of Contents
Things you can't do using CAL.
Get a branch object.
$branch_o = $CC->Element(element-path)->Version->Branch; $branch_o = $CC->Version(version-path)->Branch; $branch_o = $CC->Version("branch-path\\0")->Branch;Table of Contents
Lock objects.
General ClearCase Remote Client (CCRC) notes.
Determine the temp directory used by CCRC.
cd "C:\Program Files\IBM\RationalSDLC\common\CM\scripts" set WAS_BIN="C:\Program Files\IBM\RationalSDLC\common\eWAS\bin" %WAS_BIN%\wsadmin -profileName cmprofile wsadmin> source teamAdminUtils.jacl wsadmin> dumpTeamServer
Add a file to source control.
View VOB contents without specifying a load rule.
CLI
Apply a baseline.
Write the .Rational\CCRC71\workspace\.metadata folder to a custom location.
Determine the location where CCRC writes .ccase_wvreg, .keystore_clearcase, and .ccase_wvreg_lockfile
Derived objects (general).
Derived objects can be referenced different ways:
1) simple name (if already local to view) -- ex: hello.o
2) view-extended naming -- ex: /view/view-tag/hello.o
3) VOB-extended naming -- ex: hello@@21-Dec.16:18.397
The unmbers at the end of the VOB-extended naming are the date
and an ID unique to that date.
List derived objects.
# ct lsdo [derived-object]A couple of the more useful options include:
-r.ecurse | List recursively. |
-me | Restrict listing to DOs under your control. |
-zer.o | List unshared DOs with a reference count of 0. |
-l.ong | Show reference counts and the views that reference them as well. |
Remove derived objects (DO).
# ct rmdo DO(s)Some useful options:
-a.ll | Remove all versions of the DO regardless of reference count. |
-zer.o | Similar to -all, but only delete those DO versions with zero reference counts. |
-bef.ore date-time | New in CC 2003.06.00. Delete DOs dated prior to a certain date-time. |
-sin.ce date-time | New in CC 2003.06.00. Delete DOs dated since a certain date-time. |
date | day-of-week | long-date |
time | h[h]:m[m][:s[s]] [UTC [ [ + | - ]h[h][:m[m] ] ] ] |
day-of-week | today |yesterday |Sunday | ... |Saturday |Sun | ... |Sat |
long-date | d[d]–month[–[yy]yy] |
month | January |... |December |Jan |... |Dec |
Configuration records (general).
Header | target, host info, time, view and initial working dir |
MVFS objects | each MVFS file read during the build (versioned & view-private) |
Non-MVFS | files explicitly mentioned by the makefile but not in CC |
Variables and options | values of make macros referenced by the build |
Build script | script executed by clearmake |
OSVERSION: sh=uname -r target.o: echo $(OSVERSION) > /dev/null $(CC) $(CFLAGS) target.cTable of Contents
Winkin a derived object.
# ct winkin derived-objectSee the derived object general discussion for DO naming conventions.
-pri.nt | Only list what would have been winked-in. |
-sib.lings | Wink-in DOs created by the same build script that created the named DO. |
-r.ecurse | Walk the DO's configuration record, winking-in subtargets of the named DO. |
-out | Specify a new local name for the DO (mandatory for view-extended name wink-ins). |
-nov.erwrite | Override the default of overwriting any existing unshared DOs. |
Use clearaudit.
# clearaudit -c "make [options]"
# clearaudit -c "tar cvf tarfile file(s)"
View a configuration record.
# ct catcr DOSome useful options:
-r.ecurse | Display the CRs of DO subtargets as well. |
-fla.t | Similar to -recurse, but consolidates into a list of unique versions. |
-uni.on | Similar to -flat, but one report for all DOs listed on the command line. |
-mak.efile | Similar to -recurse, but display output in makefile format. |
-wd | List pathnames relative to the current directory. |
-typ.e { f | d | l } | Specify the version types to report: files, directories or links. |
-l.ong | Include kinds of objects and their comments in the listing. |
-s.hort | Restrict output to file system objects only. |
-fol.low | New in CC 5.0/2002. List the targets of symbolic links, not the links themselves. |
-scr.ipts_only | New in CC 5.0/2002. Restrict the listing to the header and build script. |
Diff configuration records.
# ct diffcr DO-1 DO-2Some useful options:
-r.ecurse | Compares the DOs and their commom subtargets. |
-fla.t | Consolidate subtargets into a single unique listing. |
-wd | List pathnames relative to the current directory. |
-typ.e { f | d | l } | Specify the version types to report: files, directories or links. |
-l.ong | Include kinds of objects and their comments in the listing. |
-s.hort | Restrict output to file system objects only. |
-nxn.ame | Do not include version extensions when listing MVFS objects. |
-fol.low | New in CC 5.0/2002, list the targets of links and not the links themselves. |
Create non-shareable derived objects.
# ct mkview [ -sha.erable_dos | -nsh.areable_dos ] ...
Make a view's DOs shareable after creation:
# ct chview { -sha.reable_dos | -nsh.areable_dos } view-tag
Toggling whether a view's DOs can be shared or not only affects DOs created in the future. Non-shared DOs can be subsequently shared by doing a "winkin" on them or by using "view_scrubber -p". Once a DO has been shared, it cannot be unshared.
CC/CQ non-UCM integration.
Remove the CC/CQ non-UCM integration.
Set CC/CQ non-UCM integration policy.
CM API overview
Create an element.
# ct mkelem filenameFor non-existent files:
CLI: # ct mkelem filename CAL: $checkedout_o = $CC->CreateElement("$file_path");In general, the supertype of a file will be assigned based on the rules in the default.magic file located in "atria-home/conf/magic" on Unix or "ClearCase-home\config\magic" on Windows. However, that can be overridden with the mkelem -eltype element-type option. Unfortunately, automatic eltype assignment cannot be overridden when using either a UNIX or Windows GUI.
Remove an element.
# ct rmelem element
# ct rmname element-nameUse the &nbps; -nco option if you don't want to check-out the parent directory first; which would need to be done. To restore an element that has be de-referenced using the rmname subcommand, use the "ln" subcommand. That is, if code.c has been removed from the current version of the local directory.
# ct ln .@@/main/older-version/code.c code.cThe older-version is that last version of the current directory in which the file "code.c" existed. An lsvtree of the current directory for different versions will tell you in which version of the directory the element was last present.
# ct lsvtree .@@/main/versionSee also "Remove a version of an element."
Change an object's permissions.
# ct protect options element(s) -or- # ct protect options type:selector(s)Options:
-cho.wn new-owner | Change the owner of the object. |
-chm.od permissions | Change the permissions. |
-chg.rp new-group | Change the group of the object. |
-r.ecurse | Change protections recursively. |
-fil.e | -d.irectory | Restrict the recursive protection change. |
Rename an element.
# ct mv oldname newname
Link to another element.
# ct ln path/original-name linked-name -or- # ct ln -slink /another-vob/directory directory
Remove a reference to an element or symbolic link.
# ct rmname element -or- # ct rm softlinkTable of Contents
Remove references to view related elements from a VOB.
# ct describe -long vob:vobtag -or- # ct lsview -long viewtag # ct rmview -all -uuid view-uuid
This will place the missing "view.dat" file in the view's vws directory. # ccperl ccase-home\etc\utils\regen_view_dot_dat.pl Create a dummy directory somewhere and place the regenerated view.dat there. # mkdir C:\temp\tempview # copy vws-path\view.dat C:\temp\tempview Update the view and then perform the uncheckouts in the normal way. # cd \temp\tempview # ct updateTable of Contents
Merge elements.
# ct findmerge element -fversion version -print ex: ct findmerge word.doc -fversion /main/working_branch/LATEST -printSome useful options:
-fta.g view-tag | Look at the version selected by another view. |
-fve.rsion version-selector | To select a version marked by a tag. |
-fla.test | Select the LATEST version on the current branch. Useful if the checkedout version was checked out unreserved. |
-fcs.ets activities | (UCM only) Consider versions in the listed activities. |
# ct merge -to element -version version(s)Some useful options:
------ | |
-query | Start merge automatically and query to resolve conflicts. |
-abo.rt | Start merge automatically. Abort and roll-back if conflicts arise. |
-qal.l | Query on every merge. |
------ | |
-nda.ta | Create merge hyperlink, but don't actually merge. |
-nar.rows | Do merge without creating the merge arrow. |
------ | |
-g.raphical | Perform merge graphically. Merge result is editable on the fly. |
------ | |
-out view-private-file | Merge to a file other than the "to" version. No merge arrow recorded. |
-opt.ions "pass-through-options" | Merge can pass through options, such as -blank_ignore, to the merge tool See cleardiff for a list. |
Merge types:
Trivial | - | Nothing at all happened to one contributor. |
Automatic | - | Only one contributor has changed for any given chunk of text. |
Non-automatic | - | Cannot resolve conflict without human intervention. |
Merges can be done in a selective or subtractive manner. These type merges can only be done from the command-line (with the exception of a single version selective merge) and merge arrows are not recorded, as a merge arrow implies a cumulative merge. Examples:
Select a single version. # ct merge -to element -insert -version version-selector ex: ct merge -to foo.c -insert -version /main/bug_fix2/4 Select a range of versions. # ct merge -to element -insert -version from-version-selector to-version-selector ex: ct merge -to foo.c -insert -version /main/bug_fix2/2 /main/bug_fix2/6 If you want the range from versions 2 to 6, but not version 3, you must do two merges. Exclude a single version. # ct merge -to element -delete -version version-selector ex: ct merge -to foo.c -delete -version /main/bug_fix2/4 Exclude a range of versions. # ct merge -to element -delete -version from-version-selector to-version-selector ex: ct merge -to foo.c -delete -version /main/bug_fix2/2 /main/bug_fix2/6To determine the changes that took place for any given merge destination, use the annotate command. It writes a view-private file called element.ann.
# ct annotate element
# clearmrgman optionsThe base CC clearmrgman has many of the same options as "merge" and "findmerge".
-del.iver [ -to target-view-tag | -tar.get stream-selector ] | Deliver to the specified view or stream. |
-reb.ase -str.eam stream-selector | Rebase the specified stream. |
# xmldiffmrg operationOptions:
-xvi.ew | -xco.mpare | -xme.rge | Must specify an operation for xmldiffmrg to perform. |
-visible_blank | White-space characters are made visible by alternate glyphs representing the white space. |
-blank_ignore | Ignores white-space in white-space-only nodes. Can be used with -visible_blank. |
-hst.ack | Stack the panes horizontally. (default) |
-vst.ack | Stack the panes vertically. |
-out filename | Specify an output file for the merge result. |
-to to-version | Specify the version extended file that is both a contributor and merge result. |
-q.uery | Prompts you to proceed with every change. Changes in the to-version are still automatically accepted. |
-abo.rt | Merge only if completely automatic. |
-qal.l | Query the user for every change including those in the to-version. |
-enc.oding { utf-16 | utf-8 | iso-8859-1 | ascii } | If an output file is generated, use the specified encoding type. |
-bas.e version-selector | Specify a base selector other than the one that would have been chosen automatically. |
Change an element's type.
# ct lstype -eltype # ct chtype -nc new-element-type elementThis command can take awhile. For intsance, if you change from text_file to compressed_text_file and you have many text files, the system will immediately go through and compress all the data containers. Conversely, if changing from a type, such as text_file, to a user-defined type based on the supertype text_file, the command will complete instantly.
Move an element between VOBs.
# ct relocate element(s) /target_vob-tag/pathOptions:
-f.orce | Suppress the default confirmation step. |
-quall | Ask for confirmation for every relocated borderline element (such as linked elements). |
-upd.ate | Run in update mode. Does not remove originals. |
-log logfile | Record the transaction in a file other than the default relocate.log.date-time |
# ct lsprivate -tag view-tag -invob /vob-tag/pathIf view-private files become stranded during the relocate, they can be recovered. The recovered view-private files are placed in the view's lost+found directory in the view-storage area .s subdirectory. A view's lost+found directory doesn't exist until it's needed.
# ct recoverview -synchronize view-tag -vob vob-tag
Link type | original/linked-end | notes |
hard | in/in | The hardlink will be recreated as expected. |
hard | in/out | The hardlink will be split, one data-container in each VOB. Each element will still point to each other via a new HyperSlink hyperlink. |
soft | in/in | The softlink will be recreated as expected. |
soft | in/out | The data-container is moved. The end in the original VOB now points to the wrong place. |
soft | out/in | The data-container is not moved. The end in the new VOB now points to the wrong place. |
Diff two text elements.
# ct diff element element@@/main/branch/LATEST # ct diff -predecessor element # ct diff -graphical element /view/view-tag/elementNote that diff can only be used in a VOB context.
cleardiff
A cleardiff will give the same output as a simple diff command, but it
has more formatting options. It cannot diff directory elements and does
not have a -graphical option. The two files being diff'ed do not have to
be in CC.
# cleardiff element-version1 element-version2xcleardiff
# xcleardiff element-version1 element-version2Some useful options:
-b.lank_ignore | (diff) Do not display differences in blank lines when diff'ing. |
-col.umns n | Divide n by 2. Default n is 80; 40 chars per column. |
-tin.y | (diff or merge) Use smaller fonts. |
-vst.ack | (diff or merge) Display the diff'ed files stacked vertically (default is horizontal). |
-out | (merge) Specify a checkedout version or system file (required). |
-f.orce | (merge) Overwrite the output file, if it already exists. |
-bas.e base-pname | (merge) By default, xcleardiff does not calculate a base contributor. |
-q.uery | (merge) No automatic merging for non-trivial merges. |
-qal.l | (merge) No automatic merging at all. Automatically set if base not specified. |
-abo.rt | (merge) Abort if conflict arises. Used when called from a script. |
-pause | (merge) Do automatic merges, but pause for confirmation after each change. |
-win.dow | New in CC 2003.06.00. Disply the output in a separate difference window. |
See also cleardlg on Windows.
Remove a merge arrow from an element's version tree.
# ct rmmerge from-version to-versionTable of Contents
Remove a version of an element.
Delete uninteresting versions. # ct rmver element-name Delete a specific version. # ct rmver -version /main/bugfix/5 element-nameOther useful options:
-f.orce | don't ask for confirmation | |||
-xbr.anch | remove even if branch point, all version on the branch are removed also | |||
-xla.bel | remove even if labelled | |||
-xat.tr | remove even if attribute attached | -xhl.ink | remove even if hyperlink attached | |
-dat.a | only delete the data container leaving the database intact, explicitly invokes the above listed -x options | |||
-vra.nge | specify a range of versions |
Create a directory element.
# ct mkdir directory-element or # ct mkelem -eltype directory directory-element or CAL $checkedout_o = $CC->CreateElement("$directory_path","Auto-created folder","1","directory");For each method, the parent directory must be checked-out first. Unlike UNIX, there is no associated "rmdir" command. Must use the rmelem to delete a directory element. Any contents of a deleted directory element will end up in the lost+found directory.
-master | New in CC 2003.06.00. The replica in which element is created will explicitly master the main branch. |
List details about the contents of an element version.
# ct annotate -long -ndata elementSome useful options:
-nda.ta | Use when dealing with element types other than text. |
-nhe.ader | Suppress the header and output only annotated text lines. |
-out | Use to send output to a file other than element.ann. Use a dash "-" as the output filename to send to standard out. |
-rm | Show deleted lines. |
-a.ll | Show changes no matter what branch. That is, changes made to branches that don't affect the current version. |
-fmt format-string | Format the output. See fmt_ccase in the CC Reference Manual. |
-rmf.mt rm-format-string | New in CC 2003.06.00. Specify a format for deletion annotations. The default format is "DEL %Sd %-8.8u | ". |
Checkout an element.
$version_o = $CC->Version("$file_path"); $checkedout_o = $version_o->Checkout(0); $checkedout_o->Checkin;
# ct co elementCheckouts are recorded both in the view and VOB databases.
-ver.sion | Checkout a specific version not necessarily selected by the current view. |
-bra.nch branch | Checkout the LATEST version on the specified branch. |
-out file | Checkout an element under a different name. |
-unr.eserved | Checkout an element allowing others to check it out also. |
-unr.eserved -nma.ster | Checkout even if the local site doesn't master the branch. |
# ct co -nc -unreserved element # ct co -version element@@/main/version # ct co -branch /main/bug_fixes element # ct co -out element_test element
See also cleardlg on Windows.
Checkin an element.
# ct ci elementCommon options:
-nc | No checkin comment. If checkout comment exists, it uses that. |
-ide.ntical | Checkin even identical to predecessor. (not available in xclearcase) |
-kee.p | Keep a view-private file called element.keep as well as the checkedin version. |
This is automatically prompted for each Windows checkin. Not applicable to directories. | |
-fro.m | Use the specified file as the checkin version instead of the view-private file. |
The option -keep is invoked. | |
-ptime | Preserve the modification date/time. This is important if the file date outside CC denotes version. |
See also cleardlg on Windows.
Uncheckout an element.