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 filespecThe 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>
impl Clone<Unselected, Unselected>
Sourcepub fn new(bin: impl Into<PathBuf>) -> Self
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>
impl<P, M> Clone<P, M>
Sourcepub fn set_bin(&mut self, bin: impl Into<PathBuf>) -> &mut Self
pub fn set_bin(&mut self, bin: impl Into<PathBuf>) -> &mut Self
Sets the path to the Perforce command-line executable.
Sourcepub fn bin(self, bin: impl Into<PathBuf>) -> Self
pub fn bin(self, bin: impl Into<PathBuf>) -> Self
Sets the path to the Perforce command-line executable.
Sourcepub fn get_user(&self) -> Option<&str>
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.
Sourcepub fn get_dir(&self) -> Option<&Path>
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.
Sourcepub fn dir(self, v: impl Into<PathBuf>) -> Self
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.
Sourcepub fn get_client(&self) -> Option<&str>
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.
Sourcepub fn set_client(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_client(&mut self, v: impl Into<String>) -> &mut Self
Sets the value of -c client.
Sourcepub fn client(self, v: impl Into<String>) -> Self
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.
Sourcepub fn depth(self, v: u64) -> Self
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.
Sourcepub fn get_verbose(&self) -> bool
pub fn get_verbose(&self) -> bool
Returns whether -v verbose mode is enabled.
Sourcepub fn set_verbose(&mut self, v: bool) -> &mut Self
pub fn set_verbose(&mut self, v: bool) -> &mut Self
Sets whether -v verbose mode is enabled.
Source§impl<M> Clone<Unselected, M>
impl<M> Clone<Unselected, M>
Sourcepub fn port(self, v: impl Into<String>) -> Clone<Port, M>
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<P> Clone<P, Unselected>
impl<P> Clone<P, Unselected>
Sourcepub fn remote(self, v: impl Into<String>) -> Clone<P, RemoteSpecMode>
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).
Sourcepub fn file(self, v: impl Into<String>) -> Clone<P, FileSpecMode>
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>
impl<P> Clone<P, RemoteSpecMode>
Sourcepub fn get_source(&self) -> &str
pub fn get_source(&self) -> &str
Returns the value of -r remotespec.
Sourcepub fn set_source(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_source(&mut self, v: impl Into<String>) -> &mut Self
Sets the value of -r remotespec.
Source§impl<P> Clone<P, FileSpecMode>
impl<P> Clone<P, FileSpecMode>
Sourcepub fn get_source(&self) -> &str
pub fn get_source(&self) -> &str
Returns the value of -f filespec.
Sourcepub fn set_source(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_source(&mut self, v: impl Into<String>) -> &mut Self
Sets the value of -f filespec.
Sourcepub fn source(self, v: impl Into<String>) -> Self
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<M: CloneTarget> ParameterizedSpawn<()> for Clone<Port, M>
impl<M: CloneTarget> ParameterizedSpawn<()> for Clone<Port, M>
Source§impl<M: CloneTarget> SubCommand for Clone<Port, M>
impl<M: CloneTarget> SubCommand for Clone<Port, M>
Source§fn inject_args(&self, command: &mut Command)
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.