WorkingTree

Trait WorkingTree 

Source
pub trait WorkingTree: MutableTree {
Show 52 methods // Required methods fn basedir(&self) -> PathBuf; fn controldir( &self, ) -> Box<dyn ControlDir<Branch = GenericBranch, Repository = GenericRepository, WorkingTree = GenericWorkingTree>>; fn branch(&self) -> GenericBranch; fn get_user_url(&self) -> Url; fn supports_setting_file_ids(&self) -> bool; fn smart_add(&self, files: &[&Path]) -> Result<(), Error>; fn update(&self, revision_id: Option<&RevisionId>) -> Result<(), Error>; fn revert(&self, filenames: Option<&[&Path]>) -> Result<(), Error>; fn build_commit(&self) -> CommitBuilder; fn basis_tree(&self) -> Result<RevisionTree, Error>; fn is_control_filename(&self, path: &Path) -> bool; fn revision_tree( &self, revision_id: &RevisionId, ) -> Result<Box<RevisionTree>, Error>; fn abspath(&self, path: &Path) -> Result<PathBuf, Error>; fn relpath(&self, path: &Path) -> Result<PathBuf, Error>; fn pull( &self, source: &dyn Branch, overwrite: Option<bool>, stop_revision: Option<&RevisionId>, local: Option<bool>, ) -> Result<(), Error>; fn merge_from_branch( &self, source: &dyn Branch, to_revision: Option<&RevisionId>, ) -> Result<(), Error>; fn safe_relpath_files( &self, file_list: &[&Path], canonicalize: bool, apply_view: bool, ) -> Result<Vec<PathBuf>, Error>; fn add_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>; fn add_parent_tree( &self, parent_id: &RevisionId, parent_tree: &RevisionTree, ) -> Result<(), Error>; fn add_parent_tree_id(&self, parent_id: &RevisionId) -> Result<(), Error>; fn add_pending_merge(&self, revision_id: &RevisionId) -> Result<(), Error>; fn auto_resolve(&self) -> Result<(), Error>; fn check_state(&self) -> Result<(), Error>; fn get_canonical_path(&self, path: &Path) -> Result<PathBuf, Error>; fn get_canonical_paths( &self, paths: &[&Path], ) -> Result<Vec<PathBuf>, Error>; fn get_config_stack(&self) -> Result<Py<PyAny>, Error>; fn get_reference_info( &self, path: &Path, ) -> Result<Option<(String, PathBuf)>, Error>; fn get_shelf_manager(&self) -> Result<Py<PyAny>, Error>; fn ignored_files(&self) -> Result<Vec<PathBuf>, Error>; fn is_locked(&self) -> bool; fn merge_modified(&self) -> Result<Vec<PathBuf>, Error>; fn move_files( &self, from_paths: &[&Path], to_dir: &Path, ) -> Result<(), Error>; fn set_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>; fn set_last_revision(&self, revision_id: &RevisionId) -> Result<(), Error>; fn set_merge_modified(&self, files: &[&Path]) -> Result<(), Error>; fn set_pending_merges( &self, revision_ids: &[RevisionId], ) -> Result<(), Error>; fn set_reference_info( &self, path: &Path, location: &str, file_id: Option<&str>, ) -> Result<(), Error>; fn subsume( &self, other: &(dyn PyWorkingTree + 'static), ) -> Result<(), Error>; fn store_uncommitted(&self) -> Result<String, Error>; fn restore_uncommitted(&self) -> Result<(), Error>; fn extract(&self, dest: &Path, format: Option<&str>) -> Result<(), Error>; fn clone( &self, dest: &Path, revision_id: Option<&RevisionId>, ) -> Result<GenericWorkingTree, Error>; fn control_transport(&self) -> Result<Transport, Error>; fn control_url(&self) -> Url; fn copy_content_into( &self, source: &(dyn PyTree + 'static), revision_id: Option<&RevisionId>, ) -> Result<(), Error>; fn flush(&self) -> Result<(), Error>; fn requires_rich_root(&self) -> bool; fn reset_state( &self, revision_ids: Option<&[RevisionId]>, ) -> Result<(), Error>; fn reference_parent( &self, path: &Path, branch: &dyn Branch, revision_id: Option<&RevisionId>, ) -> Result<(), Error>; fn supports_merge_modified(&self) -> bool; fn break_lock(&self) -> Result<(), Error>; fn get_physical_lock_status(&self) -> Result<bool, Error>;
}
Expand description

