Skip to main content

Sync

Struct Sync 

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

Update the client workspace to reflect the contents of the depot.

The M type parameter tracks the top-level mode at compile time. The default Unselected state syncs files without local options; setting any regular option or calling a mode-transition method moves into RegularMode; Self::sync_time moves into SyncTimeMode.

Implementations§

Source§

impl Sync<Unselected>

Source

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

Creates a new p4 sync command.

bin is the path to the Perforce command-line executable.

Source

pub fn sync_time(self, time: impl Into<String>) -> Sync<SyncTimeMode>

§Description

-k --sync-time=N

Update the have list to reflect the state of the depot at the given time without transferring files. The value of N can be Unix epoch time or the Perforce date time format.

This mode always implies -k, so no separate interface is provided for it. Transitions this command to the SyncTimeMode state.

Source

pub fn enable_safe_check(self) -> Sync<RegularMode<SafeCheckMode>>

§Description

-s

Safe sync: compare the content in the client workspace against what was last synced. If the file was modified outside of the control of P4 Server, an error message is displayed and the file is not overwritten.

Transitions this command to the RegularMode state with the SafeCheckMode sub-mode.

Source

pub fn populate_client_workspace(self) -> Sync<RegularMode<PopulateMode>>

§Description

-p

Populate a client workspace, but do not update the have list. Any file that is already synced or opened is bypassed with a warning message.

Transitions this command to the RegularMode state with the PopulateMode sub-mode.

Source

pub fn verify_edge_replication(self, v: bool) -> Sync<RegularMode>

§Description

-E

For edge servers replicating from a commit or an upstream edge, verify that any changelists specified in the revSpec are submitted before continuing with the sync.

Transitions this command to the RegularMode state.

Source

pub fn script_list_mode(self, v: bool) -> Sync<RegularMode>

§Description

-L

For scripting purposes, perform the sync on a list of valid file arguments in full depot syntax with a valid revision number.

When this flag is used, the arguments are processed together by building an internal table similar to a label. This file list processing is significantly faster than having to call the internal query engine for each individual file argument. However, the file argument syntax is strict and the command will not run if an error is encountered.

Transitions this command to the RegularMode state.

Source

pub fn suppress_keyword_expansion(self, v: bool) -> Sync<RegularMode>

§Description

-K

Suppress keyword expansion when updating +k type files on the client. To learn more, see File type modifiers.

Transitions this command to the RegularMode state.

Source

pub fn quiet_mode(self, v: bool) -> Sync<RegularMode>

§Description

-q

Quiet operation: suppress normal output messages. Messages describing errors or exceptional conditions are not suppressed.

Transitions this command to the RegularMode state.

Source

pub fn limit(self, v: u64) -> Sync<RegularMode>

§Description

-m max

Sync only the first max files specified.

This option is useful in conjunction with tagged output and the -n flag, to preview how many files will be synced without transferring all the file data.

Transitions this command to the RegularMode state.

Source

pub fn parallel(self, v: ParallelConfig) -> Sync<RegularMode>

§Description

--parallel=threads=N[,batch=N][,batchsize=N][,min=N][,minsize=N]

Specify options for parallel file transfer.

Transitions this command to the RegularMode state.

Source

pub fn stream_spec_version(self, v: StreamSpecVersion) -> Sync<RegularMode>

§Description

--use-stream-change[N]

Specify the stream specification version to use for generating the client view for sync.

Transitions this command to the RegularMode state.

Source

pub fn sc_max_change_number(self) -> Sync<RegularMode>

--use-stream-change (no value): the maximum change number in the file list determines the stream spec version.

Transitions this command to the RegularMode state.

Source

pub fn sc_current_stream_spec(self) -> Sync<RegularMode>

--use-stream-change=0: use the current stream spec version.

Transitions this command to the RegularMode state.

Source

pub fn sc_change_number(self, n: u32) -> Sync<RegularMode>

--use-stream-change=N: use the stream spec version at or before change n.

Transitions this command to the RegularMode state.

Source

pub fn preview_result(self) -> Sync<RegularMode<Unselected, PreviewResult>>

§Description

-n

Preview mode: display the results of the sync without actually performing the sync.

Transitions this command to the RegularMode state with the PreviewResult preview mode.

Source

pub fn preview_network_traffic( self, ) -> Sync<RegularMode<Unselected, PreviewNetworkTraffic>>

§Description

