~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:37:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105103758-wzftnmsip5iv9n2g
Revert addition of get_message_encoding function

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
            new_backing_file, size = self._spill_mem_keys_without_combining()
198
198
        # Note: The transport here isn't strictly needed, because we will use
199
199
        #       direct access to the new_backing._file object
200
 
        new_backing = BTreeGraphIndex(transport.get_transport('.'),
 
200
        new_backing = BTreeGraphIndex(transport.get_transport_from_path('.'),
201
201
                                      '<temp>', size)
202
202
        # GC will clean up the file
203
203
        new_backing._file = new_backing_file
294
294
            flag when writing out. This is used by the _spill_mem_keys_to_disk
295
295
            functionality.
296
296
        """
 
297
        new_leaf = False
297
298
        if rows[-1].writer is None:
298
299
            # opening a new leaf chunk;
 
300
            new_leaf = True
299
301
            for pos, internal_row in enumerate(rows[:-1]):
300
302
                # flesh out any internal nodes that are needed to
301
303
                # preserve the height of the tree
320
322
                optimize_for_size=self._optimize_for_size)
321
323
            rows[-1].writer.write(_LEAF_FLAG)
322
324
        if rows[-1].writer.write(line):
 
325
            # if we failed to write, despite having an empty page to write to,
 
326
            # then line is too big. raising the error avoids infinite recursion
 
327
            # searching for a suitably large page that will not be found.
 
328
            if new_leaf:
 
329
                raise errors.BadIndexKey(string_key)
323
330
            # this key did not fit in the node:
324
331
            rows[-1].finish_node()
325
332
            key_line = string_key + "\n"