用于在 Clearcase Vob 中搜索文件的 C# 脚本

标签 c# clearcase clearcase-ucm clearcase-automation

我的桌面上有一个名为 myfile.txt 的文件,我想:

  • 检查我的 ClearCase vob 中是否存在相同的文件名,
  • 如果存在,那么我想读取文件数据而不检查它。

我想用 C# 编写一个脚本。
我在 Visual Studio 中使用 Clearcase 自动化库 (CAL)。

最佳答案

备注:CAL (ClearCase Automation Library)可能不适用于最新版本的 ClearCase (8.x):它适用于 CC7.1.2 或更低版本。

因为你可以用它执行 cleartool 命令,你最好的方法是首先检查你是否可以通过 cleartool 脚本获取你想要的数据,然后在 CAL 脚本中报告该脚本:

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

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

要读取任何版本的数据无需任何检查,您需要在dynamic view 中搜索,您可以在其中阅读任何 extended pathname (参见“About the version-extended path”)。

要查找您的文件,您需要 cleartool find命令,带有选项 -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

然后你需要 cat %CLEARCASE_XPN% 结果

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

关于用于在 Clearcase Vob 中搜索文件的 C# 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29203991/

相关文章:

git - 与 ClearCase 相比如何使用 git 元数据策略?

c# - 为什么 MS Access 2007 不允许行插入,但在下一次插入尝试时允许它?

merge - 在 ClearCase 中查找所有未合并的文件/元素

c# - 如何在 C# 中调用 mySQL 存储函数?

clearcase - 如何以明文形式删除目录及其所有内容的标签?

linux - 更改基线名称

clearcase - 当我比较集成流基线时,为什么 Clearcase diffbl 包含来 self 的开发流的事件?

linux - 使用 cleartool 在 Linux 上重新设置流基线

c# - 如何使此类通用? (.NET C#)

c# - 安全地附加到 Parallel.ForEach 中的列表