简体   繁体   English

如何与Perl中的ClearCase交互?

[英]How can I interact with ClearCase from Perl?

My project needs couple of things to be extracted from ClearCase data using the Perl script in a excel sheet,those are - 我的项目需要使用Excel工作表中的Perl脚本从ClearCase数据中提取一些内容,这些内容是-
By giving two particular time line or two baseline. 通过给出两个特定的时间轴或两个基线。

  1. all the activity associated within that baseline (column header "activity") 该基准内关联的所有活动(列标题“活动”)
  2. Owner's id (column header-Owner) 所有者的ID(列标题-所有者)
  3. all the element associated within a particular activity. 与特定活动相关联的所有元素。 (column header-"element details") (列标题-“元素详细信息”)
  4. For each element the versions associated (column header-"Versions") 对于每个元素,关联的版本(列标题-“版本”)
  5. for each element the total number of lines of code,total number of lines of code added,total number of lines of code deleted,total number of lines of code changed..(column header"No. of lines of code","lines of code added","lines of code deleted" & " lines of code changed") 对于每个元素,代码行总数,已添加代码行总数,已删除代码行总数,已更改代码行总数。.(列标题“代码行数”,“行数”的代码”,“已删除的代码行”和“已更改的代码行”)

Please kindly help me on this... 请在这方面帮助我...

Basically, ClearCase Perl scripting is based on parsed outputs of system and cleartool commands. 基本上,ClearCase Perl脚本基于系统和cleartool命令的解析输出。

The scripts are based on a cleartool run cmd like package CCCmd , and used like: 这些脚本基于像包CCCmd这样的cleartool运行cmd,其用法类似于:

use strict;
use Config;
require "path/to/CCCmd.pm";

sub Main
{
  my $hostname = CCCmd::RunCmd('hostname');
  chomp $hostname;
  my $lsview = CCCmd::ClearToolNoError("lsview -l -pro -host $hostname");
  return 1;
}

Main() || exit(1);
exit(0);

for instance. 例如。

So once you have the basic Perl structure, all you need is the right cleartool commands to analyze, based on fmt_ccase directives. 因此,一旦有了基本的Perl结构,您只需要根据fmt_ccase指令分析正确的cleartool命令即可。

1/ all the activity associated within that baseline (column header "activity") 1 /在该基准内关联的所有活动(列标题“活动”)

 ct descr -fmt "%[activities]CXp" baseline:aBaseline.xyz@\ideapvob

That will give you the list of activities (separated by ' , '). 这将为您提供活动列表(以' , '分隔)。

For each activity: 对于每个活动:

2/ Owner's id (column header-Owner) 2 /所有者的ID(列标题-所有者)

 ct descr -fmt "%u" activity:anActivityName@\ideapvob

3/ all the element associated within a particular activity. 3 /与特定活动相关的所有元素。 (column header-"element details") (列标题-“元素详细信息”)

Not sure: activities can list their versions (see /4), not easily their elements 不确定:活动可以列出其版本(请参见/ 4),而不是列出其元素

4/ For each element the versions associated (column header-"Versions") 4 /对于每个元素,关联的版本(列标题-“版本”)

For a given activity: 对于给定的活动:

 ct descr -fmt "%[versions]CQp\n"  activity:anActivityName@\ideapvob

5/ for each element the total number of lines of code,total number of lines of code added,total number of lines of code deleted,total number of lines of code changed..(column header"No. of lines of code","lines of code added","lines of code deleted" & " lines of code changed") 5 /对于每个元素,代码行总数,已添加代码行总数,已删除代码行总数,已更改代码行总数。.(列标题“代码行数”, “已添加代码行”,“已删除代码行”和“已更改代码行”)

That can be fairly long, but for each version, you can compute the extended path of the previous version and make a diff. 这可能会很长,但是对于每个版本,您都可以计算先前版本的扩展路径并进行比较。

I would advise using for all that a dynamic view, since you can access any version of a file from there (as opposed to a snapshot view). 我建议所有使用动态视图,因为您可以从那里访问文件的任何版本(而不是快照视图)。

Also if you need to use perl with Clearcase have a look at the CPAN module ClearCase::CtCmd . 另外,如果您需要将Perl与Clearcase一起使用,请查看CPAN模块ClearCase :: CtCmd I would recommend to use this perl module for invoking clearcase commands. 我建议使用此perl模块来调用clearcase命令。

对于CCCmd包,我必须删除RunCmd和RunCmdNoError子句中的双引号以使其起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM