~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/chk_serializer.py

  • Committer: Martin Pool
  • Date: 2010-07-21 09:58:42 UTC
  • mfrom: (4797.58.7 2.1)
  • mto: (5050.3.13 2.2)
  • mto: This revision was merged to the branch mainline in revision 5365.
  • Revision ID: mbp@canonical.com-20100721095842-hz0obu8gl0x05nty
merge up 2.1 to 2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
2
2
#
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
16
16
 
17
17
"""Serializer object for CHK based inventory storage."""
18
18
 
19
 
from cStringIO import (
20
 
    StringIO,
21
 
    )
22
 
 
23
19
from bzrlib import (
24
20
    bencode,
25
21
    cache_utf8,
26
22
    inventory,
27
 
    osutils,
28
23
    revision as _mod_revision,
29
 
    xml5,
30
24
    xml6,
 
25
    xml7,
31
26
    )
32
27
 
33
28
 
136
131
        return self.read_revision_from_string(f.read())
137
132
 
138
133
 
139
 
class CHKSerializerSubtree(BEncodeRevisionSerializer1, xml6.Serializer_v6):
 
134
class CHKSerializerSubtree(BEncodeRevisionSerializer1, xml7.Serializer_v7):
140
135
    """A CHKInventory based serializer that supports tree references"""
141
136
 
142
137
    supported_kinds = set(['file', 'directory', 'symlink', 'tree-reference'])
144
139
    revision_format_num = None
145
140
    support_altered_by_hack = False
146
141
 
147
 
    def _unpack_entry(self, elt):
 
142
    def _unpack_entry(self, elt, entry_cache=None, return_from_cache=False):
148
143
        kind = elt.tag
149
144
        if not kind in self.supported_kinds:
150
145
            raise AssertionError('unsupported entry kind %s' % kind)
157
152
            return inventory.TreeReference(file_id, name, parent_id, revision,
158
153
                                           reference_revision)
159
154
        else:
160
 
            return xml6.Serializer_v6._unpack_entry(self, elt)
 
155
            return xml7.Serializer_v7._unpack_entry(self, elt,
 
156
                entry_cache=entry_cache, return_from_cache=return_from_cache)
161
157
 
162
158
    def __init__(self, node_size, search_key_name):
163
159
        self.maximum_size = node_size
164
160
        self.search_key_name = search_key_name
165
161
 
166
162
 
167
 
class CHKSerializer(xml5.Serializer_v5):
 
163
class CHKSerializer(xml6.Serializer_v6):
168
164
    """A CHKInventory based serializer with 'plain' behaviour."""
169
165
 
170
166
    format_num = '9'