1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
1
# Copyright (C) 2008 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
129
131
return self.read_revision_from_string(f.read())
132
class CHKSerializer(xml8.Serializer_v8):
134
class CHKSerializerSubtree(BEncodeRevisionSerializer1, xml6.Serializer_v6):
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):
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 xml6.Serializer_v6._unpack_entry(self, elt)
157
def __init__(self, node_size, search_key_name):
158
self.maximum_size = node_size
159
self.search_key_name = search_key_name
162
class CHKSerializer(xml5.Serializer_v5):
133
163
"""A CHKInventory based serializer with 'plain' behaviour."""