如何从 Perl 与 ClearCase 交互? [英] How can I interact with ClearCase from Perl?

查看:27
本文介绍了如何从 Perl 与 ClearCase 交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目需要使用 Excel 表中的 Perl 脚本从 ClearCase 数据中提取一些东西,这些是 -
通过给出两个特定的时间线或两个基线.

  1. 与该基线相关的所有活动(列标题活动")
  2. 所有者的 ID(列标题-所有者)
  3. 与特定活动相关联的所有元素.(列标题-元素详细信息")
  4. 对于每个元素关联的版本(列标题-版本")
  5. 每个元素的总代码行数、添加的总代码行数、删除的总代码行数、更改的总代码行数..(列标题代码行数","添加的代码行","删除的代码行"和"更改的代码行")

请帮助我解决这个问题...

解决方案

基本上,ClearCase Perl 脚本基于系统和 cleartool 命令的解析输出.

脚本基于像 包 CCCmd 的 cleartool run cmd,并使用喜欢:

使用严格;使用配置;需要路径/到/CCCmd.pm";子主{我的 $hostname = CCCmd::RunCmd('hostname');chomp $hostname;my $lsview = CCCmd::ClearToolNoError("lsview -l -pro -host $hostname");返回 1;}Main() ||退出(1);退出(0);

例如.

因此,一旦您拥有基本的 Perl 结构,您所需要的就是根据 fmt_ccase 指令.

<块引用>

1/在该基线内关联的所有活动(列标题活动")

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

这将为您提供活动列表(以,"分隔).

对于每个活动:

<块引用>

2/Owner's id (column header-Owner)

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

<块引用>

3/在特定活动中关联的所有元素.(列标题-元素详细信息")

不确定:活动可以列出它们的版本(见/4),而不是它们的元素

<块引用>

4/对于每个元素关联的版本(列标题-版本")

对于给定的活动:

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

<块引用>

5/每个元素的总代码行数、添加的总代码行数、删除的总代码行数、更改的代码总行数..(列标题代码行数"代码"、添加的代码行"、删除的代码行"和更改的代码行")

那可能相当长,但对于每个版本,您可以计算前一个版本的扩展路径并进行比较.

我建议使用动态视图,因为您可以从那里访问文件的任何版本(而不是快照视图).

My project needs couple of things to be extracted from ClearCase data using the Perl script in a excel sheet,those are -
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)
  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.

The scripts are based on a cleartool run cmd like package CCCmd, and used like:

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.

1/ all the activity associated within that baseline (column header "activity")

 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)

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

3/ all the element associated within a particular activity. (column header-"element details")

Not sure: activities can list their versions (see /4), not easily their elements

4/ For each element the versions associated (column header-"Versions")

For a given activity:

 ct descr -fmt "%[versions]CQp
"  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")

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).

这篇关于如何从 Perl 与 ClearCase 交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