Skip to main content

GenericWorkingTree

Struct GenericWorkingTree 

Source
pub struct GenericWorkingTree(pub Py<PyAny>);
Expand description

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 struct wraps a Python working tree object and provides access to its functionality.

Tuple Fields§

§0: Py<PyAny>

Implementations§

Source§

impl GenericWorkingTree

Source

pub fn open(path: &Path) -> Result<GenericWorkingTree, Error>

👎Deprecated:

Use ::open instead

Open a working tree at the specified path.

This method is deprecated, use the module-level open function instead.

§Parameters
  • path - The path to the working tree.
§Returns

The working tree, or an error if it could not be opened.

Source

pub fn open_containing( path: &Path, ) -> Result<(GenericWorkingTree, PathBuf), Error>

👎Deprecated:

Use ::open_containing instead

Open a working tree containing the specified path.

This method is deprecated, use the module-level open_containing function instead.

§Parameters
  • path - The path to look for a containing working tree.
§Returns

A tuple containing the working tree and the relative path, or an error if no containing working tree could be found.

Source

pub fn commit( &self, message: &str, committer: Option<&str>, timestamp: Option<f64>, allow_pointless: Option<bool>, specific_files: Option<&[&Path]>, ) -> Result<RevisionId, Error>

👎Deprecated:

Use build_commit instead

Create a commit with the specified parameters.

This method is deprecated, use the build_commit method instead.

§Parameters
  • message - The commit message.
  • allow_pointless - Whether to allow commits that don’t change any files.
  • committer - The committer’s name and email.
  • specific_files - The paths of files to include in this commit.
§Returns

The revision ID of the new commit, or an error if the commit could not be created.

Trait Implementations§

Source§

impl Clone for GenericWorkingTree

Source§

fn clone(&self) -> Self

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 From<GenericWorkingTree> for CommitBuilder

Source§

fn from(wt: GenericWorkingTree) -> Self

Create a new CommitBuilder from a WorkingTree.

§Parameters
  • wt - The working tree to create commits in.
§Returns

A new CommitBuilder instance.

Source§

impl From<Py<PyAny>> for GenericWorkingTree

Implementation of From<Py> for GenericWorkingTree.

Source§

fn from(obj: Py<PyAny>) -> Self

Create a new WorkingTree from a Python object.

§Parameters
  • obj - The Python object representing a working tree.
§Returns

A new WorkingTree instance.

Source§

impl<'py> IntoPyObject<'py> for GenericWorkingTree

Source§

type Target = PyAny

The Python output type
Source§

type Output = Bound<'py, <GenericWorkingTree as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
Source§

type Error = Infallible

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

