C# script for searching the file in Clearcase Vob

419 Views Asked by At

I have a file name myfile.txt in my desktop and I want to:

  • check whether this same file name is present or not in my ClearCase vob and
  • if present, then I want to read the file data without checking it out.

I want to write a script for that in c#.
I am using Clearcase Automation Library (CAL) in Visual Studio.

1

There are 1 best solutions below

12
On

Note: CAL (ClearCase Automation Library) might not be available for the latest versions of ClearCase (8.x): it is for CC7.1.2 or less.

Since you can execute cleartool command with it, your best approach is to first check if you can get the data you want through cleartool script, and then reporting that script in a CAL script:

my $cal_ct = Win32::OLE->new('ClearCase.Cleartool')  
or die "Could not create the ClearTool object\n";  

my $cclsvob = $cal_ct->CmdExec('lsvob');  

For reading data of any version without any checkout, you need to search in a dynamic view, where you can read any extended pathname (see "About the version-extended path").

For finding your file, you need a cleartool find command, with the option -nvi/sible:

Includes only those elements, along with their branches and versions, that are not visible (do not have a standard path name) in the view.

cd /path/to/view/AVob
cleartool find -all -name "myfile.txt" -nvis -print

Then you need to cat the %CLEARCASE_XPN% result

cleartool find -all -name "myfile.txt" -nvis -exec "type \"%CLEARCASE_XPN%\""