I am writing a program that needs to know whether a file (excel workbook) is in clearcase or not. If so I need to check it out.
Here is my code for checking out a file:
private void buttonClicked(object sender, RibbonControlEventArgs e)
{
ClearCase.ClearTool checkingOut = new ClearCase.ClearTool();
string fileLoc = Globals.ThisAddIn.Application.ActiveWorkbook.FullName;
checkingOut.CmdExec(@"checkout """ + fileLoc + @"""");
}
I do not want to perform the checkout unless I know if it is in Clearcase or not.
This is part of an Excel add-in.
Thank You!
The simplest way to know if a file is in ClearCase is to perform a cleartool ls aFile
(ct.CmdExec("ls aFile");
with the CAL API)
See the cleartool ls
man page:
List the VOB-resident objects and view-private objects in the current working directory.
cmd-context ls
Makefile@@/main/3 Rule: /main/LATEST
bug.report
cm_add.c@@/main/0 Rule: /main/LATEST
Here bug.report
isn't in ClearCase yet: it has no selection rule associated to it.
The easiest way to check whether a file in clearcase or not is to check whether file@@/main/0 exists
I've never used ClearCase but looking at the docs for the CLI can you just execute the find
command?
It seems you are using the ClearCase Automation Library for C# ClearCase Automation Library
On that page, it mentions this information:
After getting all the checked out files, you can search if the current file is a member of that list or not.