b.w.DirStateWorkingTree(InventoryWorkingTree) : class documentation

Part of bzrlib.workingtree_4 View In Hierarchy

Known subclasses: bzrlib.workingtree_4.ContentFilteringDirStateWorkingTree, bzrlib.workingtree_4.WorkingTree4

No class docstring
Method __init__ Construct a WorkingTree for basedir.
Method add_reference Add a TreeReference to the tree, pointing at sub_tree
Method break_lock Break a lock if one is present from another instance.
Method commit Undocumented
Method current_dirstate Return the current dirstate object.
Method filter_unversioned_files Filter out paths that are versioned.
Method flush Write all cached data to disk.
Method get_file_sha1 Undocumented
Method get_parent_ids See Tree.get_parent_ids.
Method get_reference_revision Undocumented
Method get_nested_tree Undocumented
Method get_root_id Return the id of this trees root
Method has_id Undocumented
Method has_or_had_id Undocumented
Method id2path Convert a file-id to a path.
Method is_executable 0 Test if a file is executable or not.
Method is_executable Test if a file is executable or not.
Method all_file_ids See Tree.iter_all_file_ids
Method __iter__ Iterate through file_ids for this tree.
Method iter_references Undocumented
Method kind Return the kind of a file.
Method lock_read See Branch.lock_read, and WorkingTree.unlock.
Method lock_tree_write See MutableTree.lock_tree_write, and WorkingTree.unlock.
Method lock_write See MutableTree.lock_write, and WorkingTree.unlock.
Method move See WorkingTree.move().
Method path2id Return the id for path in this tree.
Method paths2ids See Tree.paths2ids().
Method read_working_inventory Read the working inventory.
Method revision_tree See Tree.revision_tree.
Method set_last_revision Change the last revision in the working tree.
Method set_parent_ids Set the parent ids to revision_ids.
Method set_parent_trees Set the parents of the working tree.
Method supports_tree_reference Undocumented
Method unlock Unlock in format 4 trees needs to write the entire dirstate.
Method unversion Remove the file ids in file_ids from the current versioned set.
Method rename_one See WorkingTree.rename_one
Method apply_inventory_delta See MutableTree.apply_inventory_delta
Method update_basis_by_delta See MutableTree.update_basis_by_delta.
Method reset_state Reset the state of the working tree.
Method _add See MutableTree._add.
Method _get_check_refs Return the references needed to perform a check of this tree.
Method _make_dirty Make the tree state dirty.
Method _comparison_data Undocumented
Method _current_dirstate Internal function that does not check lock status.
Method _sha1_provider A function that returns a SHA1Provider suitable for this tree.
Method _worth_saving_limit How many hash changes are ok before we must save the dirstate.
Method _gather_kinds See MutableTree._gather_kinds.
Method _generate_inventory Create and set self.inventory from the dirstate object.
Method _get_entry Get the dirstate row for file_id or path.
Method _get_inventory Get the inventory for the tree. This is only valid within a lock.
Method _is_executable_from_path_and_stat_from_basis Undocumented
Method _observed_sha1 See MutableTree._observed_sha1.
Method _kind Undocumented
Method _last_revision See Mutable.last_revision.
Method _lock_self_write This should be called after the branch is locked.
Method _must_be_locked Undocumented
Method _new_tree Initialize the state in this tree to be a new tree.
Method _paths2ids_in_memory Undocumented
Method _paths2ids_using_bisect Undocumented
Method _set_root_id See WorkingTree.set_root_id.
Method _sha_from_stat Get a sha digest from the tree's stat cache.
Method _validate Validate internal structures.
Method _write_inventory Write inventory as the current inventory.

Inherited from InventoryWorkingTree:

