1

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

user3437212
  • 637
  • 1
  • 10
  • 20

3 Answers3

2

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How can i get the labels on all the versions of the element? not just the current version for which the config spec is set. – user3437212 Aug 05 '14 at 14:01
  • by doing a (Windows syntax) `cleartool find -name "yourelement" -exec "cleartool descr -fmt \"%n labels:%l\n\" \"%CLEARCASE_XPN%\""` or (Unix syntax): `cleartool find -name "yourelement" -exec 'cleartool descr -fmt "%n labels:%l\n" "$CLEARCASE_XPN"'` – VonC Aug 05 '14 at 14:04
1

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.

0

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.

hack
  • 146
  • 5