1
# Copyright (C) 2008, 2009 Canonical Ltd
1
# Copyright (C) 2008, 2009, 2010 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
131
129
return self.read_revision_from_string(f.read())
134
class CHKSerializerSubtree(BEncodeRevisionSerializer1, xml7.Serializer_v7):
135
"""A CHKInventory based serializer that supports tree references"""
137
supported_kinds = set(['file', 'directory', 'symlink', 'tree-reference'])
139
revision_format_num = None
140
support_altered_by_hack = False
142
def _unpack_entry(self, elt, entry_cache=None, return_from_cache=False):
144
if not kind in self.supported_kinds:
145
raise AssertionError('unsupported entry kind %s' % kind)
146
if kind == 'tree-reference':
147
file_id = elt.attrib['file_id']
148
name = elt.attrib['name']
149
parent_id = elt.attrib['parent_id']
150
revision = elt.get('revision')
151
reference_revision = elt.get('reference_revision')
152
return inventory.TreeReference(file_id, name, parent_id, revision,
155
return xml7.Serializer_v7._unpack_entry(self, elt,
156
entry_cache=entry_cache, return_from_cache=return_from_cache)
158
def __init__(self, node_size, search_key_name):
159
self.maximum_size = node_size
160
self.search_key_name = search_key_name
163
class CHKSerializer(xml6.Serializer_v6):
132
class CHKSerializer(xml8.Serializer_v8):
164
133
"""A CHKInventory based serializer with 'plain' behaviour."""