~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/chk_serializer.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Canonical Ltd
 
1
# Copyright (C) 2008, 2009 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
21
21
    cache_utf8,
22
22
    inventory,
23
23
    revision as _mod_revision,
24
 
    xml5,
25
24
    xml6,
 
25
    xml7,
26
26
    )
27
27
 
28
28
 
131
131
        return self.read_revision_from_string(f.read())
132
132
 
133
133
 
134
 
class CHKSerializerSubtree(BEncodeRevisionSerializer1, xml6.Serializer_v6):
 
134
class CHKSerializerSubtree(BEncodeRevisionSerializer1, xml7.Serializer_v7):
135
135
    """A CHKInventory based serializer that supports tree references"""
136
136
 
137
137
    supported_kinds = set(['file', 'directory', 'symlink', 'tree-reference'])
139
139
    revision_format_num = None
140
140
    support_altered_by_hack = False
141
141
 
142
 
    def _unpack_entry(self, elt):
 
142
    def _unpack_entry(self, elt, entry_cache=None, return_from_cache=False):
143
143
        kind = elt.tag
144
144
        if not kind in self.supported_kinds:
145
145
            raise AssertionError('unsupported entry kind %s' % kind)
152
152
            return inventory.TreeReference(file_id, name, parent_id, revision,
153
153
                                           reference_revision)
154
154
        else:
155
 
            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)
156
157
 
157
158
    def __init__(self, node_size, search_key_name):
158
159
        self.maximum_size = node_size
159
160
        self.search_key_name = search_key_name
160
161
 
161
162
 
162
 
class CHKSerializer(xml5.Serializer_v5):
 
163
class CHKSerializer(xml6.Serializer_v6):
163
164
    """A CHKInventory based serializer with 'plain' behaviour."""
164
165
 
165
166
    format_num = '9'