Part of bzrlib.tree View In Hierarchy
Known subclasses: bzrlib.revisiontree.InterCHKRevisionTree, bzrlib.tests.test_tree.RecordingOptimiser, bzrlib.workingtree_4.InterDirStateTree
Its instances have methods like 'compare' and contain references to the source and target trees these operations are to be carried out on.
Clients of bzrlib should not need to use InterTree directly, rather they should use the convenience methods on Tree such as 'Tree.compare()' which will pass through to InterTree as appropriate.
Class Method | is_compatible | Undocumented |
Method | compare | Return the changes from source to target. |
Method | iter_changes | Generate an iterator of changes between trees. |
Method | file_content_matches | Check if two files are the same in the source and target trees. |
Method | _changes_from_entries | Generate a iter_changes tuple between source_entry and target_entry. |
Method | _get_entry | Get an inventory entry from a tree, with missing entries as None. |
Method | _handle_precise_ids | Fill out a partial iter_changes to be consistent. |
Inherited from InterObject:
Method | __init__ | Construct a default InterObject instance. Please use 'get'. |
Class Method | get | Retrieve a Inter worker object for these objects. |
Method | lock_read | Take out a logical read lock. |
Method | lock_write | Take out a logical write lock. |
Class Method | register_optimiser | Register an InterObject optimiser. |
Method | unlock | Release the locks on source and target. |
Class Method | unregister_optimiser | Unregister an InterObject optimiser. |
Method | _double_lock | Take out two locks, rolling back the first if the second throws. |
Parameters | source_entry | An inventory entry from self.source, or None. |
target_entry | An inventory entry from self.target, or None. | |
source_path | The path of source_entry, if known. If not known it will be looked up. | |
target_path | The path of target_entry, if known. If not known it will be looked up. | |
Returns | A tuple, item 0 of which is an iter_changes result tuple, and item 1 is True if there are any changes in the result tuple. |
Parameters | specific_files | An optional list of file paths to restrict the comparison to. When mapping filenames to ids, all matches in all trees (including optional extra_trees) are used, and all children of matched directories are included. |
want_unchanged | An optional boolean requesting the inclusion of unchanged entries in the result. | |
extra_trees | An optional list of additional trees to use when mapping the contents of specific_files (paths) to file_ids. | |
require_versioned | An optional boolean (defaults to False). When supplied and True all the 'specific_files' must be versioned, or a PathsNotVersionedError will be thrown. | |
want_unversioned | Scan for unversioned paths. | |
Returns | A TreeDelta. |
Generate an iterator of changes between trees. A tuple is returned: (file_id, (path_in_source, path_in_target), changed_content, versioned, parent, name, kind, executable) Changed_content is True if the file's content has changed. This includes changes to its kind, and to a symlink's target. versioned, parent, name, kind, executable are tuples of (from, to). If a file is missing in a tree, its kind is None. Iteration is done in parent-to-child order, relative to the target tree. There is no guarantee that all paths are in sorted order: the requirement to expand the search due to renames may result in children that should be found early being found late in the search, after lexically later results have been returned. :param require_versioned: Raise errors.PathsNotVersionedError if a path in the specific_files list is not versioned in one of source, target or extra_trees. :param specific_files: An optional list of file paths to restrict the comparison to. When mapping filenames to ids, all matches in all trees (including optional extra_trees) are used, and all children of matched directories are included. The parents in the target tree of the specific files up to and including the root of the tree are always evaluated for changes too. :param want_unversioned: Should unversioned files be returned in the output. An unversioned file is defined as one with (False, False) for the versioned pair.
If the tree raises NotImplementedError on accessing .inventory, then this is worked around using iter_entries_by_dir on just the file id desired.
Parameters | tree | The tree to lookup the entry in. |
file_id | The file_id to lookup. |
Parameters | precise_file_ids | The file ids of parents that were seen during the iter_changes. |
changed_file_ids | The file ids of already emitted items. | |
discarded_changes | An optional dict of precalculated iter_changes items which the partial iter_changes had not output but had calculated. | |
Returns | A generator of iter_changes items to output. |
This only checks that the contents of the files are the same, it does not touch anything else.
Parameters | source_file_id | File id of the file in the source tree |
target_file_id | File id of the file in the target tree | |
source_path | Path of the file in the source tree | |
target_path | Path of the file in the target tree | |
source_stat | Optional stat value of the file in the source tree | |
target_stat | Optional stat value of the file in the target tree | |
Returns | Boolean indicating whether the files have the same contents |