Skip to main content

Copy

Struct Copy 

Source
pub struct Copy<M = Unselected> { /* private fields */ }
Expand description

Type-safe builder for p4 copy.

Copy files and/or the stream spec from one location in the depot to another.

§Syntax

p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] fromFile[rev] toFile
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -b branch [-r] [toFile[rev] ...]
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -b branch -s fromFile[rev] [toFile ...]
p4 [g-opts] copy [-c change] [-n -f -K -v -q] [-m max] -S stream [-P parent] [-F] [-r] [toFile[rev] ...]
p4 [g-opts] copy [options] -S stream [-Af | -As] [-P parent] [-F] [-r] [toFile[rev] ...]

The M type parameter tracks the command form at compile time, starting as Unselected from Copy::new. The Unselected state is the direct form p4 copy fromFile[rev] toFile: spawn it with the two file arguments to copy without a branch or stream mapping. Enter a branch or stream form with one of Self::branch or Self::stream:

  • Branch (entered via Self::branch): use a branch view; Copy::reverse supplies -r and transitions to the BranchReverse state; Copy::source supplies -s fromFile[rev] and transitions to the BranchOverride state.
  • Stream (entered via Self::stream): use a stream’s generated branch view; Copy::files_only supplies -Af and Copy::stream_spec_only supplies -As, each transitioning to the corresponding state.

Implementations§

Source§

impl Copy<Unselected>

Source

pub fn new(bin: impl Into<PathBuf>, global_opts: GlobalOpts) -> Self

Creates a new p4 copy command in the direct form p4 copy fromFile[rev] toFile.

bin is the path to the Perforce command-line executable. In this state, spawn with the fromFile[rev] and toFile arguments via ParameterizedSpawn::spawn_with; use Self::branch or Self::stream to enter a branch or stream form.

Source

pub fn branch(self, v: impl Into<String>) -> Copy<Branch<Unselected>>

Enters the branch form: p4 copy -b branch [-r] [toFile[rev] ...].

Uses the named branch view to determine source and target files. Use Copy::reverse to supply -r, or Copy::source to supply -s fromFile[rev] (which transitions to the BranchOverride form).

Source

pub fn stream(self, v: impl Into<String>) -> Copy<Stream<Unselected>>

Enters the stream form: p4 copy -S stream [-P parent] [-F] [-r] [toFile[rev] ...].

Uses a generated branch view that maps the stream to its parent. Use Copy::files_only (-Af) or Copy::stream_spec_only (-As) to restrict what is copied.

Source§

impl<M> Copy<M>

Source

pub fn get_bin(&self) -> &Path

Get the Perforce command path.

Source

pub fn set_bin(&mut self, bin: impl Into<PathBuf>) -> &mut Self

Set the Perforce command path.

Source

pub fn bin(self, bin: impl Into<PathBuf>) -> Self

Set the Perforce command path.

Source

pub fn get_global_opts(&self) -> &GlobalOpts

§Description

g-opts

See Global options.

Source

pub fn set_global_opts(&mut self, v: GlobalOpts) -> &mut Self

§Description

g-opts

See Global options.

Source

pub fn global_opts(self, v: GlobalOpts) -> Self

§Description

g-opts

See Global options.

Source

pub fn get_changelist(&self) -> Option<&String>

§Description

-c change

Open the files in the specified pending changelist rather than in the default changelist.

Source

pub fn set_changelist(&mut self, v: impl Into<String>) -> &mut Self

§Description

-c change

Open the files in the specified pending changelist rather than in the default changelist.

Source

pub fn changelist(self, v: impl Into<String>) -> Self

§Description

-c change

Open the files in the specified pending changelist rather than in the default changelist.

Source

pub fn get_limit(&self) -> Option<u64>

§Description

-m max

Specify the maximum number of files to copy, to limit the size of the operation.

Source

pub fn set_limit(&mut self, v: u64) -> &mut Self

§Description

-m max

Specify the maximum number of files to copy, to limit the size of the operation.

Source

pub fn limit(self, v: u64) -> Self

§Description

-m max

Specify the maximum number of files to copy, to limit the size of the operation.

Source

