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§
Sourcefn basedir(&self) -> PathBuf
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.
Sourcefn controldir(
&self,
) -> Box<dyn ControlDir<Branch = GenericBranch, Repository = GenericRepository, WorkingTree = GenericWorkingTree>>
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.
Sourcefn branch(&self) -> GenericBranch
fn branch(&self) -> GenericBranch
Get the branch associated with this working tree.
§Returns
The branch that this working tree is tracking.
Sourcefn get_user_url(&self) -> Url
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.
Sourcefn supports_setting_file_ids(&self) -> bool
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.
Sourcefn build_commit(&self) -> CommitBuilder
fn build_commit(&self) -> CommitBuilder
Create a commit builder for this working tree.
§Returns
A new CommitBuilder instance for this working tree.
Sourcefn basis_tree(&self) -> Result<RevisionTree, Error>
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.
Sourcefn is_control_filename(&self, path: &Path) -> bool
fn is_control_filename(&self, path: &Path) -> bool
Sourcefn revision_tree(
&self,
revision_id: &RevisionId,
) -> Result<Box<RevisionTree>, Error>
fn revision_tree( &self, revision_id: &RevisionId, ) -> Result<Box<RevisionTree>, Error>
Sourcefn pull(
&self,
source: &dyn Branch,
overwrite: Option<bool>,
stop_revision: Option<&RevisionId>,
local: Option<bool>,
) -> Result<(), Error>
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.
Sourcefn merge_from_branch(
&self,
source: &dyn Branch,
to_revision: Option<&RevisionId>,
) -> Result<(), Error>
fn merge_from_branch( &self, source: &dyn Branch, to_revision: Option<&RevisionId>, ) -> Result<(), Error>
Sourcefn safe_relpath_files(
&self,
file_list: &[&Path],
canonicalize: bool,
apply_view: bool,
) -> Result<Vec<PathBuf>, Error>
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.
Sourcefn add_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>
fn add_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>
Add conflicts to the working tree.
Sourcefn add_parent_tree(
&self,
parent_id: &RevisionId,
parent_tree: &RevisionTree,
) -> Result<(), Error>
fn add_parent_tree( &self, parent_id: &RevisionId, parent_tree: &RevisionTree, ) -> Result<(), Error>
Add a parent tree.
Sourcefn add_parent_tree_id(&self, parent_id: &RevisionId) -> Result<(), Error>
fn add_parent_tree_id(&self, parent_id: &RevisionId) -> Result<(), Error>
Add a parent tree ID.
Sourcefn add_pending_merge(&self, revision_id: &RevisionId) -> Result<(), Error>
fn add_pending_merge(&self, revision_id: &RevisionId) -> Result<(), Error>
Add a pending merge.
Sourcefn auto_resolve(&self) -> Result<(), Error>
fn auto_resolve(&self) -> Result<(), Error>
Auto-resolve conflicts.
Sourcefn check_state(&self) -> Result<(), Error>
fn check_state(&self) -> Result<(), Error>
Check the state of the working tree.
Sourcefn get_canonical_path(&self, path: &Path) -> Result<PathBuf, Error>
fn get_canonical_path(&self, path: &Path) -> Result<PathBuf, Error>
Get the canonical path for a file.
Sourcefn get_canonical_paths(&self, paths: &[&Path]) -> Result<Vec<PathBuf>, Error>
fn get_canonical_paths(&self, paths: &[&Path]) -> Result<Vec<PathBuf>, Error>
Get canonical paths for multiple files.
Sourcefn get_reference_info(
&self,
path: &Path,
) -> Result<Option<(String, PathBuf)>, Error>
fn get_reference_info( &self, path: &Path, ) -> Result<Option<(String, PathBuf)>, Error>
Get reference information.
Sourcefn move_files(&self, from_paths: &[&Path], to_dir: &Path) -> Result<(), Error>
fn move_files(&self, from_paths: &[&Path], to_dir: &Path) -> Result<(), Error>
Move files within the working tree.
Sourcefn set_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>
fn set_conflicts(&self, conflicts: &[Conflict]) -> Result<(), Error>
Set conflicts in the working tree.
Sourcefn set_last_revision(&self, revision_id: &RevisionId) -> Result<(), Error>
fn set_last_revision(&self, revision_id: &RevisionId) -> Result<(), Error>
Set the last revision.
Sourcefn set_pending_merges(&self, revision_ids: &[RevisionId]) -> Result<(), Error>
fn set_pending_merges(&self, revision_ids: &[RevisionId]) -> Result<(), Error>
Set pending merges.
Sourcefn set_reference_info(
&self,
path: &Path,
location: &str,
file_id: Option<&str>,
) -> Result<(), Error>
fn set_reference_info( &self, path: &Path, location: &str, file_id: Option<&str>, ) -> Result<(), Error>
Set reference information.
Sourcefn subsume(&self, other: &(dyn PyWorkingTree + 'static)) -> Result<(), Error>
fn subsume(&self, other: &(dyn PyWorkingTree + 'static)) -> Result<(), Error>
Subsume a tree into this working tree.
Sourcefn store_uncommitted(&self) -> Result<String, Error>
fn store_uncommitted(&self) -> Result<String, Error>
Store uncommitted changes.
Sourcefn restore_uncommitted(&self) -> Result<(), Error>
fn restore_uncommitted(&self) -> Result<(), Error>
Restore uncommitted changes.
Sourcefn extract(&self, dest: &Path, format: Option<&str>) -> Result<(), Error>
fn extract(&self, dest: &Path, format: Option<&str>) -> Result<(), Error>
Extract the working tree to a directory.
Sourcefn clone(
&self,
dest: &Path,
revision_id: Option<&RevisionId>,
) -> Result<GenericWorkingTree, Error>
fn clone( &self, dest: &Path, revision_id: Option<&RevisionId>, ) -> Result<GenericWorkingTree, Error>
Clone the working tree.
Sourcefn control_transport(&self) -> Result<Transport, Error>
fn control_transport(&self) -> Result<Transport, Error>
Get a control transport.
Sourcefn control_url(&self) -> Url
fn control_url(&self) -> Url
Get the control URL.
Sourcefn copy_content_into(
&self,
source: &(dyn PyTree + 'static),
revision_id: Option<&RevisionId>,
) -> Result<(), Error>
fn copy_content_into( &self, source: &(dyn PyTree + 'static), revision_id: Option<&RevisionId>, ) -> Result<(), Error>
Copy content into this working tree.
Sourcefn requires_rich_root(&self) -> bool
fn requires_rich_root(&self) -> bool
Check if the working tree requires a rich root.
Sourcefn reset_state(&self, revision_ids: Option<&[RevisionId]>) -> Result<(), Error>
fn reset_state(&self, revision_ids: Option<&[RevisionId]>) -> Result<(), Error>
Reset the state of the working tree.
Sourcefn reference_parent(
&self,
path: &Path,
branch: &dyn Branch,
revision_id: Option<&RevisionId>,
) -> Result<(), Error>
fn reference_parent( &self, path: &Path, branch: &dyn Branch, revision_id: Option<&RevisionId>, ) -> Result<(), Error>
Reference a parent tree.
Sourcefn supports_merge_modified(&self) -> bool
fn supports_merge_modified(&self) -> bool
Check if the working tree supports merge-modified tracking.
Sourcefn break_lock(&self) -> Result<(), Error>
fn break_lock(&self) -> Result<(), Error>
Break the lock on the working tree.
Sourcefn get_physical_lock_status(&self) -> Result<bool, Error>
fn get_physical_lock_status(&self) -> Result<bool, Error>
Get the physical lock status.