b.s.Serializer(object) : class documentation

Part of bzrlib.serializer View In Hierarchy

Known subclasses: bzrlib.xml_serializer.XMLSerializer

Inventory and revision serialization/deserialization.
Method write_inventory Write inventory to a file.
Method write_inventory_to_string Produce a simple string representation of an inventory.
Method read_inventory_from_string Read 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
def write_inventory(self, inv, f):
Write inventory to a file.

Note: this is a whole inventory operation, and should only be used sparingly, as it does not scale well with large trees.

def write_inventory_to_string(self, inv):
Produce a simple string representation of an inventory.

Note: this is a whole inventory operation, and should only be used sparingly, as it does not scale well with large trees.

The requirement for the contents of the string is that it can be passed to read_inventory_from_string and the result is an identical inventory in memory.

(All serializers as of 2009-07-29 produce XML, but this is not mandated by the interface.)

def read_inventory_from_string(self, string, revision_id=None, entry_cache=None, return_from_cache=False):
Read string into an inventory object.
ParametersstringThe serialized inventory to read.
revision_idIf not-None, the expected revision id of the inventory. Some serialisers use this to set the results' root revision. This should be supplied for deserialising all from-repository inventories so that xml5 inventories that were serialised without a revision identifier can be given the right revision id (but not for working tree inventories where users can edit the data without triggering checksum errors or anything).
entry_cacheAn optional cache of InventoryEntry objects. If supplied we will look up entries via (file_id, revision_id) which should map to a valid InventoryEntry (File/Directory/etc) object.
return_from_cacheReturn entries directly from the cache, rather than copying them first. This is only safe if the caller promises not to mutate the returned inventory entries, but it can make some operations significantly faster.
def read_inventory(self, f, revision_id=None):
See read_inventory_from_string.
def write_revision(self, rev, f):
Undocumented
def write_revision_to_string(self, rev):
Undocumented
def read_revision(self, f):
Undocumented
def read_revision_from_string(self, xml_string):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.