pub fn get_preview(&self) -> bool

§Description

-n

Preview the copy.

Source

pub fn set_preview(&mut self, v: bool) -> &mut Self

§Description

-n

Preview the copy.

Source

pub fn preview(self, v: bool) -> Self

§Description

-n

Preview the copy.

Source

pub fn get_force(&self) -> bool

§Description

-f

Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they do not exist in the target, and files that are already identical are copied if they are not connected by existing integration records.

Source

pub fn set_force(&mut self, v: bool) -> &mut Self

§Description

-f

Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they do not exist in the target, and files that are already identical are copied if they are not connected by existing integration records.

Source

pub fn force(self, v: bool) -> Self

§Description

-f

Force the creation of extra revisions in order to explicitly record that files have been copied. Deleted source files are copied if they do not exist in the target, and files that are already identical are copied if they are not connected by existing integration records.

Source

pub fn get_quiet(&self) -> bool

§Description

-q

Quiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed.

Source

pub fn set_quiet(&mut self, v: bool) -> &mut Self

§Description

-q

Quiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed.

Source

pub fn quiet(self, v: bool) -> Self

§Description

-q

Quiet mode, which suppresses normal output messages about the list of files being integrated, copied, or merged. Messages regarding errors or exceptional conditions are displayed.

Source

pub fn get_virtual_integration(&self) -> bool

§Description

-v

Performs a “virtual” integration that does not modify client workspace files unless target files need to be resolved. After submitting a “virtual integration”, p4 sync can be used to update the workspace.

Source

pub fn set_virtual_integration(&mut self, v: bool) -> &mut Self

§Description

-v

Performs a “virtual” integration that does not modify client workspace files unless target files need to be resolved. After submitting a “virtual integration”, p4 sync can be used to update the workspace.

Source

pub fn virtual_integration(self, v: bool) -> Self

§Description

-v

Performs a “virtual” integration that does not modify client workspace files unless target files need to be resolved. After submitting a “virtual integration”, p4 sync can be used to update the workspace.

Source

pub fn get_suppress_keyword_expansion(&self) -> bool

§Description

-K

Suppress keyword expansion when updating +k type files on the client.

Source

pub fn set_suppress_keyword_expansion(&mut self, v: bool) -> &mut Self

§Description

-K

Suppress keyword expansion when updating +k type files on the client.

Source

pub fn suppress_keyword_expansion(self, v: bool) -> Self

§Description

-K

Suppress keyword expansion when updating +k type files on the client.

Source§

impl Copy<Branch<Unselected>>

Source

pub fn get_branch(&self) -> &str

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn set_branch(&mut self, v: impl Into<String>) -> &mut Self

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn branch(self, v: impl Into<String>) -> Self

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn reverse(self) -> Copy<Branch<BranchReverse>>

§Description

-r

Reverse the mappings in the branch view, integrating from the target files to the source files. Requires the -b option.

Transitions this command to the BranchReverse state.

Source

pub fn source(self, v: impl Into<String>) -> Copy<BranchOverride>

§Description

-s fromFile[rev]

Treat fromFile as the source and both sides of the branch view as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r option, if specified. Requires -b.

Transitions this command to the BranchOverride state.

Source§

impl Copy<Branch<BranchReverse>>

Source

pub fn get_branch(&self) -> &str

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn set_branch(&mut self, v: impl Into<String>) -> &mut Self

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn branch(self, v: impl Into<String>) -> Self

§Description

-b branch

The branch view used to determine source and target files.

Source§

impl Copy<BranchOverride>

Source

pub fn get_branch(&self) -> &str

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn set_branch(&mut self, v: impl Into<String>) -> &mut Self

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn branch(self, v: impl Into<String>) -> Self

§Description

-b branch

The branch view used to determine source and target files.

Source

pub fn get_source(&self) -> &str

§Description

-s fromFile[rev]

Treat fromFile as the source and both sides of the branch view as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r option, if specified. Requires -b.

Source

pub fn set_source(&mut self, v: impl Into<String>) -> &mut Self

§Description

-s fromFile[rev]

Treat fromFile as the source and both sides of the branch view as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r option, if specified. Requires -b.

