LockedWorkingCopy

Trait LockedWorkingCopy 

Source
pub trait LockedWorkingCopy: Any {
    // Required methods
    fn old_operation_id(&self) -> &OperationId;
    fn old_tree_id(&self) -> &MergedTreeId;
    fn snapshot(
        &mut self,
        options: &SnapshotOptions<'_>,
    ) -> Result<(MergedTreeId, SnapshotStats), SnapshotError>;
    fn check_out(
        &mut self,
        commit: &Commit,
    ) -> Result<CheckoutStats, CheckoutError>;
    fn rename_workspace(&mut self, new_workspace_name: WorkspaceNameBuf);
    fn reset(&mut self, commit: &Commit) -> Result<(), ResetError>;
    fn recover(&mut self, commit: &Commit) -> Result<(), ResetError>;
    fn sparse_patterns(&self) -> Result<&[RepoPathBuf], WorkingCopyStateError>;
    fn set_sparse_patterns(
        &mut self,
        new_sparse_patterns: Vec<RepoPathBuf>,
    ) -> Result<CheckoutStats, CheckoutError>;
    fn finish(
        self: Box<Self>,
        operation_id: OperationId,
    ) -> Result<Box<dyn WorkingCopy>, WorkingCopyStateError>;
}
Expand description

A working copy that’s being modified.

Required Methods§

Source

fn old_operation_id(&self) -> &OperationId

The operation at the time the lock was taken

Source

fn old_tree_id(&self) -> &MergedTreeId

The tree at the time the lock was taken

Source

fn snapshot( &mut self, options: &SnapshotOptions<'_>, ) -> Result<(MergedTreeId, SnapshotStats), SnapshotError>

Snapshot the working copy. Returns the tree id and stats.

Source

fn check_out(&mut self, commit: &Commit) -> Result<CheckoutStats, CheckoutError>

Check out the specified commit in the working copy.

Source

fn rename_workspace(&mut self, new_workspace_name: WorkspaceNameBuf)

Update the workspace name.

Source

fn reset(&mut self, commit: &Commit) -> Result<(), ResetError>

Update to another commit without touching the files in the working copy.

Source

fn recover(&mut self, commit: &Commit) -> Result<(), ResetError>

Update to another commit without touching the files in the working copy, without assuming that the previous tree exists.

Source

fn sparse_patterns(&self) -> Result<&[RepoPathBuf], WorkingCopyStateError>

See WorkingCopy::sparse_patterns()

Source

fn set_sparse_patterns( &mut self, new_sparse_patterns: Vec<RepoPathBuf>, ) -> Result<CheckoutStats, CheckoutError>

Updates the patterns that decide which paths from the current tree should be checked out in the working copy.

Source

fn finish( self: Box<Self>, operation_id: OperationId, ) -> Result<Box<dyn WorkingCopy>, WorkingCopyStateError>

Finish the modifications to the working copy by writing the updated states to disk. Returns the new (unlocked) working copy.

Implementations§

Source§

impl dyn LockedWorkingCopy

Source

pub fn downcast_ref<T: LockedWorkingCopy>(&self) -> Option<&T>

Returns reference of the implementation type.

Source

pub fn downcast_mut<T: LockedWorkingCopy>(&mut self) -> Option<&mut T>

Returns mutable reference of the implementation type.

Implementors§