Method set_inventory Undocumented
Method set_conflicts Undocumented
Method add_conflicts Undocumented
Method conflicts Undocumented
Method read_basis_inventory Read the cached basis inventory.
Method check_state Check that the working state is/isn't valid.
Method get_file_mtime See Tree.get_file_mtime.
Method annotate_iter See Tree.annotate_iter
Method merge_modified Return a dictionary of files modified by a merge.
Method subsume Undocumented
Method extract Extract a subtree from this tree.
Method list_files List all files as (path, class, kind, id, entry).
Method stored_kind See Tree.stored_kind
Method extras Yield all unversioned files in this WorkingTree.
Method _set_inventory Set the internal cached inventory.
Method _detect_case_handling Undocumented
Method _serialize Undocumented
Method _deserialize Undocumented
Method _write_basis_inventory Write the basis inventory XML to the basis-inventory file
Method _reset_data Reset transient data that cannot be revalidated.
Method _cache_basis_inventory Cache new_revision as the basis inventory.
Method _basis_inventory_name Undocumented
Method _create_basis_xml_from_inventory Create the text that will be saved in basis-inventory
Method _check Check the tree for consistency.
Method _is_executable_from_path_and_stat_from_stat Undocumented
Class _RenameEntry Undocumented
Method _determine_mv_mode Determines for each from-to pair if both inventory and working tree
Method _move Moves a list of files.
Method _rollback_move Try to rollback a previous move in case of an filesystem error.
Method _move_entry Undocumented
Method _walkdirs Walk the directories of this tree.

Inherited from WorkingTree (via InventoryWorkingTree):

Method user_transport Undocumented
Method control_transport Undocumented
Method is_control_filename True if filename is the name of a control file in this tree.
Method has_versioned_directories See Tree.has_versioned_directories.
Method requires_rich_root Undocumented
Method supports_content_filtering Undocumented
Method supports_views Undocumented
Static Method open Open an existing working tree at path.
Static Method open_containing Open an existing working tree which has its root about path.
Static Method open_containing_paths Open the WorkingTree that contains a set of paths.
Method safe_relpath_files Convert file_list into a list of relpaths in tree.
Static Method open_downlevel Open an unsupported working tree.
Static Method find_trees Undocumented
Method __repr__ Undocumented
Method abspath Undocumented
Method basis_tree Return RevisionTree for the current last revision.
Method relpath Return the local path portion from a given path.
Method has_filename Undocumented
Method get_file Undocumented
Method get_file_with_stat See Tree.get_file_with_stat.
Method get_file_text Undocumented
Method get_file_byname Undocumented
Method get_file_lines See Tree.get_file_lines()
Method clone Duplicate this working tree into to_bzr, including all state.
Method copy_content_into Copy the current content and user files of this tree into tree.
Method id2abspath Undocumented
Method iter_entries_by_dir See Tree.iter_entries_by_dir()
Method get_file_size See Tree.get_file_size
Method add_parent_tree_id Add revision_id as a parent.
Method add_parent_tree Add revision_id, tree tuple as a parent.
Method add_pending_merge Undocumented
Method path_content_summary See Tree.path_content_summary.
Method set_pending_merges Undocumented
Method set_merge_modified Undocumented
Method merge_from_branch Merge from a branch into this working tree.
Method mkdir See MutableTree.mkdir().
Method get_symlink_target Undocumented
Method unknowns Return all unknown files.
Method pull Undocumented
Method put_file_bytes_non_atomic See MutableTree.put_file_bytes_non_atomic.
Method ignored_files Yield list of PATH, IGNORE_PATTERN
Method get_ignore_list Return list of ignore patterns.
Method is_ignored Check whether the filename matches an ignore pattern.
Method last_revision Return the last revision of the branch for this tree.
Method is_locked Undocumented
Method get_physical_lock_status Undocumented
Method remove Remove nominated files from the working tree metadata.
Method revert Undocumented
Method set_root_id Set the root id for this tree.
Method update Update a working tree along its branch.
Method walkdirs Walk the directories of this tree.
Method auto_resolve Automatically resolve text conflicts according to contents.
Method get_shelf_manager Return the ShelfManager for this WorkingTree.
Method _make_views Undocumented
Method _cleanup Undocumented
Method _check_for_tree_references See if directories have become tree-references.
Method _file_content_summary Undocumented
Method _check_parents_for_ghosts Common ghost checking functionality from set_parent_*.
Method _set_merges_from_parent_ids Undocumented
Method _filter_parent_ids_by_ancestry Check that all merged revisions are proper 'heads'.
Method _put_rio Undocumented
Method _setup_directory_is_tree_reference Undocumented
Method _directory_is_never_tree_reference Undocumented
Method _directory_may_be_tree_reference Undocumented
Method _flush_ignore_list_cache Resets the cached ignore list to force a cache rebuild.
Method _file_size Undocumented
Method _change_last_revision Template method part of set_last_revision to perform the change.
Method _update_tree Update a tree to the master branch.
Method _get_rules_searcher See Tree._get_rules_searcher.

Inherited from MutableTree (via InventoryWorkingTree, WorkingTree):

