pub trait LockedWorkingCopy {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn as_any_mut(&mut self) -> &mut dyn Any;
    fn old_operation_id(&self) -> &OperationId;
    fn old_tree_id(&self) -> &MergedTreeId;
    fn snapshot(
        &mut self,
        options: SnapshotOptions<'_>
    ) -> Result<MergedTreeId, SnapshotError>;
    fn check_out(
        &mut self,
        commit: &Commit
    ) -> Result<CheckoutStats, CheckoutError>;
    fn reset(&mut self, new_tree: &MergedTree) -> Result<(), ResetError>;
    fn sparse_patterns(&self) -> Result<&[RepoPath], WorkingCopyStateError>;
    fn set_sparse_patterns(
        &mut self,
        new_sparse_patterns: Vec<RepoPath>
    ) -> 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 as_any(&self) -> &dyn Any

Should return self. For down-casting purposes.

source

fn as_any_mut(&mut self) -> &mut dyn Any

Should return self. For down-casting purposes.

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, SnapshotError>

Snapshot the working copy and return the tree id.

source

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

Check out the specified commit in the working copy.

source

fn reset(&mut self, new_tree: &MergedTree) -> Result<(), ResetError>

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

source

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

See WorkingCopy::sparse_patterns()

source

fn set_sparse_patterns( &mut self, new_sparse_patterns: Vec<RepoPath> ) -> 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.

Implementors§