Part of bzrlib.xml8 View In Hierarchy
Known subclasses: bzrlib.chk_serializer.CHKSerializer, bzrlib.xml6.Serializer_v6
Its revision format number matches its inventory number.
Method | write_inventory_to_lines | Return a list of lines with the encoded inventory. |
Method | write_inventory_to_string | Just call write_inventory with a StringIO and return the value. |
Method | write_inventory | Write inventory to a file. |
Method | _check_revisions | Extension point for subclasses to check during serialisation. |
Method | _check_cache_size | Check that the entry_cache is large enough. |
Method | _append_inventory_root | Append the inventory root to output. |
Method | _pack_revision | Revision object -> xml tree |
Method | _pack_revision_properties | Undocumented |
Method | _unpack_inventory | Construct from XML Element |
Method | _unpack_entry | Undocumented |
Method | _unpack_revision | XML Element -> Revision object |
Method | _unpack_revision_properties | Unpack properties onto a revision. |
Method | _find_text_key_references | Core routine for extracting references to texts from inventories. |
Inherited from XMLSerializer:
Method | read_inventory_from_string | Read xml_string into an inventory object. |
Method | read_inventory | See read_inventory_from_string. |
Method | write_revision | Undocumented |
Method | write_revision_to_string | Undocumented |
Method | read_revision | Undocumented |
Method | read_revision_from_string | Undocumented |
Method | _write_element | Undocumented |
Method | _read_element | Undocumented |
Parameters | inv | An inventory about to be serialised, to be checked. |
Raises | AssertionError if an error has occurred. |
We want the cache to be ~2x the size of an inventory. The reason is because we use a FIFO cache, and how Inventory records are likely to change. In general, you have a small number of records which change often, and a lot of records which do not change at all. So when the cache gets full, you actually flush out a lot of the records you are interested in, which means you need to recreate all of those records. An LRU Cache would be better, but the overhead negates the cache coherency benefit.
One way to look at it, only the size of the cache > len(inv) is your 'working' set. And in general, it shouldn't be a problem to hold 2 inventories in memory anyway.
Parameters | inv_size | The number of entries in an inventory. |
Parameters | working | If True skip history data - text_sha1, text_size, reference_revision, symlink_target. |
Parameters | inv | the inventory to write. |
f | the file to write. (May be None if the lines are the desired output). | |
working | If True skip history data - text_sha1, text_size, reference_revision, symlink_target. | |
Returns | The inventory as a list of lines. |
This performs the translation of xml lines to revision ids.
Parameters | line_iterator | An iterator of lines, origin_version_id |
Returns | A dictionary mapping text keys ((fileid, revision_id) tuples) to whether they were referred to by the inventory of the revision_id that they contain. Note that if that revision_id was not part of the line_iterator's output then False will be given - even though it may actually refer to that key. |