Query labels with a specific attribute in ClearCase
How can I query those of the labels in ClearCase开发者_如何学Python 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.
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 '~
'.
精彩评论