~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Samuel Bronson
  • Date: 2012-08-30 20:36:18 UTC
  • mto: (6015.57.3 2.4)
  • mto: This revision was merged to the branch mainline in revision 6558.
  • Revision ID: naesten@gmail.com-20120830203618-y2dzw91nqpvpgxvx
Update INSTALL for switch to Python 2.6 and up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""B+Tree indices"""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
20
import cStringIO
23
21
 
24
22
from bzrlib.lazy_import import lazy_import
199
197
            new_backing_file, size = self._spill_mem_keys_without_combining()
200
198
        # Note: The transport here isn't strictly needed, because we will use
201
199
        #       direct access to the new_backing._file object
202
 
        new_backing = BTreeGraphIndex(transport.get_transport_from_path('.'),
 
200
        new_backing = BTreeGraphIndex(transport.get_transport('.'),
203
201
                                      '<temp>', size)
204
202
        # GC will clean up the file
205
203
        new_backing._file = new_backing_file
298
296
        """
299
297
        new_leaf = False
300
298
        if rows[-1].writer is None:
 
299
            new_leaf = True
301
300
            # opening a new leaf chunk;
302
 
            new_leaf = True
303
301
            for pos, internal_row in enumerate(rows[:-1]):
304
302
                # flesh out any internal nodes that are needed to
305
303
                # preserve the height of the tree
324
322
                optimize_for_size=self._optimize_for_size)
325
323
            rows[-1].writer.write(_LEAF_FLAG)
326
324
        if rows[-1].writer.write(line):
327
 
            # if we failed to write, despite having an empty page to write to,
328
 
            # then line is too big. raising the error avoids infinite recursion
329
 
            # searching for a suitably large page that will not be found.
330
325
            if new_leaf:
331
 
                raise errors.BadIndexKey(string_key)
 
326
                # We just created this leaf, and now the line doesn't fit.
 
327
                # Clearly it will never fit, so punt.
 
328
                raise errors.BadIndexKey(line)
332
329
            # this key did not fit in the node:
333
330
            rows[-1].finish_node()
334
331
            key_line = string_key + "\n"