Where I work, the primary version control system used is ClearCase. It’s the first version control system I learned, so even through its challenges, it remains my reference point for learning other version control systems. It’s easy to become familiar with the basics, but I’ve learned a few tricks that I find myself having to re-look-up, hoping I can find them again because I don’t need them frequently. That and, a lot of the tasks we used to do manually, we have rolled into scripts which govern building tasks so less is left to human error. So, here I will note some of the things I’ve found useful, but don’t always remember without looking them up.
Two of my favorite references online are:
Phil for Humanity (all the articles labeled “ClearCase Support”)
Then you have the regular, old manual:
IBM Cleartool Manual
We’ll start with something obvious, that I don’t really have to look up, I just tend to have to think for a few seconds before I remember that it will help me figure out why I’m looking at the wrong thing. To clarify, if you’re in a directory, and you use
cleartool ls, it will list the contents of the directory and which configuration specification rule is active on said item.
This, I found, was important for avoiding trouble when importing.
lscheckout), as may seem obvious, lists files checkedout. What was useful to me was checking on a specific branch, so I was using something like:
cleartool lsco -brtype BRANCH -recurse
Another useful checkout search is for all your own checkouts (via
-me) in your view (current view via
-cview), in all vobs (via
cleartool lsco -me -avobs -cview
Find a branch or label
Need to know what labels or branches exist?
cleartool lstype -kind brtype -invob \my_vob
-invob option can be super helpful if you are potentially in a different vob.
Alternatively, if you want to check if a single label or branch exists, another option is to ask for its description.
cleartool desc -s lbtype:MY_LABEL
We regularly imported source from a vendor, which we added on to, so it was important to keep things organized. This was our standard import call.
clearfsimport -nsetevent -recurse -mklabel <LABEL> <DIR_TO_IMPORT> <CC_LOCATION_TO_IMPORT_TO> 1> Logfileofyourchoice.txt 2>Errorlogfileofyourchoice.txt
Just as an example, this will find all items on
my_branch and as it finds each one, it will bring up a version tree for it. This can be useful in small cases, but is not advised when there will be many results.
cleartool find . -version "version(.../my_branch/LATEST)" -exe "cleartool lsvt -g %CLEARCASE_PN%"
(Note: the use of “.” is to indicate that the search should be in the current folder; you may replace this with a different path.)
Of course, alternatively, you can get just a list of all the files by replacing
-exe and its parameters with simply
-version parameter block, adding
&& !version(.../other_branch/LATEST) is helpful. Note that
-version isn’t terribly picky, so you can use branches or labels in the ().
Doing something with what you find
In the previous example, the -exe told ClearCase to open the version tree for each file found. Another example is to label each file found:
cleartool find . -all -version "lbtype(<LABEL>)" -exe "ct mklabel <OTHER_LABEL> %CLEARCASE_XPN%"
Here we use the clearcase special variable (with the extended path name, which would be more important if we changed “.” to a different folder) to indicate the file we’d like to apply a secondary label to.