Thursday, June 21, 2007

Automating Clearcase

Playing around a bit with clearcase tonight. We will shortly be trying to use rsync to keep a remote clearcase instance up-to-date with our code. This will require quite a fudge on our part as far as I can see, but will still be preferable to using clearcase over a slow link.

The following are some commands, which I will no doubt be integrating into a nice automated script shortly. They do all the things I need to do - add view private files and directories to clearcase, upversion files that have changed, or back out files that are the same. The only thing I haven't got yet is automated removal of files / directories, but I suspect this will be the job of the script.


############################################
# mkdir : [view private object]
while(<>)
{
chomp;
print < < TAG;
mv $_ $_.1
cleartool mkdir -nc $_
mv $_.1/* $_
rmdir $_.1
cd $_
TAG
}
############################################
# create a new element
cleartool mkelem -nc -ci _element_name_
############################################
# show view private files
cleartool lsp -other -l
############################################
# show view private and checked out files
cleartool lsp -co
############################################
# list checkouts including directories.
ct lsco -recurse -short
############################################
# checkin or revert if not changed
# (always creates a new version of directory)
ct ci -nc _element_name_ ct unco -rm _element_name_
############################################
# if [checkedout but removed]
cleartool co -nc .
cleartool unco -rm _element_name_
cleartool rm _element_name_
cleartool ci -nc .



No comments: