1
# Copyright (C) 2009, 2010 Canonical Ltd
1
# Copyright (C) 2005, 2006, 2009 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18
"""Inventory/revision serialization."""
19
from __future__ import absolute_import
21
from .. import registry
21
from bzrlib import registry
24
24
class Serializer(object):
50
50
raise NotImplementedError(self.write_inventory_to_string)
52
52
def read_inventory_from_string(self, string, revision_id=None,
53
entry_cache=None, return_from_cache=False):
54
54
"""Read string into an inventory object.
56
56
:param string: The serialized inventory to read.
64
64
:param entry_cache: An optional cache of InventoryEntry objects. If
65
65
supplied we will look up entries via (file_id, revision_id) which
66
66
should map to a valid InventoryEntry (File/Directory/etc) object.
67
:param return_from_cache: Return entries directly from the cache,
68
rather than copying them first. This is only safe if the caller
69
promises not to mutate the returned inventory entries, but it can
70
make some operations significantly faster.
72
68
raise NotImplementedError(self.read_inventory_from_string)
95
91
format_registry = SerializerRegistry()
96
format_registry.register_lazy('5', 'breezy.bzr.xml5', 'serializer_v5')
97
format_registry.register_lazy('6', 'breezy.bzr.xml6', 'serializer_v6')
98
format_registry.register_lazy('7', 'breezy.bzr.xml7', 'serializer_v7')
99
format_registry.register_lazy('8', 'breezy.bzr.xml8', 'serializer_v8')
100
format_registry.register_lazy('9', 'breezy.bzr.chk_serializer',
92
format_registry.register_lazy('4', 'bzrlib.xml4', 'serializer_v4')
93
format_registry.register_lazy('5', 'bzrlib.xml5', 'serializer_v5')
94
format_registry.register_lazy('6', 'bzrlib.xml6', 'serializer_v6')
95
format_registry.register_lazy('7', 'bzrlib.xml7', 'serializer_v7')
96
format_registry.register_lazy('8', 'bzrlib.xml8', 'serializer_v8')
97
format_registry.register_lazy('9', 'bzrlib.chk_serializer',
101
98
'chk_serializer_255_bigpage')
102
format_registry.register_lazy('10', 'breezy.bzr.chk_serializer',
99
format_registry.register_lazy('10', 'bzrlib.chk_serializer',
103
100
'chk_bencode_serializer')