2

在 ClearCase 中,您可以使用“cleartool ls”列出目录的内容。

我的问题是如何使用 CAL(ClearCase 自动化层)做同样的事情。我更喜欢 COM API 的原因是我不必解析“ls”的输出。

到目前为止,我能够成功获取 VOB 和视图,但我没有找到任何列出内容的方法。

到目前为止我的代码:

IClearCase cc = new ApplicationClass();
CCVOB vob = cc.get_VOB("\\VOB-name");
CCView view = cc.get_View("ViewTag");

感谢您的帮助。

我用 C# 为那些感兴趣的人写了 VonC 的答案。

string[] files = Directory.GetFiles("View path here", "*.*", SearchOption.AllDirectories);
foreach (string file in files)
{
    try
    {
            CCVersion ver = cc.get_Version(file);
            Console.WriteLine(ver.Path);
    }
    catch(Exception) {/*the file is not versioned*/}
}
4

1 回答 1

1

也许这是一个好的开始:

Set CC = Wscript.CreateObject("ClearCase.Application") 
Set DirVer = CC.Version(".") 
Set FSO = CreateObject("Scripting.FileSystemObject") 
Set Folder = FSO.GetFolder(DirVer.Path) 
Wscript.Echo "Files under source control: " 
For Each File in Folder.Files 
     On Error Resume Next 
     Set Ver = CC.Version(File.Name) 
     If Err.Number = 0 Then 
           Wscript.Echo Ver.ExtendedPath 
     End If 
Next

这个想法是使用ICCVersion方法来尝试访问文件的版本。如果它没有返回错误,它确实是一个版本化文件。


现在我知道该文件是版本化的,我该如何删除它(rmname)。

不要使用 RemoveVersion()
不可恢复地删除版本(相当于cleartool rmver
警告!这是一个潜在的破坏性操作。因为CAL在任何情况下都不会提示用户输入,所以RemoveVersion调用时没有确认步骤。调用RemoveVersion相当于cleartool rmver使用-force选项运行。

而是使用RemoveNamefrom the ICCElementinterface

于 2009-06-17T16:46:40.210 回答