pub struct Edit<M = Unselected> { /* private fields */ }Expand description
p4 [g-opts] edit [-c changelist] [-k -n] [-t type] [--remote=remote] file ...
p4 [g-opts] edit -So [-c changelist]
Opens files in a client workspace for edit, or open the current stream spec.
The M type parameter tracks the command form at compile time. The
default Unselected state opens plain files with no edit-mode options;
Self::keep_workspace, Self::preview, Self::remote_server, and
Self::filetype transition to the FileEditMode state, while
Self::edit_stream_spec transitions to the StreamSpecEditMode
state.
Implementations§
Source§impl Edit<Unselected>
impl Edit<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 edit command.
bin is the path to the Perforce command-line executable.
Sourcepub fn keep_workspace(self, v: bool) -> Edit<FileEditMode>
pub fn keep_workspace(self, v: bool) -> Edit<FileEditMode>
§Description
-k
Keep existing workspace files; mark the file as open for edit even if
the file is not in the client view. Use p4 edit -k only in the
context of reconciling work performed while disconnected from the
shared versioning service.
Transitions this command to the FileEditMode state.
Sourcepub fn preview(self, v: bool) -> Edit<FileEditMode>
pub fn preview(self, v: bool) -> Edit<FileEditMode>
§Description
-n
Preview which files would be opened for edit, without actually changing any files or metadata.
Transitions this command to the FileEditMode state.
Sourcepub fn remote_server(self, v: impl Into<String>) -> Edit<FileEditMode>
pub fn remote_server(self, v: impl Into<String>) -> Edit<FileEditMode>
§Description
--remote=remote
Opens the file for edit in your personal server, and additionally — if
the file is of type +l — takes a global exclusive lock on the file in
the shared server from which you cloned the file.
Transitions this command to the FileEditMode state.
Sourcepub fn filetype(self, v: impl Into<String>) -> Edit<FileEditMode>
pub fn filetype(self, v: impl Into<String>) -> Edit<FileEditMode>
§Description
-t type
Stores the new file revision as the specified type, overriding the file
type of the previous revision of the same file. To forcibly re-detect a
file’s filetype upon editing a file, use p4 edit -t auto. This assigns
a file type as if the file were being newly added.
See File types as well as the lbr.autocompress configurable.
Transitions this command to the FileEditMode state.
Sourcepub fn edit_stream_spec(self) -> Edit<StreamSpecEditMode>
pub fn edit_stream_spec(self) -> Edit<StreamSpecEditMode>
§Description
-So
Can be used with -c changelist to open the client’s stream spec for
edit. No list of files is allowed. p4 edit -So is an alias for
p4 stream edit (see also p4 help streamcmds).
Transitions this command to the StreamSpecEditMode state.
Source§impl Edit<FileEditMode>
impl Edit<FileEditMode>
Sourcepub fn get_keep_workspace(&self) -> bool
pub fn get_keep_workspace(&self) -> bool
§Description
-k
Keep existing workspace files; mark the file as open for edit even if
the file is not in the client view. Use p4 edit -k only in the
context of reconciling work performed while disconnected from the
shared versioning service.
Sourcepub fn set_keep_workspace(&mut self, v: bool) -> &mut Self
pub fn set_keep_workspace(&mut self, v: bool) -> &mut Self
§Description
-k
Keep existing workspace files; mark the file as open for edit even if
the file is not in the client view. Use p4 edit -k only in the
context of reconciling work performed while disconnected from the
shared versioning service.
Sourcepub fn keep_workspace(self, v: bool) -> Self
pub fn keep_workspace(self, v: bool) -> Self
§Description
-k
Keep existing workspace files; mark the file as open for edit even if
the file is not in the client view. Use p4 edit -k only in the
context of reconciling work performed while disconnected from the
shared versioning service.
Sourcepub fn get_preview(&self) -> bool
pub fn get_preview(&self) -> bool
§Description
-n
Preview which files would be opened for edit, without actually changing any files or metadata.
Sourcepub fn set_preview(&mut self, v: bool) -> &mut Self
pub fn set_preview(&mut self, v: bool) -> &mut Self
§Description
-n
Preview which files would be opened for edit, without actually changing any files or metadata.
Sourcepub fn preview(self, v: bool) -> Self
pub fn preview(self, v: bool) -> Self
§Description
-n
Preview which files would be opened for edit, without actually changing any files or metadata.
Sourcepub fn get_remote_server(&self) -> Option<&String>
pub fn get_remote_server(&self) -> Option<&String>
§Description
--remote=remote
Opens the file for edit in your personal server, and additionally — if
the file is of type +l — takes a global exclusive lock on the file in
the shared server from which you cloned the file.
Sourcepub fn set_remote_server(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_remote_server(&mut self, v: impl Into<String>) -> &mut Self
§Description
--remote=remote
Opens the file for edit in your personal server, and additionally — if
the file is of type +l — takes a global exclusive lock on the file in
the shared server from which you cloned the file.
Sourcepub fn remote_server(self, v: impl Into<String>) -> Self
pub fn remote_server(self, v: impl Into<String>) -> Self
§Description
--remote=remote
Opens the file for edit in your personal server, and additionally — if
the file is of type +l — takes a global exclusive lock on the file in
the shared server from which you cloned the file.
Sourcepub fn get_filetype(&self) -> Option<&String>
pub fn get_filetype(&self) -> Option<&String>
§Description
-t type
Stores the new file revision as the specified type, overriding the file
type of the previous revision of the same file. To forcibly re-detect a
file’s filetype upon editing a file, use p4 edit -t auto. This assigns
a file type as if the file were being newly added.
See File types as well as the lbr.autocompress configurable.
Sourcepub fn set_filetype(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_filetype(&mut self, v: impl Into<String>) -> &mut Self
§Description
-t type
Stores the new file revision as the specified type, overriding the file
type of the previous revision of the same file. To forcibly re-detect a
file’s filetype upon editing a file, use p4 edit -t auto. This assigns
a file type as if the file were being newly added.
See File types as well as the lbr.autocompress configurable.
Sourcepub fn filetype(self, v: impl Into<String>) -> Self
pub fn filetype(self, v: impl Into<String>) -> Self
§Description
-t type
Stores the new file revision as the specified type, overriding the file
type of the previous revision of the same file. To forcibly re-detect a
file’s filetype upon editing a file, use p4 edit -t auto. This assigns
a file type as if the file were being newly added.
See File types as well as the lbr.autocompress configurable.
Source§impl<M: ExclusiveOption> Edit<M>
impl<M: ExclusiveOption> Edit<M>
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_change_list(&self) -> Option<&String>
pub fn get_change_list(&self) -> Option<&String>
§Description
-c changelist
Opens the files for edit within the specified changelist. If this option is not provided, the files are linked to the default changelist.
Sourcepub fn set_change_list(&mut self, v: impl Into<String>) -> &mut Self
pub fn set_change_list(&mut self, v: impl Into<String>) -> &mut Self
§Description
-c changelist
Opens the files for edit within the specified changelist. If this option is not provided, the files are linked to the default changelist.
Sourcepub fn change_list(self, v: impl Into<String>) -> Self
pub fn change_list(self, v: impl Into<String>) -> Self
§Description
-c changelist
Opens the files for edit within the specified changelist. If this option is not provided, the files are linked to the default changelist.
Trait Implementations§
Source§impl ParameterizedSpawn for Edit<Unselected>
impl ParameterizedSpawn for Edit<Unselected>
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 edit 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.
This corresponds to the file form of the command:
p4 edit [options] file ....
type Input<'a> = &'a [&'a OsStr]
type Output<'a> = Child
type Error = Error
Source§impl ParameterizedSpawn for Edit<FileEditMode>
impl ParameterizedSpawn for Edit<FileEditMode>
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 edit 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.
This corresponds to the file form of the command:
p4 edit [options] file ....
type Input<'a> = &'a [&'a OsStr]
type Output<'a> = Child
type Error = Error
Source§impl ParameterizedSpawn for Edit<StreamSpecEditMode>
Available on non-crate feature lt2019_1 only.
impl ParameterizedSpawn for Edit<StreamSpecEditMode>
lt2019_1 only.Source§fn spawn_with<'a>(
&mut self,
(): Self::Input<'a>,
) -> Result<Self::Output<'a>, Self::Error>
fn spawn_with<'a>( &mut self, (): Self::Input<'a>, ) -> Result<Self::Output<'a>, Self::Error>
Spawns p4 edit -So to open the current stream spec for edit as a
child process with piped standard output and error streams; use the
returned Child handle to wait for it or interact with it.
This corresponds to the stream spec form of the command:
p4 edit -So [-c changelist], which takes no file arguments.