fn into_pyobject(self, py: Python<'py>) -> Result<Self::Output, Self::Error>

Performs the conversion.
Source§

impl MutableInventoryTree for GenericWorkingTree

Source§

fn add(&self, paths: &[&Path], file_ids: &[FileId]) -> Result<(), Error>

Add files to the tree with explicit file identifiers. Read more
Source§

impl PyTree for GenericWorkingTree

Source§

fn to_object(&self, py: Python<'_>) -> Py<PyAny>

Get the underlying Python object for this tree.
Source§

impl PyMutableTree for GenericWorkingTree

Source§

impl PyWorkingTree for GenericWorkingTree

Auto Trait Implementations§

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<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

Source§

fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>

Converts self into an owned Python object, dropping type information.
Source§

fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>

Converts self into an owned Python object, dropping type information and unbinding it from the 'py lifetime.
Source§

fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>

Converts self into a Python object. Read more
Source§

impl<T> MutableTree for T
where T: PyMutableTree + ?Sized,

Source§

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

Add specified files to version control.
Source§

fn lock_write(&self) -> Result<Lock, Error>

Lock the tree for write operations.
Source§

fn put_file_bytes_non_atomic( &self, path: &Path, data: &[u8], ) -> Result<(), Error>

Write bytes to a file in the tree without atomic guarantees.
Source§

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

Check if the tree has any uncommitted changes.
Source§

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

Create a directory in the tree.
Source§

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

Remove specified files from version control and from the filesystem.
Source§

fn add_reference(&self, reference: &TreeReference) -> Result<(), Error>

Add a tree reference.
Source§

fn copy_one(&self, from_path: &Path, to_path: &Path) -> Result<(), Error>

Copy a file or directory to a new location.
Source§

fn last_revision(&self) -> Result<RevisionId, Error>

Get the last revision ID.
Source§

fn lock_tree_write(&self) -> Result<Lock, Error>

Lock the tree for write operations.
Source§

fn set_parent_ids(&self, parent_ids: &[RevisionId]) -> Result<(), Error>

Set the parent IDs for this tree.
Source§

fn set_parent_trees( &self, parent_trees: &[(RevisionId, RevisionTree)], ) -> Result<(), Error>

Set the parent trees for this tree.
Source§

fn apply_inventory_delta(&self, delta: Vec<InventoryDelta>) -> Result<(), Error>

Apply a delta to the tree.
Source§

fn commit( &self, message: &str, committer: Option<&str>, timestamp: Option<f64>, allow_pointless: Option<bool>, specific_files: Option<&[&Path]>, ) -> Result<RevisionId, Error>

Commit changes in the tree.
Source§

impl<T> PyErrArguments for T
where T: for<'py> IntoPyObject<'py> + Send + Sync,

Source§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
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> Tree for T
where T: PyTree + ?Sized,

Source§

fn get_tag_dict(&self) -> Result<HashMap<String, RevisionId>, Error>

Get a dictionary of tags and their revision IDs.
Source§

fn get_file(&self, path: &Path) -> Result<Box<dyn Read>, Error>

Get a file from the tree as a readable stream.
Source§

fn get_file_text(&self, path: &Path) -> Result<Vec<u8>, Error>

Get the contents of a file from the tree as a byte vector.
Source§

fn get_file_lines(&self, path: &Path) -> Result<Vec<Vec<u8>>, Error>

Get the contents of a file as a vector of lines (byte vectors).
Source§

fn lock_read(&self) -> Result<Lock, Error>

Lock the tree for read operations.
Source§

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

Check if a file exists in the tree at the specified path.
Get the target of a symbolic link.
Source§

fn get_parent_ids(&self) -> Result<Vec<RevisionId>, Error>

Get the IDs of the parent revisions of this tree.
Source§

fn is_ignored(&self, path: &Path) -> Option<String>

Check if a path is ignored by version control.
Source§

fn kind(&self, path: &Path) -> Result<Kind, Error>

Get the kind of object at the specified path (file, directory, symlink, etc.).
Source§

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

Check if a path is under version control.
Source§

fn iter_changes( &self, other: &(dyn PyTree + 'static), specific_files: Option<&[&Path]>, want_unversioned: Option<bool>, require_versioned: Option<bool>, ) -> Result<Box<dyn Iterator<Item = Result<TreeChange, Error>>>, Error>

Iterate through the changes between this tree and another tree. Read more
Source§

fn has_versioned_directories(&self) -> bool

Check if this tree supports versioned directories.
Source§

fn preview_transform(&self) -> Result<TreeTransform, Error>

Get a preview of transformations that would be applied to this tree.
Source§

fn list_files( &self, include_root: Option<bool>, from_dir: Option<&Path>, recursive: Option<bool>, recurse_nested: Option<bool>, ) -> Result<Box<dyn Iterator<Item = Result<(PathBuf, bool, Kind, TreeEntry), Error>>>, Error>

List files in the tree, optionally recursively. Read more
Source§

fn iter_child_entries( &self, path: &Path, ) -> Result<Box<dyn Iterator<Item = Result<(PathBuf, Kind, TreeEntry), Error>>>, Error>

Iterate through entries in a directory. Read more
Source§

fn get_file_size(&self, path: &Path) -> Result<u64, Error>

Get the size of a file in bytes.
Source§

fn get_file_sha1( &self, path: &Path, _stat_value: Option<&Metadata>, ) -> Result<String, Error>

Get the SHA1 hash of a file’s contents.
Source§

fn get_file_mtime(&self, path: &Path) -> Result<u64, Error>

Get the modification time of a file.
Source§

fn is_executable(&self, path: &Path) -> Result<bool, Error>

Check if a file is executable.
Source§

fn stored_kind(&self, path: &Path) -> Result<Kind, Error>

Get the stored kind of a file (as opposed to the actual kind on disk).
Source§

fn supports_content_filtering(&self) -> bool

Check if the tree supports content filtering.
Source§

fn supports_file_ids(&self) -> bool

Check if the tree supports file IDs.
Source§

fn supports_rename_tracking(&self) -> bool

Check if the tree supports rename tracking.
Check if the tree supports symbolic links.
Source§

fn supports_tree_reference(&self) -> bool

Check if the tree supports tree references.
Source§

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

Get unversioned files in the tree.
Source§

fn all_versioned_paths( &self, ) -> Result<Box<dyn Iterator<Item = Result<PathBuf, Error>>>, Error>

Get all versioned paths in the tree.
Source§

fn conflicts(&self) -> Result<Vec<Conflict>, Error>

Get conflicts in the tree.
Source§

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

Get extra (unversioned) files in the tree.
Source§

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

Filter out versioned files from a list of paths.
Source§

fn walkdirs( &self, prefix: Option<&Path>, ) -> Result<Box<dyn Iterator<Item = Result<WalkdirResult, Error>>>, Error>

Walk directories in the tree.
Source§

fn versionable_kind(&self, kind: &Kind) -> bool

Check if a file kind is versionable.
Source§

fn path_content_summary(&self, path: &Path) -> Result<PathContentSummary, Error>

Get file content summary for a path.
Source§

fn iter_files_bytes( &self, paths: &[&Path], ) -> Result<Box<dyn Iterator<Item = Result<(PathBuf, Vec<u8>), Error>>>, Error>

Iterate through file bytes.
Source§

fn iter_entries_by_dir( &self, specific_files: Option<&[&Path]>, ) -> Result<Box<dyn Iterator<Item = Result<(PathBuf, TreeEntry), Error>>>, Error>

Iterate through entries by directory.
Source§

fn get_file_verifier( &self, path: &Path, _stat_value: Option<&Metadata>, ) -> Result<(String, Vec<u8>), Error>

Get file verifier information.
Source§

fn get_reference_revision(&self, path: &Path) -> Result<RevisionId, Error>

Get the reference revision for a tree reference.
Source§

fn archive( &self, format: &str, name: &str, root: Option<&str>, subdir: Option<&Path>, force_mtime: Option<f64>, recurse_nested: bool, ) -> Result<Box<dyn Iterator<Item = Result<Vec<u8>, Error>>>, Error>

Create an archive of the tree.
Source§

fn annotate_iter( &self, path: &Path, default_revision: Option<&RevisionId>, ) -> Result<Box<dyn Iterator<Item = Result<(RevisionId, Vec<u8>), Error>>>, Error>

Annotate a file with revision information.
Source§

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

Check if a path is a special path (e.g., control directory).
Source§

fn iter_search_rules( &self, paths: &[&Path], ) -> Result<Box<dyn Iterator<Item = Result<SearchRule, Error>>>, Error>

Iterate through search rules.
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.
Source§

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

Source§

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

Get a revision tree for a specific revision.

Source§

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

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

Source§

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

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

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.

Source§

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

Merge changes from another branch into this working tree.

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.

Source§

fn basedir(&self) -> PathBuf

Get the base directory path of this working tree. Read more
Source§

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

Get the control directory for this working tree. Read more
Source§

fn branch(&self) -> GenericBranch

Get the branch associated with this working tree. Read more
Source§

fn get_user_url(&self) -> Url

Get the user-visible URL for this working tree. Read more
Source§

fn supports_setting_file_ids(&self) -> bool

Check if this working tree supports setting the last revision. Read more
Source§

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

Add specified files to version control and the working tree. Read more
Source§

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

Update the working tree to a specific revision. Read more
Source§

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

Revert changes in the working tree. Read more
Source§

fn build_commit(&self) -> CommitBuilder

Create a commit builder for this working tree. Read more
Source§

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

Get the basis tree for this working tree. Read more
Source§

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

Check if a path is a control filename in this working tree. Read more
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.
Source§

impl<T> Ungil for T
where T: Send,