Method add Add paths to the set of versioned paths.
Method has_changes Quickly check that the tree contains at least one commitable change.
Method check_changed_or_out_of_date Check the tree for uncommitted changes and branch synchronization.
Method smart_add Version file_list, optionally recursing into directories.
Method _add_reference Standard add_reference implementation, for use by subclasses

Inherited from MutableInventoryTree (via InventoryWorkingTree):

Method smart_add Version file_list, optionally recursing into directories.
Method _fix_case_of_inventory_path If our tree isn't case sensitive, return the canonical path

Inherited from MutableTree (via InventoryWorkingTree, MutableInventoryTree):

Method is_control_filename True if filename is the name of a control file in this tree.
Method add Add paths to the set of versioned paths.
Method has_changes Quickly check that the tree contains at least one commitable change.
Method check_changed_or_out_of_date Check the tree for uncommitted changes and branch synchronization.
Method last_revision Return the revision id of the last commit performed in this tree.
Method mkdir Create a directory in the tree. if file_id is None, one is assigned.
Method put_file_bytes_non_atomic Update the content of a file in the tree.
Method _add_reference Standard add_reference implementation, for use by subclasses
def __init__(self, basedir, branch, _control_files=None, _format=None, _bzrdir=None):
Construct a WorkingTree for basedir.

If the branch is not supplied, it is opened automatically. If the branch is supplied, it must be the branch for this basedir. (branch.base is not cross checked, because for remote branches that would be meaningless).

@needs_tree_write_lock
def _add(self, files, ids, kinds):
See MutableTree._add.
def _get_check_refs(self):
Return the references needed to perform a check of this tree.
def _make_dirty(self, reset_inventory):
Make the tree state dirty.
Parametersreset_inventoryTrue if the cached inventory should be removed (presuming there is one).
@needs_tree_write_lock
def add_reference(self, sub_tree):
Add a TreeReference to the tree, pointing at sub_tree
def break_lock(self):
Break a lock if one is present from another instance.

Uses the ui factory to ask for confirmation if the lock may be from an active process.

This will probe the repository for its lock as well.

def _comparison_data(self, entry, path):
Undocumented
@needs_write_lock
def commit(self, *args, message=None, revprops=None, **kwargs):
Undocumented
def current_dirstate(self):
Return the current dirstate object.

This is not part of the tree interface and only exposed for ease of testing.

Raiseserrors.NotWriteLockedwhen not in a lock.
def _current_dirstate(self):
Internal function that does not check lock status.

This is needed for break_lock which also needs the dirstate.

def _sha1_provider(self):
A function that returns a SHA1Provider suitable for this tree.
ReturnsNone if content filtering is not supported by this tree. Otherwise, a SHA1Provider is returned that sha's the canonical form of files, i.e. after read filters are applied.
def _worth_saving_limit(self):
How many hash changes are ok before we must save the dirstate.
Returnsan integer. -1 means never save.
def filter_unversioned_files(self, paths):
Filter out paths that are versioned.
Returnsset of paths.
def flush(self):
Write all cached data to disk.
@needs_tree_write_lock
def _gather_kinds(self, files, kinds):
See MutableTree._gather_kinds.
def _generate_inventory(self):
Create and set self.inventory from the dirstate object.

This is relatively expensive: we have to walk the entire dirstate. Ideally we would not, and can deprecate this function.

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 get_file_sha1(self, file_id, path=None, stat_value=None):
Undocumented
def _get_inventory(self):
Get the inventory for the tree. This is only valid within a lock.
@needs_read_lock
def get_parent_ids(self):
See Tree.get_parent_ids.

This implementation requests the ids list from the dirstate file.

def get_reference_revision(self, file_id, path=None):
Undocumented
def get_nested_tree(self, file_id, path=None):
Undocumented
@needs_read_lock
def get_root_id(self):
Return the id of this trees root
def has_id(self, file_id):
Undocumented
def has_or_had_id(self, file_id):
Undocumented
@needs_read_lock
def id2path(self, file_id):
Convert a file-id to a path.
def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
Undocumented
def is_executable 0(self, file_id, path=None):
Test if a file is executable or not.

Note: The caller is expected to take a read-lock before calling this.

def is_executable(self, file_id, path=None):
Test if a file is executable or not.

Note: The caller is expected to take a read-lock before calling this.

def all_file_ids(self):
See Tree.iter_all_file_ids
@needs_read_lock
def __iter__(self):
Iterate through file_ids for this tree.

file_ids are in a WorkingTree if they are in the working inventory and the working file exists.

