在 ClearCase 中检索源文件的版本号
我创建了一个小插件来帮助我进行源代码控制。
有谁知道我如何在 Rational ClearCase 中检索源文件的分支名称和版本号。 我想使用 C# 来完成此操作。 所有信息实际存储在哪里?
I creating a small addin to help with my source control.
Does anybody know how I could retrieve the Branch Name and Version Number of a source file in Rational ClearCase. I want to do this using C#. Where is all the information actually stored?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在 C# 中执行
cleartool
命令,更具体地说,是一个
descr
,其中包含 格式选项仅显示准确< /em> 你在追求什么。这将返回一个类似
/main/34
的字符串,意思是/branch/version
注意:建议始终在文件完整路径周围使用双引号,以防该路径或者文件名包含空格
正如我在其他 ClearCase SO 问题中所解释的,您也可以使用 CAL 接口(COM 对象),但我一直找到
cleartool
(基本的 CLI——命令行界面——)更可靠,尤其是在出现问题时:错误消息更加精确。You need, from C#, to execute a
cleartool
commandMore specifically, a
descr
with a format option only displaying exactly what you are after.That will return a string like
/main/34
, meaning/branch/version
Note: it is recommended to always use double quotes around your file full path, in case that path or that file name includes spaces
As I have explained in this other ClearCase SO question, you could also use the CAL interface (COM object), but I have always found
cleartool
(the basic CLI -- Command Line Interface --) more reliable especially when things go wrong: the error message is much more precise.您最好的选择可能是使用cleartool.exe命令行并解析结果。 理想情况下,这通常是通过 perl 或 python 脚本完成的,但它也可以通过 C# 运行。 我怀疑您会找到任何更直接的方式来询问如此简单的clearcase。
Your best bet is probably to use the cleartool.exe command line and parse the result. Ideally this is usually done from a perl or python script but it'll work from C# as well. I doubt you'll find any more direct way of interrogating clearcase which is as simple.
您必须从 COM 添加 Clearcase Automation 引用,然后这是获取源文件的版本和分支名称的代码。
You'll have to add Clearcase Automation reference from COM, then this is the code that will get you the version and branch name of your source file.