p4 attribute

Set per-revision attributes on revisions: name-value pairs that associate metadata with the file revision.


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

Syntax conventions


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 metadataClosed The data stored by Helix Core Server that describes the files in the depot, the current state of client workspaces, protections, users, labels, 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 as work-in-progress, completed, or approved

  • 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 as static or animated, color or black-and-white, drawing or photo

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.



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.

-n name

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 p4 copy, p4 delete, p4 edit, p4 integrate, p4 reconcile, p4 resolve, p4 shelve, p4 submit, and p4 unshelve.

-v value

The value of the attribute to set. To clear an attribute, omit the -v option.

-T0 | - T1

-T0 causes the value to be stored in the db.traits table, which is the implicit default.

-T1 causes the value to be stored in the trait depot instead of the db.traits table, even if the size of the attribute value is less than the size specified by the trait.storagedepot.min configurable. However, if trait.storagedepot.min is unset or set to 0, the attribute value is stored in the db.traits table.


See Global options.

Usage Notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required



or admin to use the -f option

  • 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).


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