command in clearcase to get list of all labels applied on an element

南笙酒味 提交于 2019-12-09 01:56:07

问题


I'm trying to get the list of all the labels applied on an element.

I'm using

cleartool desc <element>

This seems to list all the other details of the element as well. Is there any particular option with desc command that lists only labels?

Thanks


回答1:


Use cleartool fmt_ccase in order to restrict the describe to only the labels.

cleartool descr -fmt "%l" myFile

You can see that technique used in:

  • "Which tag or branch is created from a particular branch"
  • "Command to find labels applied on particular branch"
  • "Cleartool - List Objects with Their Labels"

For instance, a slightly more complete output would be:

cleartool descr -fmt \"%n labels:%l\n\" myFile

Note: in UCM, a cleartool lsbl would be enough (for listing baselines).
But for base ClearCase, cleartool descr works.




回答2:


To get labels for all versions of the element, add '-version' and a query to get all versions. My example uses !lbtype(x), since all our versions do NOT have the label 'x'.

cleartool find . -version "!lbtype(x)" -name "yourelement" -exec "cleartool descr -fmt \"%n labels:%l\n\" \"%CLEARCASE_XPN%\""

To output list with space separation, change the -fmt to -> -fmt \"%Nl \". List could be very long if there are lots of versions and labels.




回答3:


If you are using dynamic views, you can also use extended naming to see the set of labels applied to versions of the element:

% ls myfile.c@@

Note that the output also includes the 'main' branch. You can omit the branch(es) on a non-directory element simply:

% ls -1F myfile.c@@ | grep -v /

Extra credit - You can also use extended names to see the set of labels applied to versions of a particular branch:

% ls -1F myfile.c@@/main/mybranch | grep -v / | grep '[A-Za-z]'

(the trailing 'grep' assumes labels have at least one alphabetic character and will omit version numbers that would otherwise also be included in the output.) That output will also include 'LATEST' but you can easily omit that, too, if desired.



来源:https://stackoverflow.com/questions/25118362/command-in-clearcase-to-get-list-of-all-labels-applied-on-an-element

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!