~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-06-30 18:28:17 UTC
  • mfrom: (5967.10.2 test-cat)
  • Revision ID: pqm@pqm.ubuntu.com-20110630182817-83a5q9r9rxfkdn8r
(mbp) don't use subprocesses for testing cat (Martin Pool)

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
296
294
            flag when writing out. This is used by the _spill_mem_keys_to_disk
297
295
            functionality.
298
296
        """
299
 
        new_leaf = False
300
297
        if rows[-1].writer is None:
301
298
            # opening a new leaf chunk;
302
 
            new_leaf = True
303
299
            for pos, internal_row in enumerate(rows[:-1]):
304
300
                # flesh out any internal nodes that are needed to
305
301
                # preserve the height of the tree
324
320
                optimize_for_size=self._optimize_for_size)
325
321
            rows[-1].writer.write(_LEAF_FLAG)
326
322
        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
 
            if new_leaf:
331
 
                raise errors.BadIndexKey(string_key)
332
323
            # this key did not fit in the node:
333
324
            rows[-1].finish_node()
334
325
            key_line = string_key + "\n"