如何以大写字母查找给定文件的所有标签 [英] how to find all the labels for a given file in clearcase

查看:74
本文介绍了如何以大写字母查找给定文件的所有标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道解决此问题的一个尴尬方法是:

I know one awkward solution for this taks will be :


  • 首次使用 ct ls 获取文件的完整版本信息

  • ,并将版本信息通过管道传递到解析脚本以实际获取文件的标签。

  • first use ct ls to get the entire version info of the file
  • and pipe the version info to a parsing script to actually get the labels of the file .

但是我想ClearCase应该为该任务提供一个内置解决方案,而无需任何外部脚本的支持。

But I guess ClearCase should have a "build in" solution for this task without support from any external scripts.

如果您碰巧知道该任务的内置解决方案,请帮助我。

预先感谢。

Please help me if you happen to know a "build in" solution for the task.
Thanks in advance.

推荐答案

fmt_ccase 包含所有各种ClearCase元素的格式字符串。

fmt_ccase contains all the format-string for various ClearCase elements.

对于文件版本,您可以:

For a version of a file, you can:

 cleartool descr -fmt "%l\n" /path/to/a/version




%l

标签:对于版本,全部随附标签;

标签以逗号分隔的列表形式输出,用括号括起来

A < SPACE> ; 字符后跟每个逗号。

%l
Labels: For versions, all attached labels; the null string otherwise.
Labels are output as a comma-separated list, enclosed in parentheses.
A <SPACE> character follows each comma.

变量


  • %Cl

    最大标签数:使用max-field-width参数指定要显示的最大标签数(请参见指定字段宽度)。

    如果有更多标签,则会在输出后附加 ...

    如果未指定max-field-width,则最大默认值为3。

  • %Nl

    无逗号:禁止标签列表输出中的括号和逗号;

    仅包含空格的标签

  • %Cl
    Max labels: Specify the maximum number of labels to display with the max-field-width parameter (see Specifying field width).
    If there are more labels, "..." is appended to the output.
    If no max-field-width is specified, the maximum default value is 3.
  • %Nl
    No commas: Suppress the parentheses and commas in label list output;
    separate labels with spaces only.

因此结果可以是:

Labels: (Rel3.1C, Rel3.1D, Rel3.1E)
Labels without commas or parens: Rel3.1C Rel3.1D Rel3.1E

在b中在这种情况下,您仍然需要解析结果,但是至少输出只能包含 标签,例如:

In both case, you still need to parse the result, but at least the output can contain only the labels, as in:

Rel3.1C Rel3.1D Rel3.1E






onaclov2000 添加(根据评论):

唯一的问题是您要抓住文件特定版本上的标签。

鉴于分支等可以存在,我们需要能够在文件上获取所有标签。

如果使用版本树图形并选择工具->查找,则可以看到 ALL 附加到该文件的标签。

cleartool中是否有一个通用命令会返回 locate或 contents的结果?

The only problem with this is that you are grabbing the label on the specific version of the file.
Given that branches etc can exist, we'll need to be able to get ALL labels on a file.
If you use version tree graphical and select tools -> "locate" you can see ALL the labels attached to that file.
Is there a common command in cleartool that will return the results of "locate", or "contents"?

当您单击标签名称时, lsvtree (图形版本树)会显示该视图当前所见元素的所有版本的标签。

The lsvtree (graphical version tree) does display the labels of all the versions of the element currently seen by the view when you click "Label Name"

话虽如此,似乎没有一个内置解决方案,并且涉及一些解析:

That being said, there does not seem to be a "built-in" solution and some parsing is involved:

例如(它比OP版本短一些,但仍然基于 cleartool ls ):

For instance (which is a bit shorter than the OP version but still based on a cleartool ls):

ct ls -l addon.xml@@|grep version|gawk "{gsub(/^version.*@@\\\\/,\"\",$0) ; gsub(/ \ [.*/,\"\",$0); print $0}"

(GnuWin32语法)

(GnuWin32 syntax)

,或仅具有动态视图:

cd m:/myView/path/to/addon.xml@@
# list all files, not directories: the files are the labels
dir /B /A-D 

这篇关于如何以大写字母查找给定文件的所有标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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