Part of bzrlib.workingtree View In Hierarchy
Known subclasses: bzrlib.workingtree.InventoryWorkingTree
Instance Variables | basedir | The root of the tree on disk. This is a unicode path object (as opposed to a URL). |
Method | __init__ | Construct a WorkingTree instance. This is not a public API. |
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 | break_lock | Break a lock if one is present from another instance. |
Method | requires_rich_root | Undocumented |
Method | supports_tree_reference | 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 | all_file_ids | See Tree.iter_all_file_ids |
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 | get_parent_ids | See Tree.get_parent_ids. |
Method | get_root_id | Return the id of this trees root |
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_parent_ids | Set the parent ids to revision_ids. |
Method | set_pending_merges | Undocumented |
Method | set_merge_modified | Undocumented |
Method | merge_from_branch | Merge from a branch into this working tree. |
Method | merge_modified | Return a dictionary of files modified by a merge. |
Method | mkdir | See MutableTree.mkdir(). |
Method | get_symlink_target | Undocumented |
Method | subsume | Undocumented |
Method | extract | Extract a subtree from this tree. |
Method | flush | Write the in memory meta data to disk. |
Method | list_files | List all files as (path, class, kind, id, entry). |
Method | move | Rename files. |
Method | rename_one | Rename one file. |
Method | unknowns | Return all unknown files. |
Method | unversion | Remove the file ids in file_ids from the current versioned set. |
Method | pull | Undocumented |
Method | put_file_bytes_non_atomic | See MutableTree.put_file_bytes_non_atomic. |
Method | extras | Yield all unversioned files in this WorkingTree. |
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 | kind | Undocumented |
Method | stored_kind | See Tree.stored_kind |
Method | last_revision | Return the last revision of the branch for this tree. |
Method | is_locked | Undocumented |
Method | lock_read | Lock the tree for reading. |
Method | lock_tree_write | See MutableTree.lock_tree_write, and WorkingTree.unlock. |
Method | lock_write | See MutableTree.lock_write, and WorkingTree.unlock. |
Method | get_physical_lock_status | Undocumented |
Method | set_last_revision | Change the last revision in the working tree. |
Method | remove | Remove nominated files from the working tree metadata. |
Method | revert | Undocumented |
Method | revision_tree | See Tree.revision_tree. |
Method | set_root_id | Set the root id for this tree. |
Method | unlock | See Branch.unlock. |
Method | update | Update a working tree along its branch. |
Method | set_conflicts | Undocumented |
Method | add_conflicts | Undocumented |
Method | conflicts | Undocumented |
Method | walkdirs | Walk the directories of this tree. |
Method | auto_resolve | Automatically resolve text conflicts according to contents. |
Method | check_state | Check that the working state is/isn't valid. |
Method | reset_state | Reset the state of the working tree. |
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 | _gather_kinds | See MutableTree._gather_kinds. |
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 | _sha_from_stat | Get a sha digest from the tree's stat cache. |
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 | _kind | Undocumented |
Method | _flush_ignore_list_cache | Resets the cached ignore list to force a cache rebuild. |
Method | _comparison_data | Undocumented |
Method | _file_size | Undocumented |
Method | _last_revision | helper for get_parent_ids. |
Method | _must_be_locked | Undocumented |
Method | _reset_data | Reset transient data that cannot be revalidated. |
Method | _change_last_revision | Template method part of set_last_revision to perform the change. |
Method | _set_root_id | Set the root id for this tree, in a format specific manner. |
Method | _update_tree | Update a tree to the master branch. |
Method | _walkdirs | Walk the directories of this tree. |
Method | _validate | Validate internal structures. |
Method | _get_rules_searcher | See Tree._get_rules_searcher. |
Inherited from MutableTree:
Method | add | Add paths to the set of versioned paths. |
Method | add_reference | Add a TreeReference to the tree, pointing at sub_tree |
Method | apply_inventory_delta | Apply changes to the inventory as an atomic operation. |
Method | commit | Undocumented |
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 | set_parent_trees | Set the parents of the working tree. |
Method | smart_add | Version file_list, optionally recursing into directories. |
Method | _add_reference | Standard add_reference implementation, for use by subclasses |
Method | _add | Helper function for add - updates the inventory. |
Method | _observed_sha1 | Tell the tree we have observed a paths sha1. |
Parameters | branch | A branch to override probing for the branch. |
This is true IF and ONLY IF the filename is part of the meta data that bzr controls in this tree. I.E. a random .bzr directory placed on disk will not be a control file for this tree.
Parameters | filename | A filename within the tree. This is a relative path from the root of this tree. |
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.
This probes for a working tree at path and searches upwards from there.
Basically we keep looking up until we find the control directory or run into /. If there isn't one, raises NotBranchError. TODO: give this a new exception. If there is one, it is returned, along with the unused portion of path.
Returns | The WorkingTree that contains 'path', and the rest of path |
Fail if the paths given are not all in a single tree.
This is used for the many command-line interfaces that take a list of any number of files and that require they all be in the same tree.
Parameters | self | A tree to operate on. |
file_list | A list of user provided paths or None. | |
apply_view | if True and a view is set, apply it or check that specified files are within it | |
Returns | A list of relative paths. | |
Raises | errors.PathNotChild | When a provided path is in a different self than self. |
Only intended for advanced situations like upgrading part of a bzrdir.
If the left most parent is a ghost then the returned tree will be an empty tree - one obtained by calling repository.revision_tree(NULL_REVISION).
The path may be absolute or relative. If its a relative path it is interpreted relative to the python current working directory.
This implementation reads the pending merges list and last_revision value and uses that to decide what the parents list should be.
Duplicate this working tree into to_bzr, including all state.
Specifically modified files are kept as modified, but ignored and unknown files are discarded.
If you want to make a new line of development, see ControlDir.sprout()
This is equivalent to retrieving the current list of parent ids and setting the list to its value plus revision_id.
Parameters | revision_id | The revision id to add to the parent list. It may be a ghost revision as long as its not the first parent to be added, or the allow_leftmost_as_ghost parameter is set True. |
allow_leftmost_as_ghost | Allow the first parent to be a ghost. |
This is equivalent to retrieving the current list of parent trees and setting the list to its value plus parent_tuple. See also add_parent_tree_id - if you only have a parent id available it will be simpler to use that api. If you have the parent already available, using this api is preferred.
Parameters | parent_tuple | The (revision id, tree) to add to the parent list. If the revision_id is a ghost, pass None for the tree. |
allow_leftmost_as_ghost | Allow the first parent to be a ghost. |
This checks that the left hand-parent exists if there are any revisions present.
This will always return the first revision_id, and any merged revisions which are
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.
Parameters | revision_ids | The revision_ids to set as the parent ids of this working tree. Any of these may be ghosts. |
The default implementation assumes no stat cache is present.
Parameters | path | The path. |
stat_result | The stat result being looked up. |
Parameters | branch | The branch to merge from. |
to_revision | If non-None, the merge will merge to to_revision, but not beyond it. to_revision does not need to be in the history of the branch when it is supplied. If None, to_revision defaults to branch.last_revision(). |
The list is initialized by WorkingTree.set_merge_modified, which is typically called after we make some automatic updates to the tree because of a merge.
This returns a map of file_id->sha1, containing only files which are still in the working inventory and have that text hash.
A new branch will be created, relative to the path for this tree.
Lists, but does not descend into unversioned directories. This does not include files that have been deleted in this tree. Skips the control directory.
Parameters | include_root | if True, return an entry for the root |
from_dir | start from this directory or None for the root | |
recursive | whether to recurse into subdirectories or not |
to_dir must be known to the working tree.
If to_dir exists and is a directory, the files are moved into it, keeping their old names.
Note that to_dir is only the last component of the new name; this doesn't change the directory.
For each entry in from_paths the move mode will be determined independently.
The first mode moves the file in the filesystem and updates the working tree metadata. The second mode only updates the working tree metadata without touching the file on the filesystem.
move uses the second mode if 'after == True' and the target is not versioned but present in the working tree.
move uses the second mode if 'after == False' and the source is versioned but no longer in the working tree, and the target is not versioned but present in the working tree.
move uses the first mode if 'after == False' and the source is versioned and present in the working tree, and the target is not versioned and not present in the working tree.
Everything else results in an error.
This returns a list of (from_path, to_path) pairs for each entry that is moved.
This can change the directory or the filename or both.
rename_one has several 'modes' to work. First, it can rename a physical file and change the file_id. That is the normal mode. Second, it can only change the file_id without touching any physical file.
rename_one uses the second mode if 'after == True' and 'to_rel' is either not versioned or newly added, and present in the working tree.
rename_one uses the second mode if 'after == False' and 'from_rel' is versioned but no longer in the working tree, and 'to_rel' is not versioned but present in the working tree.
rename_one uses the first mode if 'after == False' and 'from_rel' is versioned and present in the working tree, and 'to_rel' is not versioned and not present in the working tree.
Everything else results in an error.
These are files in the working directory that are not versioned or control files or ignored.
When a file_id is unversioned, all of its children are automatically unversioned.
Parameters | file_ids | The file ids to stop versioning. |
Raises | NoSuchId if any fileid is not currently versioned. |
If there are any unversioned directories then only the directory is returned, not all its children. But if there are unversioned files under a versioned subdirectory, they are returned.
Currently returned depth-first, sorted by name within directories. This is the same order used by 'osutils.walkdirs'.
Cached in the Tree object after the first call.
Patterns containing '/' or '' need to match the whole path; others match against only the last component. Patterns starting with '!' are ignore exceptions. Exceptions take precedence over regular patterns and cause the filename to not be ignored.
If the file is ignored, returns the pattern which caused it to be ignored, otherwise None. So this can simply be used as a boolean if desired.
This format tree does not support a separate marker for last-revision compared to the branch.
See MutableTree.last_revision
This also locks the branch, and can be unlocked via self.unlock().
Returns | A bzrlib.lock.LogicalLockResult. |
Returns | A bzrlib.lock.LogicalLockResult. |
Returns | A bzrlib.lock.LogicalLockResult. |
This is used to allow WorkingTree3 instances to not affect branch when their last revision is set.
Unknown Field: files | File paths relative to the basedir. | |
Unknown Field: keep_files | If true, the files will also be kept. | |
Unknown Field: force | Delete files and directories, even if they are changed and even if the directories are not empty. |
WorkingTree can supply revision_trees for the basis revision only because there is only one cached inventory in the bzr directory.
Parameters | file_id | The file id to assign to the root. It must not be present in the current inventory or an error will occur. It must not be None, but rather a valid file id. |
WorkingTree locking just uses the Branch locking facilities. This is current because all working trees have an embedded branch within them. IF in the future, we were to make branch data shareable between multiple working trees, i.e. via shared storage, then we would probably want to lock both the local tree, and the branch.
Update a working tree along its branch.
This will update the branch if its bound too, which means we have multiple trees involved:
Pathologically, all three may be different, and non-ancestors of each other. Conceptually we want to:
There isn't a single operation at the moment to do that, so we:
Parameters | revision | The target revision to update to. Must be in the revision history. |
old_tip | If branch.update() has already been run, the value it returned (old tip of the branch or None). _marker is used otherwise. |
Parameters | old_tip | if supplied, the previous tip revision the branch, before it was changed to the master branch's tip. |
This API returns a generator, which is only valid during the current tree transaction - within a single lock_read or lock_write duration.
If the tree is not locked, it may cause an error to be raised, depending on the tree implementation.
Walk the directories of this tree. :param prefix: is used as the directrory to start with. :returns: a generator which yields items in the form:: ((curren_directory_path, fileid), [(file1_path, file1_name, file1_kind, None, file1_id, file1_kind), ... ])
Only text conflicts are auto_resolvable. Files with no conflict markers are considered 'resolved', because bzr always puts conflict markers into files that have text conflicts. The corresponding .THIS .BASE and .OTHER files are deleted, as per 'resolve'.
Returns | a tuple of ConflictLists: (un_resolved, resolved). |
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.
Returns | None. An exception should be raised if there is an error. |
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)