Skip to main content

Edit

Struct Edit 

Source
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>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

Source

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.

Source

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.

Source

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.

Source

pub fn get_preview(&self) -> bool

§Description

-n

Preview which files would be opened for edit, without actually changing any files or metadata.

Source

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.

Source

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

§Description

-n

Preview which files would be opened for edit, without actually changing any files or metadata.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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>

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_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.

Source

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.

Source

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<M: Clone> Clone for Edit<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 Edit<M>

Source§

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

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

impl<M: Default> Default for Edit<M>

Source§

fn default() -> Self

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

impl ParameterizedSpawn<()> for Edit<StreamSpecEditMode>

Available on non-crate feature lt2019_1 only.
Source§

fn spawn_with(&mut self, (): ()) -> Result<Self::Output, 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.

Source§

type Output = Child

Source§

type Error = Error

Source§

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

Source§

fn spawn_with(&mut self, (files): (S,)) -> Result<Self::Output, 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 ....

Source§

type Output = Child

Source§

type Error = Error

Source§

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

Source§

fn spawn_with(&mut self, (files): (S,)) -> Result<Self::Output, 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 ....

Source§

type Output = Child

Source§

type Error = Error

Source§

impl<M: ExclusiveOption> SubCommand for Edit<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 Edit<M>
where M: Freeze,

§

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

§

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

§

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

§

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

§

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

§

impl<M> UnwindSafe for Edit<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, 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> 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.