-N

Preview mode: display a summary of the expected network traffic associated with a sync, without performing the sync.

This tells you how many files are to be added or updated, which is useful if there are many large files, limits on bandwidth, or limits on disk space.

Transitions this command to the RegularMode state with the PreviewNetworkTraffic preview mode.

Source

pub fn force(self, v: bool) -> Sync<RegularMode<ForceRegularMode>>

§Description

-f

Force the sync. P4 Server performs the sync even if the client workspace already has the file at the specified revision. If the file is writable, it is overwritten.

This option does not affect open files, but it does override the noclobber client option (see p4 client).

Transitions this command to the RegularMode state with the ForceRegularMode sub-mode, which prevents further transitions to SafeCheckMode or PopulateMode.

Source

pub fn metadata_only(self, v: bool) -> Sync<RegularMode<ForceRegularMode>>

§Description

-k

Update server metadata without syncing files. Keep existing workspace files and update the have list without updating the client workspace.

Transitions this command to the RegularMode state with the ForceRegularMode sub-mode, which prevents further transitions to SafeCheckMode or PopulateMode.

Source

pub fn reopen_moved_files(self, v: bool) -> Sync<RegularMode<ForceRegularMode>>

§Description

-r

Reopen files that are mapped to new locations in the depot, in the new location.

Transitions this command to the RegularMode state with the ForceRegularMode sub-mode, which prevents further transitions to SafeCheckMode or PopulateMode.

Source§

impl<Mode: ExclusiveOption, P: ExclusiveOption> Sync<RegularMode<Mode, P>>

Source

pub fn get_verify_edge_replication(&self) -> bool

Returns whether edge replication is verified (-E).

Source

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

Sets whether edge replication is verified (-E).

Source

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

Sets whether edge replication is verified (-E).

Source

pub fn get_script_list_mode(&self) -> bool

Returns whether script list mode is enabled (-L).

Source

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

Sets whether script list mode is enabled (-L).

Source

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

Sets whether script list mode is enabled (-L).

Source

pub fn get_suppress_keyword_expansion(&self) -> bool

Returns whether keyword expansion is suppressed (-K).

Source

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

Sets whether keyword expansion is suppressed (-K).

Source

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

Sets whether keyword expansion is suppressed (-K).

Source

pub fn get_quiet_mode(&self) -> bool

Returns whether quiet mode is enabled (-q).

Source

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

Sets whether quiet mode is enabled (-q).

Source

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

Sets whether quiet mode is enabled (-q).

Source

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

Returns the maximum number of files to sync (-m max).

Source

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

Sets the maximum number of files to sync (-m max).

Source

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

Sets the maximum number of files to sync (-m max).

Source

pub fn get_parallel(&self) -> Option<&ParallelConfig>

Returns the parallel sync configuration (--parallel).

Source

pub fn set_parallel(&mut self, v: ParallelConfig) -> &mut Self

Sets the parallel sync configuration (--parallel).

Source

pub fn parallel(self, v: ParallelConfig) -> Self

Sets the parallel sync configuration (--parallel).

Source

pub fn get_stream_spec_version(&self) -> Option<StreamSpecVersion>

Returns the stream spec version (--use-stream-change).

Source

pub fn set_stream_spec_version(&mut self, v: StreamSpecVersion) -> &mut Self

Sets the stream spec version (--use-stream-change).

Source

pub fn stream_spec_version(self, v: StreamSpecVersion) -> Self

Sets the stream spec version (--use-stream-change).

Source

pub fn set_sc_max_change_number(&mut self) -> &mut Self

--use-stream-change (no value): the maximum change number in the file list determines the stream spec version.

Source

pub fn sc_max_change_number(self) -> Self

--use-stream-change (no value): the maximum change number in the file list determines the stream spec version.

Source

pub fn set_sc_current_stream_spec(&mut self) -> &mut Self

--use-stream-change=0: use the current stream spec version.

Source

pub fn sc_current_stream_spec(self) -> Self

--use-stream-change=0: use the current stream spec version.

Source

pub fn set_sc_change_number(&mut self, n: u32) -> &mut Self

--use-stream-change=N: use the stream spec version at or before change n.

Source

pub fn sc_change_number(self, n: u32) -> Self

--use-stream-change=N: use the stream spec version at or before change n.

Source§

impl<P: ExclusiveOption> Sync<RegularMode<Unselected, P>>