Trait representing a working tree in a version control system.

A working tree is a local directory containing the files of a branch that can be edited. This trait provides methods for interacting with working trees across various version control systems.

Required Methods§

Source

fn basedir(&self) -> PathBuf

Get the base directory path of this working tree.

§Returns

The absolute path to the root directory of this working tree.

Source

fn controldir( &self, ) -> Box<dyn ControlDir<Branch = GenericBranch, Repository = GenericRepository, WorkingTree = GenericWorkingTree>>

Get the control directory for this working tree.

§Returns

The control directory containing this working tree.

Source

fn branch(&self) -> GenericBranch

Get the branch associated with this working tree.

§Returns

The branch that this working tree is tracking.

Source

fn get_user_url(&self) -> Url

Get the user-visible URL for this working tree.

§Returns

The URL that can be used to access this working tree.

Source

fn supports_setting_file_ids(&self) -> bool

Check if this working tree supports setting the last revision.

§Returns

true if the working tree supports setting the last revision, false otherwise.

Source

fn smart_add(&self, files: &[&Path]) -> Result<(), Error>

Add specified files to version control and the working tree.

§Parameters
  • files - The list of file paths to add.
§Returns

Ok(()) on success, or an error if the files could not be added.

Source

fn update(&self, revision_id: Option<&RevisionId>) -> Result<(), Error>

Update the working tree to a specific revision.

§Parameters
  • revision_id - The revision to update to, or None for the latest.
§Returns

Ok(()) on success, or an error if the update failed.

Source

fn revert(&self, filenames: Option<&[&Path]>) -> Result<(), Error>

Revert changes in the working tree.

§Parameters
  • filenames - Optional list of specific files to revert.
§Returns

Ok(()) on success, or an error if the revert failed.

Source

fn build_commit(&self) -> CommitBuilder

Create a commit builder for this working tree.

§Returns

A new CommitBuilder instance for this working tree.

Source

fn basis_tree(&self) -> Result<RevisionTree, Error>

Get the basis tree for this working tree.

§Returns

The basis tree that this working tree is based on.

Source

fn is_control_filename(&self, path: &Path) -> bool

Check if a path is a control filename in this working tree.

Control filenames are filenames that are used by the version control system for its own purposes, like .git or .bzr.

§Parameters
  • path - The path to check.
§Returns

true if the path is a control filename, false otherwise.

Source

fn revision_tree( &self, revision_id: &RevisionId, ) -> Result<Box<RevisionTree>, Error>

Get a revision tree for a specific revision.

§Parameters
  • revision_id - The ID of the revision to get the tree for.
§Returns

The revision tree, or an error if it could not be retrieved.

Source

fn abspath(&self, path: &Path) -> Result<PathBuf, Error>

Convert a path to an absolute path relative to the working tree.

§Parameters
  • path - The path to convert.
§Returns

The absolute path, or an error if the conversion failed.

Source

fn relpath(&self, path: &Path) -> Result<PathBuf, Error>

Convert an absolute path to a path relative to the working tree.

§Parameters
  • path - The absolute path to convert.
§Returns

The relative path, or an error if the conversion failed.

Source

fn pull( &self, source: &dyn Branch, overwrite: Option<bool>, stop_revision: Option<&RevisionId>, local: Option<bool>, ) -> Result<(), Error>

Pull changes from another branch into this working tree.

§Parameters
  • source - The branch to pull from.
  • overwrite - Whether to overwrite diverged changes.
  • stop_revision - The revision to stop pulling at.
  • local - Whether to only pull locally accessible revisions.
§Returns

Ok(()) on success, or an error if the pull could not be completed.

Source

fn merge_from_branch( &self, source: &dyn Branch, to_revision: Option<&RevisionId>, ) -> Result<(), Error>

Merge changes from another branch into this working tree.

§Parameters
  • source - The branch to merge from.
  • to_revision - The revision to merge up to.
§Returns

Ok(()) on success, or an error if the merge could not be completed.

Source

fn safe_relpath_files( &self, file_list: &[&Path], canonicalize: bool, apply_view: bool, ) -> Result<Vec<PathBuf>, Error>

Convert a list of files to relative paths safely.

This function takes a list of file paths and converts them to paths relative to the working tree, with various safety checks.