Source

pub fn source(self, v: impl Into<String>) -> Self

§Description

-s fromFile[rev]

Treat fromFile as the source and both sides of the branch view as the target. To restrict the scope of the target further, specify the optional toFile parameter. Overrides the -r option, if specified. Requires -b.

Source§

impl<S> Copy<Stream<S>>

Source

pub fn get_stream(&self) -> &str

§Description

-S stream

Causes p4 copy to use a generated branch view that maps the stream to its parent and copy from a stream to its parent. To reverse the copy direction, use -r with -S.

Copies the source stream spec propagatable fields into the target stream spec and opens for edit both the target stream spec and the stream files.

Source

pub fn set_stream(&mut self, v: impl Into<String>) -> &mut Self

§Description

-S stream

Causes p4 copy to use a generated branch view that maps the stream to its parent and copy from a stream to its parent. To reverse the copy direction, use -r with -S.

Copies the source stream spec propagatable fields into the target stream spec and opens for edit both the target stream spec and the stream files.

Source

pub fn stream(self, v: impl Into<String>) -> Self

§Description

-S stream

Causes p4 copy to use a generated branch view that maps the stream to its parent and copy from a stream to its parent. To reverse the copy direction, use -r with -S.

Copies the source stream spec propagatable fields into the target stream spec and opens for edit both the target stream spec and the stream files.

Source

pub fn get_parent(&self) -> Option<&String>

§Description

-P parent

Specify a target stream other than the parent of the source stream. Requires -S.

Source

pub fn set_parent(&mut self, v: impl Into<String>) -> &mut Self

§Description

-P parent

Specify a target stream other than the parent of the source stream. Requires -S.

Source

pub fn parent(self, v: impl Into<String>) -> Self

§Description

-P parent

Specify a target stream other than the parent of the source stream. Requires -S.

Source

pub fn get_reverse(&self) -> bool

§Description

-r

Reverse the copy direction. With -S, copies from the parent stream to the source stream.

Source

pub fn set_reverse(&mut self, v: bool) -> &mut Self

§Description

-r

Reverse the copy direction. With -S, copies from the parent stream to the source stream.

Source

pub fn reverse(self, v: bool) -> Self

§Description

-r

Reverse the copy direction. With -S, copies from the parent stream to the source stream.

Source

pub fn get_force_stream_flow(&self) -> bool

§Description

-F

Force copy operation; perform the operation when the target stream is not configured to accept a copy of the source.

Source

pub fn set_force_stream_flow(&mut self, v: bool) -> &mut Self

§Description

-F

Force copy operation; perform the operation when the target stream is not configured to accept a copy of the source.

Source

pub fn force_stream_flow(self, v: bool) -> Self

§Description

-F

Force copy operation; perform the operation when the target stream is not configured to accept a copy of the source.

Source§

impl Copy<Stream<Unselected>>

Source

pub fn files_only(self) -> Copy<Stream<CopyFilesOnly>>

§Description

-Af

Copy the files only (not the stream spec).

Transitions this command to the CopyFilesOnly state.

Source

pub fn stream_spec_only(self) -> Copy<Stream<CopyStreamSpecOnly>>

§Description

-As

Copy the stream spec only (not the files).

Transitions this command to the CopyStreamSpecOnly state.

Trait Implementations§

Source§

impl<M: Clone> Clone for Copy<M>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<M: Debug> Debug for Copy<M>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<M: Default> Default for Copy<M>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<B> ParameterizedSpawn<()> for Copy<Branch<B>>

Source§

fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>

Spawns p4 copy -b branch [-r] without target file arguments as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl ParameterizedSpawn<()> for Copy<BranchOverride>

Source§

fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>

Spawns p4 copy -b branch -s fromFile[rev] without target file arguments as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<S> ParameterizedSpawn<()> for Copy<Stream<S>>

Source§

fn spawn_with(&mut self, (): ()) -> Result<Self::Output, Self::Error>

Spawns p4 copy -S stream [...] without target file arguments as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<A, B> ParameterizedSpawn<(A, B)> for Copy<Unselected>
where A: AsRef<OsStr>, B: AsRef<OsStr>,

