~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: John Arbash Meinel
  • Date: 2009-11-07 00:28:26 UTC
  • mto: This revision was merged to the branch mainline in revision 4842.
  • Revision ID: john@arbash-meinel.com-20091107002826-umvwb3zl0yajo6rc
Use StaticTuple as part of the builder process.

Also use it in the pure python btree parser, mostly for consistency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    index,
32
32
    lru_cache,
33
33
    osutils,
 
34
    static_tuple,
34
35
    trace,
35
36
    )
36
37
from bzrlib.index import _OPTION_NODE_REFS, _OPTION_KEY_ELEMENTS, _OPTION_LEN
163
164
        node_refs, _ = self._check_key_ref_value(key, references, value)
164
165
        if key in self._nodes:
165
166
            raise errors.BadIndexDuplicateKey(key, self)
166
 
        # TODO: StaticTuple
167
 
        self._nodes[key] = (node_refs, value)
 
167
        self._nodes[key] = static_tuple.StaticTuple(node_refs, value)
168
168
        self._keys.add(key)
169
169
        if self._nodes_by_key is not None and self._key_length > 1:
170
170
            self._update_nodes_by_key(key, value, node_refs)
624
624
    def _parse_lines(self, lines):
625
625
        nodes = []
626
626
        self.offset = int(lines[1][7:])
 
627
        as_st = static_tuple.StaticTuple.from_sequence
627
628
        for line in lines[2:]:
628
629
            if line == '':
629
630
                break
630
 
            # TODO: Switch to StaticTuple here.
631
 
            nodes.append(tuple(map(intern, line.split('\0'))))
 
631
            nodes.append(as_st(map(intern, line.split('\0'))).intern())
632
632
        return nodes
633
633
 
634
634