/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/btree_index.py

  • Committer: Breezy landing bot
  • Author(s): Martin
  • Date: 2017-06-10 02:49:30 UTC
  • mfrom: (6677.1.4 py3_bootstrap)
  • Revision ID: breezy.the.bot@gmail.com-20170610024930-enw8wdbjy9s4dtnm
Progress on Python 3 to get TestCaseWithTransport working

Merged from https://code.launchpad.net/~gz/brz/py3_bootstrap/+merge/325439

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    )
51
51
 
52
52
 
53
 
_BTSIGNATURE = "B+Tree Graph Index 2\n"
54
 
_OPTION_ROW_LENGTHS = "row_lengths="
55
 
_LEAF_FLAG = "type=leaf\n"
56
 
_INTERNAL_FLAG = "type=internal\n"
57
 
_INTERNAL_OFFSET = "offset="
 
53
_BTSIGNATURE = b"B+Tree Graph Index 2\n"
 
54
_OPTION_ROW_LENGTHS = b"row_lengths="
 
55
_LEAF_FLAG = b"type=leaf\n"
 
56
_INTERNAL_FLAG = b"type=internal\n"
 
57
_INTERNAL_OFFSET = b"offset="
58
58
 
59
59
_RESERVED_HEADER_BYTES = 120
60
60
_PAGE_SIZE = 4096
406
406
            pad = (not isinstance(row, _LeafBuilderRow))
407
407
            row.finish_node(pad=pad)
408
408
        lines = [_BTSIGNATURE]
409
 
        lines.append(_OPTION_NODE_REFS + str(self.reference_lists) + '\n')
410
 
        lines.append(_OPTION_KEY_ELEMENTS + str(self._key_length) + '\n')
411
 
        lines.append(_OPTION_LEN + str(key_count) + '\n')
 
409
        lines.append(b'%s%d\n' % (_OPTION_NODE_REFS, self.reference_lists))
 
410
        lines.append(b'%s%d\n' % (_OPTION_KEY_ELEMENTS, self._key_length))
 
411
        lines.append(b'%s%d\n' % (_OPTION_LEN, key_count))
412
412
        row_lengths = [row.nodes for row in rows]
413
 
        lines.append(_OPTION_ROW_LENGTHS + ','.join(map(str, row_lengths)) + '\n')
 
413
        lines.append(_OPTION_ROW_LENGTHS + ','.join(
 
414
            map(str, row_lengths)).encode('ascii') + b'\n')
414
415
        if row_lengths and row_lengths[-1] > 1:
415
416
            result = tempfile.NamedTemporaryFile(prefix='bzr-index-')
416
417
        else:
1434
1435
            raise errors.BadIndexOptions(self)
1435
1436
        try:
1436
1437
            self._row_lengths = [int(length) for length in
1437
 
                options_line[len(_OPTION_ROW_LENGTHS):].split(',')
 
1438
                options_line[len(_OPTION_ROW_LENGTHS):].split(b',')
1438
1439
                if length]
1439
1440
        except ValueError:
1440
1441
            raise errors.BadIndexOptions(self)