Source

pub fn force(self, v: bool) -> Sync<RegularMode<ForceRegularMode, P>>

§Description

-f

Force the sync. P4 Server performs the sync even if the client workspace already has the file at the specified revision. If the file is writable, it is overwritten.

This option does not affect open files, but it does override the noclobber client option (see p4 client).

Transitions the sub-mode to ForceRegularMode, which prevents further transitions to SafeCheckMode or PopulateMode.

Source

pub fn metadata_only(self, v: bool) -> Sync<RegularMode<ForceRegularMode, P>>

§Description

-k

Update server metadata without syncing files. Keep existing workspace files and update the have list without updating the client workspace.

Transitions the sub-mode to ForceRegularMode, which prevents further transitions to SafeCheckMode or PopulateMode.

Source

pub fn reopen_moved_files( self, v: bool, ) -> Sync<RegularMode<ForceRegularMode, P>>

§Description

-r

Reopen files that are mapped to new locations in the depot, in the new location.

Transitions the sub-mode to ForceRegularMode, which prevents further transitions to SafeCheckMode or PopulateMode.

Source

pub fn safe_check(self) -> Sync<RegularMode<SafeCheckMode, P>>

§Description

-s

Safe sync: compare the content in the client workspace against what was last synced. If the file was modified outside of the control of P4 Server, an error message is displayed and the file is not overwritten.

Transitions the sub-mode to SafeCheckMode.

Source

pub fn populate(self) -> Sync<RegularMode<PopulateMode, P>>

§Description

-p

Populate a client workspace, but do not update the have list. Any file that is already synced or opened is bypassed with a warning message.

Transitions the sub-mode to PopulateMode.

Source§

impl<Mode: ExclusiveOption> Sync<RegularMode<Mode, Unselected>>

Source

pub fn preview_result(self) -> Sync<RegularMode<Mode, PreviewResult>>

§Description

-n

Preview mode: display the results of the sync without actually performing the sync.

Transitions the preview mode to PreviewResult.

Source

pub fn preview_network_traffic( self, ) -> Sync<RegularMode<Mode, PreviewNetworkTraffic>>

§Description

-N

Preview mode: display a summary of the expected network traffic associated with a sync, without performing the sync.

This tells you how many files are to be added or updated, which is useful if there are many large files, limits on bandwidth, or limits on disk space.

Transitions the preview mode to PreviewNetworkTraffic.

Source§

impl<P: ExclusiveOption> Sync<RegularMode<ForceRegularMode, P>>

Source

pub fn get_force(&self) -> bool

Returns whether the sync is forced (-f).

Source

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

Sets whether the sync is forced (-f).

Source

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

Sets whether the sync is forced (-f).

Source

pub fn get_metadata_only(&self) -> bool

Returns whether only metadata is updated (-k).

Source

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

Sets whether only metadata is updated (-k).

Source

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

Sets whether only metadata is updated (-k).

Source

pub fn get_reopen_moved_files(&self) -> bool

Returns whether moved files are reopened (-r).

Source

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

Sets whether moved files are reopened (-r).

Source

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

Sets whether moved files are reopened (-r).

Source§

impl Sync<SyncTimeMode>

Source

pub fn get_sync_time(&self) -> &str

Returns the sync time value (--sync-time=N).

Source

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

Sets the sync time value (--sync-time=N). The value can be Unix epoch time or the Perforce date time format.

Source

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

Sets the sync time value (--sync-time=N). The value can be Unix epoch time or the Perforce date time format.

Source§

impl<M: ExclusiveOption> Sync<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.

Trait Implementations§

Source§

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

Source§

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

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

impl<M: Default> Default for Sync<M>

Source§

fn default() -> Self

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

impl<M: ExclusiveOption, S, I> ParameterizedSpawn<(S,)> for Sync<M>
where S: IntoIterator<Item = I>, I: AsRef<OsStr>,

Source§

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

Spawns p4 sync 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.

Source§

type Output = Child

Source§

type Error = Error

Source§

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

§

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

§

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

§

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

§

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

§

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

§

impl<M> UnwindSafe for Sync<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, T1> OutputExt1<T1> for T
where T: ParameterizedOutput<T1>,

Source§

fn output( &mut self, a: T1, ) -> Result<Output, <T as ParameterizedOutput<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, T1> SpawnExt1<T1> for T
where T: ParameterizedSpawn<T1>,

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.