Struct SyncCommand

Source
pub struct SyncCommand<'p, 'f> { /* private fields */ }
Expand description

Synchronize the client with its view of the depot

Sync updates the client workspace to reflect its current view (if it has changed) and the current contents of the depot (if it has changed). The client view maps client and depot file names and locations.

Sync adds files that are in the client view and have not been retrieved before. Sync deletes previously retrieved files that are no longer in the client view or have been deleted from the depot. Sync updates files that are still in the client view and have been updated in the depot.

By default, sync affects all files in the client workspace. If file arguments are given, sync limits its operation to those files. The file arguments can contain wildcards.

If the file argument includes a revision specifier, then the given revision is retrieved. Normally, the head revision is retrieved.

If the file argument includes a revision range specification, only files selected by the revision range are updated, and the highest revision in the range is used.

See ‘p4 help revisions’ for help specifying revisions or ranges.

Normally, sync does not overwrite workspace files that the user has manually made writable. Setting the ‘clobber’ option in the client specification disables this safety check.

§Examples

let p4 = p4_cmd::P4::new();
let dirs = p4.sync("//depot/dir/*").run().unwrap();
for dir in dirs {
    println!("{:?}", dir);
}

Implementations§

Source§

impl<'p, 'f> SyncCommand<'p, 'f>

Source

pub fn new(connection: &'p P4, file: &'f str) -> Self

Source

pub fn file(self, dir: &'f str) -> Self

Source

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

The -f flag forces resynchronization even if the client already has the file, and overwriting any writable files. This flag doesn’t affect open files.

Source

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

The -n flag previews the operation without updating the workspace.

Source

pub fn server_only(self, server_only: bool) -> Self

The -k flag updates server metadata without syncing files. It is intended to enable you to ensure that the server correctly reflects the state of files in the workspace while avoiding a large data transfer. Caution: an erroneous update can cause the server to incorrectly reflect the state of the workspace.

Source

pub fn client_only(self, client_only: bool) -> Self

The -p flag populates the client workspace, but does not update the server to reflect those updates. Any file that is already synced or opened will be bypassed with a warning message. This option is very useful for build clients or when publishing content without the need to track the state of the client workspace.

Source

pub fn verify(self, verify: bool) -> Self

The -s flag adds a safety check before sending content to the client workspace. This check uses MD5 digests to compare the content on the clients workspace against content that was last synced. If the file has been modified outside of Perforce’s control then an error message is displayed and the file is not overwritten. This check adds some extra processing which will affect the performance of the operation. Clients with ‘allwrite’ and ‘noclobber’ set do this check by default.

Source

pub fn max_files(self, max_files: usize) -> Self

The -m flag limits sync to the first ‘max’ number of files. 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.

Source

pub fn parallel(self, parallel: usize) -> Self

The –parallel flag specifies options for parallel file transfer. If your administrator has enabled parallel file transfer by setting the net.parallel.max configurable, and if there are sufficient resources across the system, a sync command may execute more rapidly by transferring multiple files in parallel. Specify threads=N to request files be sent concurrently, using N independent network connections. The N threads grab work in batches; specify batch=N to control the number of files in a batch, or batchsize=N to control the number of bytes in a batch. A sync that is too small will not initiate parallel file transfers; specify min=N to control the minimum number of files in a parallel sync, or minsize=N to control the minimum number of bytes in a parallel sync. Requesting progress indicators causes the –parallel flag to be ignored.

Auto parallel sync may be enabled by setting the net.parallel.threads configurable to the desired number of threads to be used by all sync commands. This value must be less than or equal to the value of net.parallel.max. Other net.parallel.* configurables may be specified as well, but are not required. See ‘p4 help configurables’ to see the options and their defaults. Auto parallel sync is turned off by unsetting the net.parallel.threads configurable. A user may override the configured auto parallel sync options on the command line, or may disable it via ‘p4 sync –parallel=0’.

Source

pub fn run(self) -> Result<Files, P4Error>

Run the sync command.

Trait Implementations§

Source§

impl<'p, 'f> Clone for SyncCommand<'p, 'f>

Source§

fn clone(&self) -> SyncCommand<'p, 'f>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'p, 'f> Debug for SyncCommand<'p, 'f>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'p, 'f> Freeze for SyncCommand<'p, 'f>

§

impl<'p, 'f> RefUnwindSafe for SyncCommand<'p, 'f>

§

impl<'p, 'f> Send for SyncCommand<'p, 'f>

§

impl<'p, 'f> Sync for SyncCommand<'p, 'f>

§

impl<'p, 'f> Unpin for SyncCommand<'p, 'f>

§

impl<'p, 'f> UnwindSafe for SyncCommand<'p, 'f>

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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.