views:

178

answers:

1

How can I query those of the labels in ClearCase with cleartool that have a specific attribute.

I can list the labels with

lstype -kind lbtype

but I'd like to get only those that have an attribute called TestAttr.

+1  A: 

You can

  • first find all the version with a certain attribute
  • then describe those versions in order to display their respective branch

(unix syntax)

cleartool find . -version 'attype(an_attribute_name)' \
  -exec 'cleartool descr -fmt "%Sn" "$CLEARCASE_XPN" '

You will still need to parse the result to extract the branch, and sort -u the result.


The OP comments:

I'd like to query the labels not the files. I have no files with that attribute

Then find is the wrong command.

The best you could do is to list all labels in a given VOB, and describe them in order to display their attribute (if they have one)

ct lstype -kind lbtype -invob vob:/avob -fmt "%n ~ %[an_attribute_name]a"

Only the lines with some value displayed after the "~" (an arbitrary separator just put here to easily distinguish the name of the label from its attribute value) are to be considered.
A label with no attribute (at least not the 'an_attribute_name' attribute) will display only its name followed by "~", without any other data after the '~'.

VonC
I'd like to query the labels not the files. I have no files with that attribute.
Vereb
@Vereb: refined my answer to display attribute on labels, not on files with labels.
VonC