Clearcase Frequently (and not so frequently) Asked Questions
How do I find all latest files on a branch not labelled with a label?
This is useful for finding files that have changed since a label was created. If the branch is ldn_dev and the label is REL_CT_TA_01.00.01 then use
cleartool find . -version 'version(.../ldn_dev/LATEST) && !lbtype(REL_CT_TA_01.00.01)' -print
How do I find files that have been labelled and changed since that label?
This is useful if only a portion of a VOB has been labelled with the label, and you do not want to see those unlabelled versions. If the branch is ldn_ctas3_int and the label is LDN_CT_TA_03.01.97 then use:
cleartool find . -element 'lbtype_sub(LDN_CT_TA_03.01.97)'
-version 'version(.../ldn_ctas3_int/LATEST) && !lbtype(LDN_CT_TA_03.01.97)'
As an explanation
-element 'lbtype_sub(LDN_CT_TA_03.01.97)'only selects files that have the label on any version.
--version 'version(.../ldn_ctas3_int/LATEST) && !lbtype(LDN_CT_TA_03.01.97)'- selects the versions that are the latest on the branch that have not got the label on, out of the files from -element.
and to see the actual changes:
cleartool find . -element 'lbtype_sub(REL_CT_DI_02.00.04_0024)'
-version '!version(.../ldn_dev/LATEST) && lbtype(REL_CT_DI_02.00.04_0024)'
-exec 'echo $CLEARCASE_XPN; cleartool diff -col 200 $CLEARCASE_PN@@/main/ldn_dev/LATEST $CLEARCASE_XPN'
How do I back out a change or changes?
Check out the element you wish to remove changes from, and then run the following:
cleartool merge -to [filename] -delete -version [versions]
Where [filename] is the name of the file and [versions] is/are the version(s) that you with to remove the changes from.
What should you do if you try to add a new element and get the evil twin error?
The evil twin error can occur when attempting to add an element:
'Trigger SCM_EVIL_TWIN has refused to let mkelem proceed'
this is because someone else has created this element on a branch and then not merged it back where it is visible to someone else.
to find out which branch its been added to try to add the element
using the unix cmd as this will tell you where the element has been created :
ct mkelem -nc Settlements.vcproj
WARNING: Settlements.vcproj already exists in other versions of the directory /vobs/CCT_MARTINI/inhouse/src/SettlementInterface
You may not create a ClearCase element if one with the same name already
exists in a different version of it's parent directory, unless the condition
is caused by previous renamings of the file.
The file Settlements.vcproj will be renamed to Settlements.vcproj.mkelem . You
can copy this over the resurrected element afterwards if you like.
Generally the correct option is to resurrect the most recent element (in this
Select the element to resurrect, unless you have permission from SCA to create the Evil Twin
- Create Evil Twin
I cannot merge because I don't have mastership
The following command will request mastership for the branch you are merging to for all of the files that need merging. Here [branch_from] is the branch you are merging from and [branch_to] is the fully specified branch you are merging to (e.g. /main/ldn_dev/glb_twb_int):
ct findmerge . -fversion .../[branch_from]/LATEST -exec '/usr/atria/bin/cleartool reqmaster $CLEARCASE_PN@@[branch_to]'=
I removed an element from ClearCase - how do I get it back?
Which files aren't under ClearCase control in my view?
For a dynamic view this is easy. Simply change your working directory to the view (Windows or Unix) and type:
For a snapshot view this is slightly more challenging, but change your working directory to the top of the view and type in a DOS shell:
To list all files that are not read-only and not directories. Svoid directories that contain build files, eg. classes, bin, etc.
I want to diff/merge XML files as text
Edit the file C:\Program Files\Rational\ClearCase\lib\mgrs\map and change the occurrences of xmldiffmrg to cleardiffmrg.
Request Mastership problem across regions
- Make sure that if you are checking out a file, the parent dir's branch mastership is also with your replica if you make sure of all these, then the reqmaster must work.
- They should also have the CLEARCASE_PRIMARY_GROUP variable set as UBSW\CCT_DEV
Here are the steps for setting it:
- Goto control panel
- click on system
- Under System properties, under Advanced tab, click on Environment variables
- Create a new variable called CLEARCASE_PRIMARY_GROUP and set its value to be UBSW\CCT_DEV
- Once they do this, they need to log off and log in once.
- For the mastership to work also, you must make sure they belong to this group from windows To check whether user belong to right group from their Windows ID group, then can login to http://ideaweb with user-id as ubsw\<user-id and enter your websso pasword. Then enter the user id on the left most side side of the page and click "go". Click on "Advanced" Then click "Member of"
- May need to send a mail to dl-sets-gsd, to ass the windows CCT_DEV users also in the reqmaster acl list
How do I list all the labels under the VOB
Making sure you are somewhere in the VOB:
ct lstype -kind lbtype -short
find all branches with elements off another branch
ct lstype -kind brtype -short -unsorted | tail +2 | sed "s/ .*//g" | ( while read f; do ct find . -branch "brtype($f)" -version "version(.../$f/LATEST)" -print; done;) | grep glb_martini_dev | sed "s/.*martini_dev//g" | sed "s/\/0-9*//g" | sed "s/\///g" | sort | uniq
Diff first and last version of each element on a branch
/usr/atria/bin/cleartool find $path -branch "brtype($branch)" -version "version(.../$branch/LATEST)" -print |
while read f;
do echo "Diffing: $f";
/usr/atria/bin/cleartool diff -graphical `echo $f | /usr/bin/sed "s/\/0-9*$/\/0/"` $f;