通过C#代码如何获取给定主机中所有视图和VOB的名称
我们正在开发一个使用c#的工具来进行代码审查。我们使用clearcase作为源代码控制。
我正在使用“cleartool
”对象来执行与clear case交互的任何操作 {例如 ClearCase 操作:获取存在的标签列表、附加给定标签的文件等...}
使用cleartool 之前的要求是我必须将工作目录更改为适当的 VOB 目录。
举例来说,我在网络驱动器“U
”上有“exampleView
”和“exampleVOB
”。因此,在我的代码中,
- 步骤 1. 将工作目录更改为 VOB 目录“
cd U:\exampleView\exampleVOB
” - 步骤 2. 使用 Cleartool 命令与 Clear Case 交互。
问题:
所以现在从我的工具设计来看,
- 我有2个组合框,一个用于视图,另一个用于VOB。
- 用户选择适当的视图和VOB。
- 通过代码使用注册表项 "
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mvfs\Parameters\basedrive
" 获取清晰的网络驱动器, - 我将路径形成为“
basedrive:\” viewcomboboxselection\vobcomboboxselectedvalue
"
所以现在我想知道是否有任何方法可以获取给定的 VIEWS 和 VOBS 列表
我迄今为止的发现:
- 注册表项“
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Atria\ClearCase\CurrentVersion\RecentlyUsedViews
”只会给我选定的视图,但不会系统中的所有视图。 - 注册表项“
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Atria\ClearCase\CurrentVersion\PersistentVOBs
”不会为我提供给定系统中的所有 VOB。
是否有任何注册表项或任何方法来获取系统中所有视图和 vobs 的列表。
We are developing a tool using c# for purpose of code reviews. We are using clearcase as source control.
I am using "cleartool
" object to perform any operations interacting with clear case
{ex of ClearCase operations: getting list of labels present, files attached with given label etc...}
The requirement before using cleartool is that i have to change my working directory to appropriate VOB directory.
Say for example I have "exampleView
" and "exampleVOB
" on network drive "U
". So in my code
- step 1. Change my working directory to VOB directory "
cd U:\exampleView\exampleVOB
" - step 2. interact with clear case using cleartool commands.
Problem :
So now from my tool design is
- I have 2 combobox one for views and other for VOBs.
- User selects appropriate View and VOB.
- Through code get clear case network drive using registry entry "
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Mvfs\Parameters\basedrive
" - I form path as "
basedrive:\viewcomboboxselection\vobcomboboxselectedvalue
"
So now i wanted to know is there any way to get list of VIEWS and VOBS in a given system.
My findings so far :
- Registry entry "
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Atria\ClearCase\CurrentVersion\RecentlyUsedViews
" will give me only selected views but not all views in a system. - Registry entry "
HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Atria\ClearCase\CurrentVersion\PersistentVOBs
" will not give me all VOBs in a given system.
Is there any registry entries or any way to get list of all views and vobs in a system.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要获取给定主机名的所有视图,请参阅
cleartool lsview
:(请注意
-quick
仅适用于 CC7.0.1+,它通过列出当前存储在注册表中的视图来提供对 -host 选项的更快查找)要获取所有 vobs(在当前区域中),请参阅 <一个href="http://publib.boulder.ibm.com/infocenter/cchelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearcase.cc_ref.doc/topics/ct_lsvob.htm" rel="nofollow noreferrer">
cleartool lsvob
:您可以从 C# 程序中调用 and (解析结果),或者调用来自同一 C# 程序的 VB 脚本,使用 CAL API,如 这个问题。
To get all the view for a given hostname, see
cleartool lsview
:(Note the
-quick
for CC7.0.1+ only, which provides faster lookup for the -host option by listing views as currently stored in the registry)To get all the vobs (in the current region), see
cleartool lsvob
:You can call and (parse the result of) from your C# program, or call a VB script from the same C# program, using CAL API as illustrated in this question.
正如 VonC 建议的那样,尝试使用 CAL API。
如果不尝试在 C# 中调用和解析cleartool 输出,您将为自己节省大量麻烦。如果您检查 ClearCase 文件夹中的“cc_cal.chm”(我相信在“bin”中),您将看到 CAL API 具有相当详细的类层次结构,尽管这些示例主要针对 VB 用户(并且因此需要一些调整和类型转换)。您还将看到速度的显着提高,因为在 Windows 中启动新子进程的成本不菲。
Visual Studio 的调试器将是您前进中最好的朋友 - 将 ClearCase.Application(可能还有 ClearCase.Cleartool)引用添加到您的项目中,实例化 ClearCase.Application 对象的实例,然后使用监视窗口进行有趣的检查。
此处提供了有关使用 ClearCase.Application 枚举视图的一些说明:
http://www.codeproject.com/Articles /41720/使用-ClearCase-Automation-Library-with-C
As VonC suggests, try using the CAL API.
You will save yourself an enormous amount of trouble by not attempting to invoke and parse cleartool output in C#. If you check out the "cc_cal.chm" in your ClearCase folder (in 'bin' I believe), you'll see the CAL API has a reasonably well-documented class heirarchy, though the examples are largely aimed at VB users (and thus require some adaptation and type casting). You'll see a sizable speed improvement as well, as there's a nontrivial cost to launching new subprocesses in Windows.
Visual Studio's debugger will be your best friend moving forward - add the ClearCase.Application (and possibly ClearCase.Cleartool) references to your project, instantiate an instance of the ClearCase.Application object, then have fun inspecting with the watch window.
Some instructions on enumerating views with ClearCase.Application are available here:
http://www.codeproject.com/Articles/41720/Using-the-ClearCase-Automation-Library-with-C
1.从clearcase获取所有vobs
2.获取特定流的所有视图
1.To get all the vobs from clearcase
2.To get all the views for a particular stream