b.w.DirStateRevisionTree(InventoryTree) : class documentation

Part of bzrlib.workingtree_4 View In Hierarchy

A revision tree pulling the inventory from a dirstate.

Note that this is one of the historical (ie revision) trees cached in the dirstate for easy access, not the workingtree.

Method __init__ Undocumented
Method __repr__ Undocumented
Method annotate_iter See Tree.annotate_iter
Method filter_unversioned_files Filter out paths that are not versioned.
Method get_root_id Return the file_id for the root of this tree.
Method id2path Convert a file-id to a path.
Method iter_references Undocumented
Method get_file_mtime Return the modification time for this record.
Method get_file_sha1 Return the SHA1 file for a file.
Method get_file_revision Undocumented
Method get_file Return a file object for the file file_id in the tree.
Method get_file_size See Tree.get_file_size
Method get_file_text Return the byte content of a file.
Method get_reference_revision Undocumented
Method iter_files_bytes See Tree.iter_files_bytes.
Method get_symlink_target Get the target for a given file_id.
Method get_revision_id Return the revision id for this tree.
Method get_parent_ids The parents of a tree in the dirstate are not cached.
Method has_filename True if the tree has given filename.
Method kind Undocumented
Method stored_kind See Tree.stored_kind
Method path_content_summary See Tree.path_content_summary.
Method is_executable Check if a file is executable.
Method is_locked Undocumented
Method list_files List all files in this tree.
Method lock_read Lock the tree for a set of operations.
Method path2id Return the id for path in this tree.
Method unlock Unlock, freeing any cache memory used during the lock.
Method supports_tree_reference Undocumented
Method walkdirs Walk the contents of this tree from path down.
Method _comparison_data See Tree._comparison_data.
Method _file_size Undocumented
Method _get_parent_index Return the index in the dirstate referenced by this tree.
Method _get_entry Get the dirstate row for file_id or path.
Method _generate_inventory Create and set self.inventory from the dirstate object.
Method _get_inventory Undocumented
Method _must_be_locked Undocumented

Inherited from InventoryTree:

Method get_canonical_inventory_paths Like get_canonical_inventory_path() but works on multiple items.
Method get_canonical_inventory_path Returns the first inventory item that case-insensitively matches path.
Method has_id Undocumented
Method has_or_had_id Undocumented
Method all_file_ids Iterate through all file ids, including ids for missing files.
Method __iter__ Undocumented
Method iter_entries_by_dir Walk the tree in 'by_dir' order.
Method get_file_by_path Undocumented
Method _yield_canonical_inventory_paths Undocumented

Inherited from Tree (via InventoryTree):

Method has_versioned_directories Whether this tree can contain explicitly versioned directories.
Method changes_from Return a TreeDelta of the changes from other to this tree.
Method iter_changes See InterTree.iter_changes
Method conflicts Get a list of the conflicts in the tree.
Method extras For trees that can have unversioned files, return all such paths.
Method __contains__ Undocumented
Method is_ignored Check whether the filename is ignored by this tree.
Method get_file_with_stat Get a file handle and stat object for file_id.
Method get_file_lines Return the content of a file, as lines.
Method get_file_verifier Return a verifier for a file.
Method plan_file_merge Generate a merge plan based on annotations.
Method plan_file_lca_merge Generate a merge plan based lca-newness.
Method paths2ids Return all the ids that can be reached by walking from paths.
Method iter_children Undocumented
Method revision_tree Obtain a revision tree for the revision revision_id.
Method unknowns What files are present in this tree and unknown.
Method supports_content_filtering Undocumented
Method iter_search_rules Find the preferences for filenames in a tree.
Method _get_plan_merge_data Undocumented
Method _iter_parent_trees Iterate through parent trees, defaulting to Tree.revision_tree.
Method _get_file_revision Ensure that file_id, tree_revision is in vf to plan the merge.
Method _check_retrieved Undocumented
Method _content_filter_stack The stack of content filters for a path if filtering is supported.
Method _content_filter_stack_provider A function that returns a stack of ContentFilters.
Method _get_rules_searcher Get the RulesSearcher for this tree given the default one.
def __init__(self, dirstate, revision_id, repository):
Undocumented
def __repr__(self):
Undocumented
def annotate_iter(self, file_id, default_revision=_mod_revision.CURRENT_REVISION):
See Tree.annotate_iter
def _comparison_data(self, entry, path):
See Tree._comparison_data.
def _file_size(self, entry, stat_value):
Undocumented
def filter_unversioned_files(self, paths):
Filter out paths that are not versioned.
Returnsset of paths.
def get_root_id(self):
Return the file_id for the root of this tree.
def id2path(self, file_id):
Convert a file-id to a path.
def iter_references(self):
Undocumented
def _get_parent_index(self):
Return the index in the dirstate referenced by this tree.
def _get_entry(self, file_id=None, path=None):
Get the dirstate row for file_id or path.

