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>
impl Sync<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 sync command.
bin is the path to the Perforce command-line executable.
Sourcepub fn sync_time(self, time: impl Into<String>) -> Sync<SyncTimeMode>
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.
Sourcepub fn enable_safe_check(self) -> Sync<RegularMode<SafeCheckMode>>
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.
Sourcepub fn populate_client_workspace(self) -> Sync<RegularMode<PopulateMode>>
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.
Sourcepub fn verify_edge_replication(self, v: bool) -> Sync<RegularMode>
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.
Sourcepub fn script_list_mode(self, v: bool) -> Sync<RegularMode>
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.
Sourcepub fn suppress_keyword_expansion(self, v: bool) -> Sync<RegularMode>
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.
Sourcepub fn quiet_mode(self, v: bool) -> Sync<RegularMode>
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.
Sourcepub fn limit(self, v: u64) -> Sync<RegularMode>
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.
Sourcepub fn parallel(self, v: ParallelConfig) -> Sync<RegularMode>
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.
Sourcepub fn stream_spec_version(self, v: StreamSpecVersion) -> Sync<RegularMode>
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.
Sourcepub fn sc_max_change_number(self) -> Sync<RegularMode>
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.
Sourcepub fn sc_current_stream_spec(self) -> Sync<RegularMode>
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.
Sourcepub fn sc_change_number(self, n: u32) -> Sync<RegularMode>
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.
Sourcepub fn preview_result(self) -> Sync<RegularMode<Unselected, PreviewResult>>
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.
Sourcepub fn preview_network_traffic(
self,
) -> Sync<RegularMode<Unselected, PreviewNetworkTraffic>>
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.
Sourcepub fn force(self, v: bool) -> Sync<RegularMode<ForceRegularMode>>
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.
Sourcepub fn metadata_only(self, v: bool) -> Sync<RegularMode<ForceRegularMode>>
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.
Sourcepub fn reopen_moved_files(self, v: bool) -> Sync<RegularMode<ForceRegularMode>>
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>>
impl<Mode: ExclusiveOption, P: ExclusiveOption> Sync<RegularMode<Mode, P>>
Sourcepub fn get_verify_edge_replication(&self) -> bool
pub fn get_verify_edge_replication(&self) -> bool
Returns whether edge replication is verified (-E).
Sourcepub fn set_verify_edge_replication(&mut self, v: bool) -> &mut Self
pub fn set_verify_edge_replication(&mut self, v: bool) -> &mut Self
Sets whether edge replication is verified (-E).
Sourcepub fn verify_edge_replication(self, v: bool) -> Self
pub fn verify_edge_replication(self, v: bool) -> Self
Sets whether edge replication is verified (-E).
Sourcepub fn get_script_list_mode(&self) -> bool
pub fn get_script_list_mode(&self) -> bool
Returns whether script list mode is enabled (-L).
Sourcepub fn set_script_list_mode(&mut self, v: bool) -> &mut Self
pub fn set_script_list_mode(&mut self, v: bool) -> &mut Self
Sets whether script list mode is enabled (-L).
Sourcepub fn script_list_mode(self, v: bool) -> Self
pub fn script_list_mode(self, v: bool) -> Self
Sets whether script list mode is enabled (-L).
Sourcepub fn get_suppress_keyword_expansion(&self) -> bool
pub fn get_suppress_keyword_expansion(&self) -> bool
Returns whether keyword expansion is suppressed (-K).
Sourcepub fn set_suppress_keyword_expansion(&mut self, v: bool) -> &mut Self
pub fn set_suppress_keyword_expansion(&mut self, v: bool) -> &mut Self
Sets whether keyword expansion is suppressed (-K).
Sourcepub fn suppress_keyword_expansion(self, v: bool) -> Self
pub fn suppress_keyword_expansion(self, v: bool) -> Self
Sets whether keyword expansion is suppressed (-K).
Sourcepub fn get_quiet_mode(&self) -> bool
pub fn get_quiet_mode(&self) -> bool
Returns whether quiet mode is enabled (-q).
Sourcepub fn set_quiet_mode(&mut self, v: bool) -> &mut Self
pub fn set_quiet_mode(&mut self, v: bool) -> &mut Self
Sets whether quiet mode is enabled (-q).
Sourcepub fn quiet_mode(self, v: bool) -> Self
pub fn quiet_mode(self, v: bool) -> Self
Sets whether quiet mode is enabled (-q).
Sourcepub fn set_limit(&mut self, v: u64) -> &mut Self
pub fn set_limit(&mut self, v: u64) -> &mut Self
Sets the maximum number of files to sync (-m max).
Sourcepub fn get_parallel(&self) -> Option<&ParallelConfig>
pub fn get_parallel(&self) -> Option<&ParallelConfig>
Returns the parallel sync configuration (--parallel).
Sourcepub fn set_parallel(&mut self, v: ParallelConfig) -> &mut Self
pub fn set_parallel(&mut self, v: ParallelConfig) -> &mut Self
Sets the parallel sync configuration (--parallel).
Sourcepub fn parallel(self, v: ParallelConfig) -> Self
pub fn parallel(self, v: ParallelConfig) -> Self
Sets the parallel sync configuration (--parallel).
Sourcepub fn get_stream_spec_version(&self) -> Option<StreamSpecVersion>
pub fn get_stream_spec_version(&self) -> Option<StreamSpecVersion>
Returns the stream spec version (--use-stream-change).
Sourcepub fn set_stream_spec_version(&mut self, v: StreamSpecVersion) -> &mut Self
pub fn set_stream_spec_version(&mut self, v: StreamSpecVersion) -> &mut Self
Sets the stream spec version (--use-stream-change).
Sourcepub fn stream_spec_version(self, v: StreamSpecVersion) -> Self
pub fn stream_spec_version(self, v: StreamSpecVersion) -> Self
Sets the stream spec version (--use-stream-change).
Sourcepub fn set_sc_max_change_number(&mut self) -> &mut Self
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.
Sourcepub fn sc_max_change_number(self) -> Self
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.
Sourcepub fn set_sc_current_stream_spec(&mut self) -> &mut Self
pub fn set_sc_current_stream_spec(&mut self) -> &mut Self
--use-stream-change=0: use the current stream spec version.
Sourcepub fn sc_current_stream_spec(self) -> Self
pub fn sc_current_stream_spec(self) -> Self
--use-stream-change=0: use the current stream spec version.
Sourcepub fn set_sc_change_number(&mut self, n: u32) -> &mut Self
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.
Sourcepub fn sc_change_number(self, n: u32) -> Self
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>>
impl<P: ExclusiveOption> Sync<RegularMode<Unselected, P>>
Sourcepub fn force(self, v: bool) -> Sync<RegularMode<ForceRegularMode, P>>
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.
Sourcepub fn metadata_only(self, v: bool) -> Sync<RegularMode<ForceRegularMode, P>>
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.
Sourcepub fn reopen_moved_files(
self,
v: bool,
) -> Sync<RegularMode<ForceRegularMode, P>>
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.
Sourcepub fn safe_check(self) -> Sync<RegularMode<SafeCheckMode, P>>
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.
Sourcepub fn populate(self) -> Sync<RegularMode<PopulateMode, P>>
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>>
impl<Mode: ExclusiveOption> Sync<RegularMode<Mode, Unselected>>
Sourcepub fn preview_result(self) -> Sync<RegularMode<Mode, PreviewResult>>
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.
Sourcepub fn preview_network_traffic(
self,
) -> Sync<RegularMode<Mode, PreviewNetworkTraffic>>
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>>
impl<P: ExclusiveOption> Sync<RegularMode<ForceRegularMode, P>>
Sourcepub fn get_metadata_only(&self) -> bool
pub fn get_metadata_only(&self) -> bool
Returns whether only metadata is updated (-k).
Sourcepub fn set_metadata_only(&mut self, v: bool) -> &mut Self
pub fn set_metadata_only(&mut self, v: bool) -> &mut Self
Sets whether only metadata is updated (-k).
Sourcepub fn metadata_only(self, v: bool) -> Self
pub fn metadata_only(self, v: bool) -> Self
Sets whether only metadata is updated (-k).
Sourcepub fn get_reopen_moved_files(&self) -> bool
pub fn get_reopen_moved_files(&self) -> bool
Returns whether moved files are reopened (-r).
Sourcepub fn set_reopen_moved_files(&mut self, v: bool) -> &mut Self
pub fn set_reopen_moved_files(&mut self, v: bool) -> &mut Self
Sets whether moved files are reopened (-r).
Sourcepub fn reopen_moved_files(self, v: bool) -> Self
pub fn reopen_moved_files(self, v: bool) -> Self
Sets whether moved files are reopened (-r).
Source§impl Sync<SyncTimeMode>
impl Sync<SyncTimeMode>
Sourcepub fn get_sync_time(&self) -> &str
pub fn get_sync_time(&self) -> &str
Returns the sync time value (--sync-time=N).
Sourcepub fn set_sync_time(&mut self, v: impl Into<String>) -> &mut Self
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§impl<M: ExclusiveOption> Sync<M>
impl<M: ExclusiveOption> Sync<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
Trait Implementations§
Source§impl<M: ExclusiveOption, S, I> ParameterizedSpawn<(S,)> for Sync<M>
impl<M: ExclusiveOption, S, I> ParameterizedSpawn<(S,)> for Sync<M>
Source§fn spawn_with(&mut self, (files): (S,)) -> Result<Self::Output, Self::Error>
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.