def iter_references(self):
Undocumented
def _observed_sha1(self, file_id, path, (sha1, statvalue)):
See MutableTree._observed_sha1.
def kind(self, file_id):
Return the kind of a file.

This is always the actual kind that's on disk, regardless of what it was added as.

Note: The caller is expected to take a read-lock before calling this.

def _kind(self, relpath):
Undocumented
@needs_read_lock
def _last_revision(self):
See Mutable.last_revision.
def lock_read(self):
See Branch.lock_read, and WorkingTree.unlock.
ReturnsA bzrlib.lock.LogicalLockResult.
def _lock_self_write(self):
This should be called after the branch is locked.
def lock_tree_write(self):
See MutableTree.lock_tree_write, and WorkingTree.unlock.
ReturnsA bzrlib.lock.LogicalLockResult.
def lock_write(self):
See MutableTree.lock_write, and WorkingTree.unlock.
ReturnsA bzrlib.lock.LogicalLockResult.
@needs_tree_write_lock
def move(self, from_paths, to_dir, after=False):
See WorkingTree.move().
def _must_be_locked(self):
Undocumented
def _new_tree(self):
Initialize the state in this tree to be a new tree.
@needs_read_lock
def path2id(self, path):
Return the id for path in this tree.
def paths2ids(self, paths, trees=, require_versioned=True):
See Tree.paths2ids().

This specialisation fast-paths the case where all the trees are in the dirstate.

def _paths2ids_in_memory(self, paths, search_indexes, require_versioned=True):
Undocumented
def _paths2ids_using_bisect(self, paths, search_indexes, require_versioned=True):
Undocumented
def read_working_inventory(self):
Read the working inventory.

This is a meaningless operation for dirstate, but we obey it anyhow.

@needs_read_lock
def revision_tree(self, revision_id):
See Tree.revision_tree.

WorkingTree4 supplies revision_trees for any basis tree.

@needs_tree_write_lock
def set_last_revision(self, new_revision):
Change the last revision in the working tree.
@needs_tree_write_lock
def set_parent_ids(self, revision_ids, allow_leftmost_as_ghost=False):
Set the parent ids to revision_ids.

See also set_parent_trees. This api will try to retrieve the tree data for each element of revision_ids from the trees repository. If you have tree data already available, it is more efficient to use set_parent_trees rather than set_parent_ids. set_parent_ids is however an easier API to use.

Parametersrevision_idsThe revision_ids to set as the parent ids of this working tree. Any of these may be ghosts.
@needs_tree_write_lock
def set_parent_trees(self, parents_list, allow_leftmost_as_ghost=False):
Set the parents of the working tree.
Parametersparents_listA list of (revision_id, tree) tuples. If tree is None, then that element is treated as an unreachable parent tree - i.e. a ghost.
def _set_root_id(self, file_id):
See WorkingTree.set_root_id.
def _sha_from_stat(self, path, stat_result):
Get a sha digest from the tree's stat cache.

The default implementation assumes no stat cache is present.

ParameterspathThe path.
stat_resultThe stat result being looked up.
@needs_read_lock
def supports_tree_reference(self):
Undocumented
def unlock(self):
Unlock in format 4 trees needs to write the entire dirstate.
@needs_tree_write_lock
def unversion(self, file_ids):
Remove the file ids in file_ids from the current versioned set.

When a file_id is unversioned, all of its children are automatically unversioned.

Parametersfile_idsThe file ids to stop versioning.
RaisesNoSuchId if any fileid is not currently versioned.
@needs_tree_write_lock
def rename_one(self, from_rel, to_rel, after=False):
See WorkingTree.rename_one
@needs_tree_write_lock
def apply_inventory_delta(self, changes):
See MutableTree.apply_inventory_delta
def update_basis_by_delta(self, new_revid, delta):
See MutableTree.update_basis_by_delta.
@needs_read_lock
def _validate(self):
Validate internal structures.

This is meant mostly for the test suite. To give it a chance to detect corruption after actions have occurred. The default implementation is a just a no-op.

ReturnsNone. An exception should be raised if there is an error.
@needs_tree_write_lock
def _write_inventory(self, inv):
Write inventory as the current inventory.
@needs_tree_write_lock
def reset_state(self, revision_ids=None):
Reset the state of the working tree.

This does a hard-reset to a last-known-good state. This is a way to fix if something got corrupted (like the .bzr/checkout/dirstate file)

API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.