/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 bzrlib/_btree_serializer_py.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-17 19:08:25 UTC
  • mto: This revision was merged to the branch mainline in revision 4460.
  • Revision ID: john@arbash-meinel.com-20090617190825-ktfk82li57rf2im6
It seems that fetch() no longer returns the number of revisions fetched.
It still does for *some* InterRepository fetch paths, but the generic one does not.
It is also not easy to get it to, since the Source and Sink are the ones
that would know how many keys were transmitted, and they are potentially 'remote'
objects.

This was also only tested to occur as a by-product in a random 'test_commit' test.
I assume if we really wanted the assurance, we would have a per_repo or interrepo
test for it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
 
18
18
"""B+Tree index parsing."""
19
19
 
20
 
from bzrlib import static_tuple
21
 
 
22
 
 
23
20
def _parse_leaf_lines(bytes, key_length, ref_list_length):
24
21
    lines = bytes.split('\n')
25
22
    nodes = []
26
 
    as_st = static_tuple.StaticTuple.from_sequence
27
 
    stuple = static_tuple.StaticTuple
28
23
    for line in lines[1:]:
29
24
        if line == '':
30
25
            return nodes
31
26
        elements = line.split('\0', key_length)
32
27
        # keys are tuples
33
 
        key = as_st(elements[:key_length]).intern()
 
28
        key = tuple(elements[:key_length])
34
29
        line = elements[-1]
35
30
        references, value = line.rsplit('\0', 1)
36
31
        if ref_list_length:
37
32
            ref_lists = []
38
33
            for ref_string in references.split('\t'):
39
 
                ref_list = as_st([as_st(ref.split('\0')).intern()
40
 
                                  for ref in ref_string.split('\r') if ref])
41
 
                ref_lists.append(ref_list)
42
 
            ref_lists = as_st(ref_lists)
43
 
            node_value = stuple(value, ref_lists)
 
34
                ref_lists.append(tuple([
 
35
                    tuple(ref.split('\0')) for ref in ref_string.split('\r') if ref
 
36
                    ]))
 
37
            ref_lists = tuple(ref_lists)
 
38
            node_value = (value, ref_lists)
44
39
        else:
45
 
            node_value = stuple(value, stuple())
46
 
        # No need for StaticTuple here as it is put into a dict
 
40
            node_value = (value, ())
47
41
        nodes.append((key, node_value))
48
42
    return nodes
49
43