Skip to main content

Clone

Struct Clone 

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

Type-safe builder for p4 clone.

Clone a new local P4 Server from a remote server.

When you clone from a remote server, you copy the portion of its contents that you want to work with into your local server.

Unlike most commands, p4 clone does not accept the full set of global options: only -u user, -d dir, and -c client are recognized before the subcommand, so they are modelled as ordinary options here rather than through GlobalOpts.

§Syntax

p4 [-u user] [-d dir] [-c client] clone [-m depth] [-v] -p port -r remote
p4 [-u user] [-d dir] [-c client] clone [-m depth] [-v] -p port -f filespec

The P type parameter tracks the remote port (-p) at compile time and the M type parameter tracks the clone target (-r / -f); both start as Unselected, in which the command cannot be assembled. Select a port with Self::port and exactly one target with Self::remote or Self::file before assembling the command.

Implementations§

Source§

impl Clone<Unselected, Unselected>

Source

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

Creates a new p4 clone command with no remote port and no clone target selected.

bin is the path to the Perforce command-line executable. The command cannot be assembled in this state; select a remote port with Self::port (-p) and exactly one target with Self::remote (-r) or Self::file (-f) first.

Source§

impl<P, M> Clone<P, M>

Source

pub fn get_bin(&self) -> &Path

Returns the path to the Perforce command-line executable.

Source

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

Sets the path to the Perforce command-line executable.

Source

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

Sets the path to the Perforce command-line executable.

Source

pub fn get_user(&self) -> Option<&str>

Returns the value of -u user, if set.

This is one of the few options that p4 clone recognizes before the subcommand, in place of the full set of global options.

Source

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

Sets the value of -u user.

Source

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

Sets -u user.

§Description

-u user

Specifies the P4 Server user.

Source

pub fn get_dir(&self) -> Option<&Path>

Returns the value of -d dir, if set.

This is one of the few options that p4 clone recognizes before the subcommand, in place of the full set of global options.

Source

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

Sets the value of -d dir.

Source

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

Sets -d dir.

§Description

-d dir

Specifies the directory in which the new P4 Server is initialized. If not specified, defaults to the current directory.

Source

pub fn get_client(&self) -> Option<&str>

Returns the value of -c client, if set.

This is one of the few options that p4 clone recognizes before the subcommand, in place of the full set of global options.

Source

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

Sets the value of -c client.

Source

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

Sets -c client.

§Description

-c client

Specifies the client name. If not specified, defaults to the name established with the p4 init command.

Source

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

Returns the value of -m depth, if set.

Source

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

Sets the value of -m depth.

Source

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

Sets -m depth.

§Description

-m depth

Specifies the maximum number of revisions of each file to clone; a shallow clone.

Source

pub fn get_verbose(&self) -> bool

Returns whether -v verbose mode is enabled.

Source

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

Sets whether -v verbose mode is enabled.

Source

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

Enables -v verbose mode when v is true.

§Description

-v

Enables verbose mode.

Source§

impl<M> Clone<Unselected, M>

Source

pub fn port(self, v: impl Into<String>) -> Clone<Port, M>

Sets -p port and transitions this command to the Port state.

§Description

-p port

Specifies the address (P4PORT) of the remote server you wish to clone from.

This flag is optional. If not specified, p4 clone uses the remote server specified by the P4PORT environment variable.

A remote port is required before the command can be assembled.

Source§

impl<M> Clone<Port, M>

Source

pub fn get_port(&self) -> &str

Returns the value of -p port.

Source

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

Sets the value of -p port.

Source

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

Sets -p port.

§Description

-p port

Specifies the address (P4PORT) of the remote server you wish to clone from.

This flag is optional. If not specified, p4 clone uses the remote server specified by the P4PORT environment variable.

Source§

impl<P> Clone<P, Unselected>

Source

pub fn remote(self, v: impl Into<String>) -> Clone<P, RemoteSpecMode>

Sets -r remotespec and transitions this command to the RemoteSpecMode state.

§Description

-r remotespec

Specifies the remote spec call remotespec installed on the remote server to use as a template for the clone and stream setup.

This is mutually exclusive with -f filespec (Self::file).

Source

pub fn file(self, v: impl Into<String>) -> Clone<P, FileSpecMode>

Sets -f filespec and transitions this command to the FileSpecMode state.

§Description

-f filespec

Specifies a filespec in the remote server to use as the path to clone. The P4 Server uses this path to determine the stream setup in the local server. P4 Server also uses this file specification to determine the stream setup in the personal server. Specifying the filespec also creates a default remote spec called origin.

The -f preceding the filespec is optional. You can simply issue the command p4 clone //file/path.

This is mutually exclusive with -r remotespec (Self::remote).

Source§

impl<P> Clone<P, RemoteSpecMode>

Source

pub fn get_source(&self) -> &str

Returns the value of -r remotespec.

Source

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

Sets the value of -r remotespec.

Source

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

Sets -r remotespec.

§Description

-r remotespec

Specifies the remote spec call remotespec installed on the remote server to use as a template for the clone and stream setup.

Source§

impl<P> Clone<P, FileSpecMode>

Source

pub fn get_source(&self) -> &str

Returns the value of -f filespec.

Source

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

Sets the value of -f filespec.

Source

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

Sets -f filespec.

§Description

-f filespec

Specifies a filespec in the remote server to use as the path to clone. The P4 Server uses this path to determine the stream setup in the local server. P4 Server also uses this file specification to determine the stream setup in the personal server. Specifying the filespec also creates a default remote spec called origin.

The -f preceding the filespec is optional. You can simply issue the command p4 clone //file/path.

Trait Implementations§

Source§

impl<P: Clone, M: Clone> Clone for Clone<P, 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<P: Debug, M: Debug> Debug for Clone<P, M>

Source§

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

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

impl<M: CloneTarget> ParameterizedSpawn<()> for Clone<Port, M>

Source§

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

Spawns p4 clone 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: CloneTarget> SubCommand for Clone<Port, M>

Source§

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

Injects the options that precede the subcommand name (-u, -d, -c), then the subcommand name, then the remaining options.

p4 clone does not accept the global options, so no GlobalOpts are injected.

Source§

fn name(&self) -> &str

Source§

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

Source§

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

Source§

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

Auto Trait Implementations§

§

impl<P, M> Freeze for Clone<P, M>
where P: Freeze, M: Freeze,

§

impl<P, M> RefUnwindSafe for Clone<P, M>

§

impl<P, M> Send for Clone<P, M>
where P: Send, M: Send,

§

impl<P, M> Sync for Clone<P, M>
where P: Sync, M: Sync,

§

impl<P, M> Unpin for Clone<P, M>
where P: Unpin, M: Unpin,

§

impl<P, M> UnsafeUnpin for Clone<P, M>
where P: UnsafeUnpin, M: UnsafeUnpin,

§

impl<P, M> UnwindSafe for Clone<P, M>
where P: UnwindSafe, 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, 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> 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.