b.t.MultiWalker(object) : class documentation

Part of bzrlib.tree View In Hierarchy

Walk multiple trees simultaneously, getting combined results.
Method __init__ Create a new MultiWalker.
Method iter_all Match up the values in the different trees.
Static Method _step_one Step an iter_entries_by_dir iterator.
Static Method _cmp_path_by_dirblock Compare two paths based on what directory they are in.
Static Method _path_to_key Undocumented
Method _lookup_by_file_id Lookup an inventory entry by file_id.
Method _walk_master_tree First pass, walk all trees in lock-step.
Method _finish_others Finish walking the other iterators, so we get all entries.
Method _walk_others Finish up by walking all the 'deferred' nodes.
def __init__(self, master_tree, other_trees):
Create a new MultiWalker.

All trees being walked must implement "iter_entries_by_dir()", such that they yield (path, object) tuples, where that object will have a '.file_id' member, that can be used to check equality.

Parametersmaster_treeAll trees will be 'slaved' to the master_tree such that nodes in master_tree will be used as 'first-pass' sync points. Any nodes that aren't in master_tree will be merged in a second pass.
other_treesA list of other trees to walk simultaneously.
@staticmethod
def _step_one(iterator):
Step an iter_entries_by_dir iterator.
Returns(has_more, path, ie) If has_more is False, path and ie will be None.
@staticmethod
def _cmp_path_by_dirblock(path1, path2):
Compare two paths based on what directory they are in.

This generates a sort order, such that all children of a directory are sorted together, and grandchildren are in the same order as the children appear. But all grandchildren come after all children.

Parameterspath1first path
path2the second path
Returnsnegative number if path1 comes first, 0 if paths are equal and a positive number if path2 sorts first
@staticmethod
def _path_to_key(path):
Undocumented
def _lookup_by_file_id(self, extra_entries, other_tree, file_id):
Lookup an inventory entry by file_id.

This is called when an entry is missing in the normal order. Generally this is because a file was either renamed, or it was deleted/added. If the entry was found in the inventory and not in extra_entries, it will be added to self._out_of_order_processed

Parametersextra_entriesA dictionary of {file_id: (path, ie)}. This should be filled with entries that were found before they were used. If file_id is present, it will be removed from the dictionary.
other_treeThe Tree to search, in case we didn't find the entry yet.
file_idThe file_id to look for
Returns(path, ie) if found or (None, None) if not present.
def iter_all(self):
Match up the values in the different trees.
def _walk_master_tree(self):
First pass, walk all trees in lock-step.

When we are done, all nodes in the master_tree will have been processed. _other_walkers, _other_entries, and _others_extra will be set on 'self' for future processing.

def _finish_others(self):
Finish walking the other iterators, so we get all entries.
def _walk_others(self):
Finish up by walking all the 'deferred' nodes.
API Documentation for Bazaar, generated by pydoctor at 2019-08-22 00:28:44.