§Parameters
  • file_list - The list of file paths to convert.
  • canonicalize - Whether to canonicalize the paths first.
  • apply_view - Whether to apply the view (if any) to the paths.
§Returns

A list of converted paths, or an error if the conversion failed.

Source

fn add_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>

Add conflicts to the working tree.

Source

fn add_parent_tree( &self, parent_id: &RevisionId, parent_tree: &RevisionTree, ) -> Result<(), Error>

Add a parent tree.

Source

fn add_parent_tree_id(&self, parent_id: &RevisionId) -> Result<(), Error>

Add a parent tree ID.

Source

fn add_pending_merge(&self, revision_id: &RevisionId) -> Result<(), Error>

Add a pending merge.

Source

fn auto_resolve(&self) -> Result<(), Error>

Auto-resolve conflicts.

Source

fn check_state(&self) -> Result<(), Error>

Check the state of the working tree.

Source

fn get_canonical_path(&self, path: &Path) -> Result<PathBuf, Error>

Get the canonical path for a file.

Source

fn get_canonical_paths(&self, paths: &[&Path]) -> Result<Vec<PathBuf>, Error>

Get canonical paths for multiple files.

Source

fn get_config_stack(&self) -> Result<Py<PyAny>, Error>

Get the configuration stack.

Source

fn get_reference_info( &self, path: &Path, ) -> Result<Option<(String, PathBuf)>, Error>

Get reference information.

Source

fn get_shelf_manager(&self) -> Result<Py<PyAny>, Error>

Get the shelf manager.

Source

fn ignored_files(&self) -> Result<Vec<PathBuf>, Error>

Get ignored files.

Source

fn is_locked(&self) -> bool

Check if the working tree is locked.

Source

fn merge_modified(&self) -> Result<Vec<PathBuf>, Error>

Get merge-modified files.

Source

fn move_files(&self, from_paths: &[&Path], to_dir: &Path) -> Result<(), Error>

Move files within the working tree.

Source

fn set_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>

Set conflicts in the working tree.

Source

fn set_last_revision(&self, revision_id: &RevisionId) -> Result<(), Error>

Set the last revision.

Source

fn set_merge_modified(&self, files: &[&Path]) -> Result<(), Error>

Set merge-modified files.

Source

fn set_pending_merges(&self, revision_ids: &[RevisionId]) -> Result<(), Error>

Set pending merges.

Source

fn set_reference_info( &self, path: &Path, location: &str, file_id: Option<&str>, ) -> Result<(), Error>

Set reference information.

Source

fn subsume(&self, other: &(dyn PyWorkingTree + 'static)) -> Result<(), Error>

Subsume a tree into this working tree.

Source

fn store_uncommitted(&self) -> Result<String, Error>

Store uncommitted changes.

Source

fn restore_uncommitted(&self) -> Result<(), Error>

Restore uncommitted changes.

Source

fn extract(&self, dest: &Path, format: Option<&str>) -> Result<(), Error>

Extract the working tree to a directory.

Source

fn clone( &self, dest: &Path, revision_id: Option<&RevisionId>, ) -> Result<GenericWorkingTree, Error>

Clone the working tree.

Source

fn control_transport(&self) -> Result<Transport, Error>

Get a control transport.

Source

fn control_url(&self) -> Url

Get the control URL.

Source

fn copy_content_into( &self, source: &(dyn PyTree + 'static), revision_id: Option<&RevisionId>, ) -> Result<(), Error>

Copy content into this working tree.

Source

fn flush(&self) -> Result<(), Error>

Flush any pending changes.

Source

fn requires_rich_root(&self) -> bool

Check if the working tree requires a rich root.

Source

fn reset_state(&self, revision_ids: Option<&[RevisionId]>) -> Result<(), Error>

Reset the state of the working tree.

Source

fn reference_parent( &self, path: &Path, branch: &dyn Branch, revision_id: Option<&RevisionId>, ) -> Result<(), Error>

Reference a parent tree.

Source

fn supports_merge_modified(&self) -> bool

Check if the working tree supports merge-modified tracking.

Source

fn break_lock(&self) -> Result<(), Error>

Break the lock on the working tree.

Source

fn get_physical_lock_status(&self) -> Result<bool, Error>

Get the physical lock status.

Implementors§

Source§

impl<T> WorkingTree for T
where T: PyWorkingTree + ?Sized,