Attributes
Find and filter objects by the value of object attributes.
Note: The cm find attribute
command refers to generic attributes, not specific UVCS attributes.
Filtering options
The following list displays the different filtering options (where
) that are available to use with the cm find attribute
command:
comment
date
guid
id
owner
srcobj
type
value
Note: The condition date
and type
correspond to the Creation date and Name columns in the Attributes view of the UVCS desktop application.
Output options
The following list displays the different output options (--format
) available to use with the cm find attribute
command:
comment
date
id
owner
type
value
cm find attribute
examples
Get all attributes
To find attributes, you need the object ID. For example, you can get the ID when you query for a branch:
cm find branch "where name = 'main'" --format="{id}" --nototal
3
When you have the object ID, you can get the attribute list for that ID:
cm find attributes "where srcobj = 3" --nototal
objid:3@repid:2@repserver:localhost:8087 -- status --> PASSED
In the previous example, the attribute name is status
and the attribute value is PASSED
.
You can use Powershell or Bash to combine the two commands:
- Powershell:
cm find branch "where name = 'main'" --format="{id}" --nototal |Foreach-Object { cm find attributes where srcobj= $_ --nototal}
- Bash:
for branch_id in 'cm find branch "where name = 'main'" --format="{id}" --nototal' ;do cm find attributes "where srcobj=$branch_id" --nototal; done
Get all objects with a specific attribute
Query for a specific attribute regardless of the type of object:
cm find attributes "where type = 'status' and value='PASSED' and date > 'this month'"
objid:253012@repid:2@repserver:localhost:8087 -- status --> PASSED
objid:253013@repid:2@repserver:localhost:8087 -- status --> PASSED
objid:253014@repid:2@repserver:localhost:8087 -- status --> PASSED
objid:268518@repid:2@repserver:localhost:8087 -- status --> PASSED