If either file_id or path is supplied, it is used as the key to lookup. If both are supplied, the fastest lookup is used, and an error is raised if they do not both point at the same row.

Parametersfile_idAn optional unicode file_id to be looked up.
pathAn optional unicode path to be looked up.
ReturnsThe dirstate row tuple for path/file_id, or (None, None)
def _generate_inventory(self):
Create and set self.inventory from the dirstate object.

(So this is only called the first time the inventory is requested for this tree; it then remains in memory until it's out of date.)

This is relatively expensive: we have to walk the entire dirstate.

def get_file_mtime(self, file_id, path=None):
Return the modification time for this record.

We return the timestamp of the last-changed revision.

def get_file_sha1(self, file_id, path=None, stat_value=None):
Return the SHA1 file for a file.
Parametersfile_idThe handle for this file.
pathThe path that this file can be found at. These must point to the same object.
stat_valueOptional stat value for the object
Notecallers should use get_file_verifier instead where possible, as the underlying repository implementation may have quicker access to a non-sha1 verifier.
@needs_read_lock
def get_file_revision(self, file_id):
Undocumented
def get_file(self, file_id, path=None):
Return a file object for the file file_id in the tree.

If both file_id and path are defined, it is implementation defined as to which one is used.

def get_file_size(self, file_id):
See Tree.get_file_size
def get_file_text(self, file_id, path=None):
Return the byte content of a file.

If both file_id and path are supplied, an implementation may use either one.

Parametersfile_idThe file_id of the file.
pathThe path of the file.
ReturnsA single byte string for the whole file.
def get_reference_revision(self, file_id, path=None):
Undocumented
def iter_files_bytes(self, desired_files):
See Tree.iter_files_bytes.

This version is implemented on top of Repository.iter_files_bytes

def get_symlink_target(self, file_id, path=None):
Get the target for a given file_id.

It is assumed that the caller already knows that file_id is referencing a symlink. :param file_id: Handle for the symlink entry. :param path: The path of the file. If both file_id and path are supplied, an implementation may use either one. :return: The path the symlink points to.

def get_revision_id(self):
Return the revision id for this tree.
def _get_inventory(self):
Undocumented
def get_parent_ids(self):
The parents of a tree in the dirstate are not cached.
def has_filename(self, filename):
True if the tree has given filename.
def kind(self, file_id):
Undocumented
def stored_kind(self, file_id):
See Tree.stored_kind
def path_content_summary(self, path):
See Tree.path_content_summary.
def is_executable(self, file_id, path=None):
Check if a file is executable.
Parametersfile_idThe handle for this file.
pathThe path that this file can be found at. These must point to the same object.
def is_locked(self):
Undocumented
def list_files(self, include_root=False, from_dir=None, recursive=True):
List all files in this tree.
Parametersinclude_rootWhether to include the entry for the tree root
from_dirDirectory under which to list files
recursiveWhether to list files recursively
Returnsiterator over tuples of (path, versioned, kind, file_id, inventory entry)
def lock_read(self):
Lock the tree for a set of operations.
ReturnsA bzrlib.lock.LogicalLockResult.
def _must_be_locked(self):
Undocumented
@needs_read_lock
def path2id(self, path):
Return the id for path in this tree.
def unlock(self):
Unlock, freeing any cache memory used during the lock.
@needs_read_lock
def supports_tree_reference(self):
Undocumented
def walkdirs(self, prefix=''):
Walk the contents of this tree from path down.

This yields all the data about the contents of a directory at a time.
After each directory has been yielded, if the caller has mutated the
list to exclude some directories, they are then not descended into.

The data yielded is of the form:
((directory-relpath, directory-path-from-root, directory-fileid),
[(relpath, basename, kind, lstat, path_from_tree_root, file_id,
  versioned_kind), ...]),
 - directory-relpath is the containing dirs relpath from prefix
 - directory-path-from-root is the containing dirs path from /
 - directory-fileid is the id of the directory if it is versioned.
 - relpath is the relative path within the subtree being walked.
 - basename is the basename
 - kind is the kind of the file now. If unknonwn then the file is not
   present within the tree - but it may be recorded as versioned. See
   versioned_kind.
 - lstat is the stat data *if* the file was statted.
 - path_from_tree_root is the path from the root of the tree.
 - file_id is the file_id if the entry is versioned.
 - versioned_kind is the kind of the file as last recorded in the
   versioning system. If 'unknown' the file is not versioned.
One of 'kind' and 'versioned_kind' must not be 'unknown'.

:param prefix: Start walking from prefix within the tree rather than
at the root. This allows one to walk a subtree but get paths that are
relative to a tree rooted higher up.
:return: an iterator over the directory data.
API Documentation for Bazaar, generated by pydoctor at 2021-10-15 00:19:52.