Part of bzrlib.inventory View In Hierarchy
By design, a CHKInventory is immutable so many of the methods supported by Inventory - add, rename, apply_delta, etc - are not supported. To create a new CHKInventory, use create_by_apply_delta() or from_inventory(), say.
Internally, a CHKInventory has one or two CHKMaps:
id_to_entry - a map from (file_id,) => InventoryEntry as bytes
=> file_id as bytes
The second map is optional and not present in early CHkRepository's.
No caching is performed: every method call or item access will perform requests to the storage layer. As such, keep references to objects you want to reuse.
Method | __init__ | Undocumented |
Method | __eq__ | Compare two sets by comparing their contents. |
Method | filter | Get an inventory view filtered against a set of file-ids. |
Method | create_by_apply_delta | Create a new CHKInventory by applying inventory_delta to this one. |
Class Method | deserialise | Deserialise a CHKInventory. |
Class Method | from_inventory | Create a CHKInventory from an existing inventory. |
Method | __getitem__ | map a single file_id -> InventoryEntry. |
Method | has_id | Undocumented |
Method | is_root | Undocumented |
Method | __iter__ | Iterate over all file-ids. |
Method | iter_just_entries | Iterate over all entries. |
Method | iter_changes | Generate a Tree.iter_changes change list between this and basis. |
Method | __len__ | Return the number of entries in the inventory. |
Method | path2id | See CommonInventory.path2id(). |
Method | to_lines | Serialise the inventory to lines. |
Method | root | Get the root entry. |
Method | _entry_to_bytes | Serialise entry as a single bytestring. |
Method | _expand_fileids_to_parents_and_children | Give a more wholistic view starting with the given file_ids. |
Static Method | _bytes_to_utf8name_key | Get the file_id, revision_id key out of bytes. |
Method | _bytes_to_entry | Deserialise a serialised entry. |
Method | _populate_from_dicts | Undocumented |
Method | _parent_id_basename_key | Create a key for a entry in a parent_id_basename_to_file_id index. |
Method | _getitems | Similar to __getitem__, but lets you query for multiple. |
Method | _iter_file_id_parents | Yield the parents of file_id up to the root. |
Method | _preload_cache | Make sure all file-ids are in _fileid_to_entry_cache |
Method | _make_delta | Make an inventory delta from two inventories. |
Inherited from CommonInventory:
Method | __contains__ | True if this entry contains a file with given id. |
Method | has_filename | Undocumented |
Method | id2path | Return as a string the path to file_id. |
Method | iter_entries | Return (path, entry) pairs, in order by name. |
Method | iter_entries_by_dir | Iterate over the entries in a directory first order. |
Method | make_entry | Simple thunk to bzrlib.inventory.make_entry. |
Method | entries | Return list of (path, ie) for all entries except the root. |
Method | directories | Return (path, entry) pairs for all directories, including the root. |
Method | get_idpath | Return a list of file_ids for the path to an entry. |
Serialise entry as a single bytestring. :param Entry: An inventory entry. :return: A bytestring for the entry. The BNF: ENTRY ::= FILE | DIR | SYMLINK | TREE FILE ::= "file: " COMMON SEP SHA SEP SIZE SEP EXECUTABLE DIR ::= "dir: " COMMON SYMLINK ::= "symlink: " COMMON SEP TARGET_UTF8 TREE ::= "tree: " COMMON REFERENCE_REVISION COMMON ::= FILE_ID SEP PARENT_ID SEP NAME_UTF8 SEP REVISION SEP ::= " "
Give a more wholistic view starting with the given file_ids. For any file_id which maps to a directory, we will include all children of that directory. We will also include all directories which are parents of the given file_ids, but we will not include their children. eg: / # TREE_ROOT foo/ # foo-id baz # baz-id frob/ # frob-id fringle # fringle-id bar/ # bar-id bing # bing-id if given [foo-id] we will include TREE_ROOT as interesting parents and foo-id, baz-id, frob-id, fringle-id As interesting ids.
Children of directories and parents are included.
The result may or may not reference the underlying inventory so it should be treated as immutable.
See the inventory developers documentation for the theory behind inventory deltas.
Parameters | inventory_delta | The inventory delta to apply. See Inventory.apply_delta for details. |
new_revision_id | The revision id of the resulting CHKInventory. | |
propagate_caches | If True, the caches for this inventory are copied to and updated for the result. | |
Returns | The new CHKInventory. |
Parameters | chk_store | A CHK capable VersionedFiles instance. |
bytes | The serialised bytes. | |
expected_revision_id | The revision ID we think this inventory is for. | |
Returns | A CHKInventory |
The content of inventory is copied into the chk_store, and a CHKInventory referencing that is returned.
Parameters | chk_store | A CHK capable VersionedFiles instance. |
inventory | The inventory to copy. | |
maximum_size | The CHKMap node size limit. | |
search_key_name | The identifier for the search key function |
The returned order is undefined. And currently if an item doesn't exist, it isn't included in the output.
Unlike iter_entries(), just the entries are returned (not (path, ie)) and the order of entries is undefined.
XXX: We may not want to merge this into bzr.dev.
Parameters | basis | Another CHKInventory. |
Returns | An iterator over the changes between self and basis, as per tree.iter_changes(). |