Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Com ClearCase:使用CAL列出目录(ls)的内容_Com_List_Automation_Directory_Clearcase - Fatal编程技术网

Com ClearCase:使用CAL列出目录(ls)的内容

Com ClearCase:使用CAL列出目录(ls)的内容,com,list,automation,directory,clearcase,Com,List,Automation,Directory,Clearcase,在ClearCase中,您可以使用“ClearToolls”列出目录的内容 我的问题是如何使用CAL(ClearCase自动化层)做同样的事情。我喜欢COM API的原因是我不必解析“ls”的输出 到目前为止,我能够成功地获得VOB和视图,但是我没有找到任何方法来列出内容 到目前为止,我的代码是: IClearCase cc = new ApplicationClass(); CCVOB vob = cc.get_VOB("\\VOB-name"); CCView view = cc.get_V

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

我的问题是如何使用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*/}
}

也许这是一个好的开始:

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
相当于使用
-force
选项运行
cleartool rmver


请改用
ICCElement
界面中的
RemoveName
。只有将当前目录设置为视图路径(通过C#中的environment.CurrentDirectory),CC.Version(“.”)才会起作用。如果是这样的话,jou就不能删除第二行,然后执行“Set Folder=FSO.GetFolder(“--your view path here--”)吗?换句话说,第二行是必要的吗?在你提到的情况下,这第二行确实没有必要。但是我还没有完全测试。好的,再次测试。如果我敢再补充一个小问题。现在我知道该文件已进行版本控制,如何删除它(rmname)。有RemoveVersion(…),但我不确定它是否等同于rmname。警告:ClearCase中有两个“remove version”:rmver是最危险的版本,因为它最终从VOB中删除了该版本。Rmname只是从其父目录引用的文件列表中取消引用该版本。请改用ICCElement接口中的RemoveName。完成了我对“Rmname”部分的回答。完成了我对“ICCElement”问题的评论。