command in clearcase to get list of all labels app

2019-02-20 05:47发布

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

标签: clearcase
3条回答
混吃等死
2楼-- · 2019-02-20 05:57

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:

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.

查看更多
The star\"
3楼-- · 2019-02-20 06:03

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.

查看更多
叛逆
4楼-- · 2019-02-20 06:13

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.

查看更多
登录 后发表回答