~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Jelmer Vernooij
  • Date: 2016-04-03 16:32:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6617.
  • Revision ID: jelmer@jelmer.uk-20160403163231-h72bo0uyek2gikw0
Don't put French text in doc/en/user-reference when LANGUAGE=fr_CH.UTF_8.

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
 
20
22
import cStringIO
21
23
 
22
24
from bzrlib.lazy_import import lazy_import
197
199
            new_backing_file, size = self._spill_mem_keys_without_combining()
198
200
        # Note: The transport here isn't strictly needed, because we will use
199
201
        #       direct access to the new_backing._file object
200
 
        new_backing = BTreeGraphIndex(transport.get_transport('.'),
 
202
        new_backing = BTreeGraphIndex(transport.get_transport_from_path('.'),
201
203
                                      '<temp>', size)
202
204
        # GC will clean up the file
203
205
        new_backing._file = new_backing_file
296
298
        """
297
299
        new_leaf = False
298
300
        if rows[-1].writer is None:
 
301
            # opening a new leaf chunk;
299
302
            new_leaf = True
300
 
            # opening a new leaf chunk;
301
303
            for pos, internal_row in enumerate(rows[:-1]):
302
304
                # flesh out any internal nodes that are needed to
303
305
                # preserve the height of the tree
322
324
                optimize_for_size=self._optimize_for_size)
323
325
            rows[-1].writer.write(_LEAF_FLAG)
324
326
        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.
325
330
            if new_leaf:
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)
 
331
                raise errors.BadIndexKey(string_key)
329
332
            # this key did not fit in the node:
330
333
            rows[-1].finish_node()
331
334
            key_line = string_key + "\n"