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

点点圈 提交于 2019-12-01 02:20:00
VonC

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.

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.

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.

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