Source§

fn spawn_with( &mut self, (from_file, to_file): (A, B), ) -> Result<Self::Output, Self::Error>

Spawns p4 copy fromFile[rev] toFile with the given source and target file arguments as a child process with piped standard output and error streams; use the returned Child handle to wait for it or interact with it.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<B, S, I> ParameterizedSpawn<(S,)> for Copy<Branch<B>>
where Branch<B>: ExclusiveOption, S: IntoIterator<Item = I>, I: AsRef<OsStr>,

Source§

fn spawn_with(&mut self, (to_files): (S,)) -> Result<Self::Output, Self::Error>

Spawns p4 copy -b branch [-r] [toFile[rev] ...] for the given target 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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<S, I> ParameterizedSpawn<(S,)> for Copy<BranchOverride>
where S: IntoIterator<Item = I>, I: AsRef<OsStr>,

Source§

fn spawn_with(&mut self, (to_files): (S,)) -> Result<Self::Output, Self::Error>

Spawns p4 copy -b branch -s fromFile[rev] [toFile ...] for the given target 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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<S, T, I> ParameterizedSpawn<(T,)> for Copy<Stream<S>>
where Stream<S>: ExclusiveOption, T: IntoIterator<Item = I>, I: AsRef<OsStr>,

Source§

fn spawn_with(&mut self, (to_files): (T,)) -> Result<Self::Output, Self::Error>

Spawns p4 copy -S stream [...] [toFile[rev] ...] for the given target 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.

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<M: ExclusiveOption> SubCommand for Copy<M>

Source§

fn name(&self) -> &str

Source§

fn inject_local_args(&self, command: &mut Command)

Source§

fn global_opts(&self) -> Option<&GlobalOpts>

Source§

fn inject_args(&self, command: &mut Command)

Source§

fn setup_command<S: AsRef<OsStr>>(&self, bin: S) -> Command

Auto Trait Implementations§

§

impl<M> Freeze for Copy<M>
where M: Freeze,

§

impl<M> RefUnwindSafe for Copy<M>
where M: RefUnwindSafe,

§

impl<M> Send for Copy<M>
where M: Send,

§

impl<M> Sync for Copy<M>
where M: Sync,

§

impl<M> Unpin for Copy<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for Copy<M>
where M: UnsafeUnpin,

§

impl<M> UnwindSafe for Copy<M>
where M: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> OutputExt for T
where T: SpawnExt<Output = Child, Error = Error>,

Source§

impl<T, T1> OutputExt1<T1> for T
where T: SpawnExt1<T1, Output = Child, Error = Error>,

Source§

fn output( &mut self, a: T1, ) -> Result<Output, <T as ParameterizedSpawn<(T1,)>>::Error>

Source§

impl<T, T1, T2> OutputExt2<T1, T2> for T
where T: SpawnExt2<T1, T2, Output = Child, Error = Error>,

Source§

fn output( &mut self, a: T1, b: T2, ) -> Result<Output, <T as ParameterizedSpawn<(T1, T2)>>::Error>

Source§

impl<T, I> ParameterizedOutput<I> for T
where T: ParameterizedSpawn<I, Output = Child, Error = Error>,

Source§

type Error = Error

Source§

fn output_with( &mut self, input: I, ) -> Result<Output, <T as ParameterizedOutput<I>>::Error>

Source§

impl<T> SpawnExt for T

Source§

fn spawn( &mut self, ) -> Result<<T as ParameterizedSpawn<()>>::Output, <T as ParameterizedSpawn<()>>::Error>

Source§

impl<T, T1> SpawnExt1<T1> for T

Source§

fn spawn( &mut self, a: T1, ) -> Result<<T as ParameterizedSpawn<(T1,)>>::Output, <T as ParameterizedSpawn<(T1,)>>::Error>

Source§

impl<T, T1, T2> SpawnExt2<T1, T2> for T

Source§

fn spawn( &mut self, a: T1, b: T2, ) -> Result<<T as ParameterizedSpawn<(T1, T2)>>::Output, <T as ParameterizedSpawn<(T1, T2)>>::Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.