vba - 检查 VBA 中是否存在 ClearCase 版本

标签 vba clearcase

我的一个 Excel VBA 脚本循环遍历特定 ClearCase 元素的所有版本,以查看它是否已合并。当使用 rmver 删除特定版本时,此操作失败(不建议使用破坏性删除,但我们确实在极少数情况下求助于此以使开发人员摆脱依赖)。

在 DOS 中,下面的代码完美运行:

IF EXIST M:\View\LAMI\build.xml@@\main\lc_adhoc_dev\3 ECHO Yes
Yes

为了在 VBA 中执行此操作,我尝试使用 Dir 方法检查是否存在特定版本:

Dim elementVersion As String
elementVersion = "M:\View\LAMI\build.xml@@\main\lc_adhoc_dev\3"

If Len(Dir(elementVersion)) > 0 Then
  ' Version exists
Else
  ' Version does not exist
End If

但是,这会导致错误“文件名或编号错误”:

我也试过fso对象的FileExists方法:

Dim elementVersion As String
elementVersion = "M:\View\LAMI\build.xml@@\main\lc_adhoc_dev\3"
Dim fsoObj As Object
Set fsoObj = CreateObject("Scripting.FileSystemObject")

If fsoObj.FileExists(elementVersion) = True Then
  ' Version exists
Else
  ' Version does not exist
End If

但是,该调用始终返回 False。似乎所有这些方法都与 ClearCase MVFS 虚拟 M: 驱动器有关。还有什么我可以尝试的吗?

最佳答案

I'm trying not to have to rely on the Err object, i.e. not use a cleartool command that fails when it encounters a non-existing version (such as get or descr).

正是你应该依赖的东西,除非你有约束(比如每秒测试数千个元素,或其他性能瓶颈)

cleartool describe可以应用于 extended pathname如果它不存在,将会失败。

作为commented通过 Brian Cowan ,您可以检查 Excel VBA 是否可以从 ClearCase Automation Library (CAL) 调用命令.
我有 used CAL in VB Script before .

关于vba - 检查 VBA 中是否存在 ClearCase 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43348071/

相关文章:

linux - linux下如何使用clearcase命令行将子分支合并到主分支?

git - 如何在 Git 中创建仅包含来自特定提交的文件的基线

Clearcase 问题,而 "add file to source control"

clearcase - 仅更改分支类型的主控权

vba - 如何使用vba扩展Excel中的隐藏行?

python - 将代码从 VBA 语言转换为 Python 语言。努力检查我的工作

clearcase - 如何删除clearcase中的版本

excel - 从一系列文档模板生成Word文档(在Excel VBA中)

excel - 带格式的文本连接

vba - 如何在 VBA 中查找另一个 Excel 工作表