pub struct Attribute<S = Standard, T = Unselected> { /* private fields */ }Expand description
p4 [g-opts] attribute [-e -f -p] -n name [-v value [-T0 | -T1]] files ...: set per-revision attributes on revisions.
p4 [g-opts] attribute [-e -f -p [-T0 | -T1]] -i -n name file
p4 attribute [-f -p [-T0 | -T1]] -I filename -n name file
The S type parameter tracks the value source: Standard for the
default -n/-v set-or-clear form, FromStdin for the -i form,
FromFile for the -I filename form, and
and the T type parameter tracks the -T0/-T1 trait storage location.
Implementations§
Source§impl Attribute<Standard, Unselected>
impl Attribute<Standard, Unselected>
Sourcepub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self
Creates a new p4 attribute command.
bin is the path to the Perforce command-line executable.
Source§impl<T: ExclusiveOption> Attribute<Standard, T>
impl<T: ExclusiveOption> Attribute<Standard, T>
Sourcepub fn set(
&mut self,
name: impl Into<String>,
value: impl Into<String>,
) -> &mut Self
pub fn set( &mut self, name: impl Into<String>, value: impl Into<String>, ) -> &mut Self
§Description
-n name -v value
Sets the attribute name to value on the given files.
The supplied value must be text.
Sourcepub fn read_from_stdin(self, name: String) -> Attribute<FromStdin, T>
pub fn read_from_stdin(self, name: String) -> Attribute<FromStdin, T>
§Description
-i
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.
Transitions this command to the FromStdin state; any -n/-v
pairs set with Self::set or Self::clear are discarded, while
-e is preserved.
Sourcepub fn read_from_file(
self,
name: String,
file: PathBuf,
) -> Attribute<FromFile, T>
pub fn read_from_file( self, name: String, file: PathBuf, ) -> Attribute<FromFile, T>
§Description
-I filename
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 Rpc buffer too big error. The following are not allowed with this option:
- Using the
-eoption to specify the value as hex. - More than one file argument.
- Setting more than one trait value.
To display attributes set with this option, use the p4 print -T
command instead of the p4 fstat -Oa command because p4 print -T
can handle larger non-encoded binary data.
Transitions this command to the FromFile state; any -n/-v
pairs set with Self::set or Self::clear, as well as -e, are
discarded.
Source§impl<T: ExclusiveOption> Attribute<FromStdin, T>
impl<T: ExclusiveOption> Attribute<FromStdin, T>
Sourcepub fn output<S, V>(&self, file: S, value: V) -> Result<Output, Error>
pub fn output<S, V>(&self, file: S, value: V) -> Result<Output, Error>
Runs p4 attribute -i for a single file, writing value to the
child’s standard input, and captures the command’s output.
Unlike ParameterizedSpawn::spawn_with, this method handles writing
the attribute value to the child’s standard input itself, so it is the
most convenient way to submit values through standard input.
Only one file argument is allowed in the FromStdin state.
Source§impl<T: ExclusiveOption> Attribute<FromFile, T>
impl<T: ExclusiveOption> Attribute<FromFile, T>
Source§impl<S: ExclusiveOption, T: ExclusiveOption> Attribute<S, T>
impl<S: ExclusiveOption, T: ExclusiveOption> Attribute<S, T>
Sourcepub fn get_global_opts(&self) -> &GlobalOpts
pub fn get_global_opts(&self) -> &GlobalOpts
Sourcepub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self
Sourcepub fn global_opts(self, v: GlobalOpts) -> Self
pub fn global_opts(self, v: GlobalOpts) -> Self
Sourcepub fn get_on_submitted_files(&self) -> bool
pub fn get_on_submitted_files(&self) -> bool
§Description
-f
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.
Sourcepub fn set_on_submitted_files(&mut self, v: bool) -> &mut Self
pub fn set_on_submitted_files(&mut self, v: bool) -> &mut Self
§Description
-f
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.
Sourcepub fn on_submitted_files(self, v: bool) -> Self
pub fn on_submitted_files(self, v: bool) -> Self
§Description
-f
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.
Sourcepub fn get_propagating(&self) -> bool
pub fn get_propagating(&self) -> bool
§Description
-p
Create a propagating attribute: an attribute whose value is propagated 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.
Sourcepub fn set_propagating(&mut self, v: bool) -> &mut Self
pub fn set_propagating(&mut self, v: bool) -> &mut Self
§Description
-p
Create a propagating attribute: an attribute whose value is propagated 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.
Sourcepub fn propagating(self, v: bool) -> Self
pub fn propagating(self, v: bool) -> Self
§Description
-p
Create a propagating attribute: an attribute whose value is propagated 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.
Source§impl<S: ExclusiveOption, T: ExclusiveOption> Attribute<S, T>
impl<S: ExclusiveOption, T: ExclusiveOption> Attribute<S, T>
Sourcepub fn store_in_database_traits(self) -> Attribute<S, DatabaseTraits>
pub fn store_in_database_traits(self) -> Attribute<S, DatabaseTraits>
§Description
-T0
Causes the value to be stored in the db.traits table, which is the
implicit default.
Sourcepub fn store_in_trait_depot(self) -> Attribute<S, TraitDepot>
pub fn store_in_trait_depot(self) -> Attribute<S, TraitDepot>
§Description
-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.
Trait Implementations§
Source§impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<Standard, T>
impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<Standard, T>
Source§fn spawn_with<'a>(
&mut self,
files: Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, files: Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 attribute for the given files as a child process with
piped standard output and error streams; use the returned Child
handle to wait for it or interact with it.
type Input<'a> = &'a [&'a OsStr]
type Output<'a> = Child
type Error = Error
Source§impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<FromStdin, T>
impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<FromStdin, T>
Source§fn spawn_with<'a>(
&mut self,
input: Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, input: Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 attribute -i for a single file as a child process with the
given standard input configuration and piped standard output and error
streams; use the returned Child handle to wait for it or interact
with it.
Pass Stdio::piped() to obtain a writable child.stdin handle and
write the attribute value yourself, then drop it before waiting on
the child. Only one file argument is allowed in the FromStdin
state.
type Input<'a> = (&'a OsStr, Stdio)
type Output<'a> = Child
type Error = Error
Source§impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<FromFile, T>
Available on non-crate feature lt2024_2 only.
impl<T: ExclusiveOption> ParameterizedSpawn for Attribute<FromFile, T>
lt2024_2 only.