p4 attribute
Set per-revision attributes on revisions: name-value pairs that associate metadata with the file revision.
Syntax
p4 [g-opts] attribute [-e -f -p] -n name [-v value [-T0 | -T1]] files ...
p4 [g-opts] attribute [-e -f -p [-T0 | -T1]] -i -n name file p4 attribute [-f -p [-T0 | -T1]] -I filename -n name file
Description
The p4 attribute
command sets per-revision
attributes on file revisions. An attribute is special metadata that a user or an application associates with a file revision that is separate from the metadata The data stored by Helix Core Server that describes the file revisions in the depot, where they get their content from (see lazy copy), and the current state of client workspaces, protections, groups, users, labels, streams, and branches. Metadata is stored in the server database and is separate from the archive files that users submit. that Helix Core generates. For example:
-
status
of a file, such aswork-in-progress
,completed
, orapproved
-
thumbnail
preview image that is associated with an image file,description
of an image,size
of the thumbnail metadata -
type
of a gif file, such asstatic
oranimated
,color
orblack-and-white
,drawing
orphoto
You can set any number of attributes on a file, and any number of files can have zero, one, or more of the attributes.
Attribute values and the trait depot
Attribute values are stored in the db.traits
table by default. If the attributes are huge, the growth of the db.traits
table can affect the performance of checkpoints. An alternative is to store new attribute values in the depot of type trait
instead. To do so, set the trait.storagedepot.min
configurable to a number greater than 0
. When the size in bytes of the file's attribute value matches or exceeds the minimum set by this configurable, the file's attribute value is stored in the trait
depot instead of the db.traits
table.
For optimal performance, new traits with small values should be stored in the db.traits
table, and new traits with large values should be stored in the trait
depot. The value of trait.storagedepot.min
should be chosen carefully because retrieval from the trait
depot involves costly fetching from depot storage. It is recommended that the minimum size of huge data, such as thumbnails, should be chosen for this value.
Options
|
Indicates that the value is specified in hex. |
|
Set the attribute on submitted files. If a propagating trait is set on a submitted file, a revision specifier cannot be used, and the file must not be currently open in any workspace. |
|
Read an attribute value from the standard input. Only one file argument is allowed when using this option. This option supports both textual and binary content. |
|
Read the attribute value from a file. The file can have textual or binary content. Use this when the attribute data exceeds 250 megabytes, which might cause the command to fail with the
To display attributes set with this option,
use the |
|
The name of the attribute to set. |
|
Create a propagating attribute: an attribute whose value is
passed on to subsequent revisions whenever the file is opened. Relevant commands include |
|
The value of the attribute to set. To clear an attribute, omit
the |
-T0 | - T1
|
|
|
See Global options. |
Usage notes
Can File Arguments Use Revision Specifier? | Can File Arguments Use Revision Range? | Minimal Access Level Required |
---|---|---|
Yes |
Yes |
write, |
- Multiple attributes can be set or cleared by specifying multiple
-n name
options and an equal number of corresponding-v value
options (to set) or no-v
options ( to clear).
Examples
To assign an attribute of a file
Use the -n
option to set the name the attribute, and use -v
option to set the value of the attribute. Here, for revision 4 of the file named kitten.gif
, the attribute black-and-white
is set to the value of true
.
This attribute value is small and indicates that the image is black-and-white instead of color.
p4 attribute -f -n black-and-white -v true //depot/main/rel1/perl_proj/kitten.gif
//depot/main/release1/perl_proj/kitten.gif#4 - black-and-white set
Searching for attributes
See the Examples for attributes in the p4 fstat topic.
To remove an attribute from a file
The omission of the -v
option removes the attribute value from the file.
p4 attribute -f black-and-white //depot/main/rel1/perl_proj/kitten.gif
//depot/main/release1/perl_proj/kitten.gif#4 - black-and-white cleared