~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

  • Committer: Robert Collins
  • Date: 2007-07-12 13:51:40 UTC
  • mto: (2592.5.3 pack-repository)
  • mto: This revision was merged to the branch mainline in revision 2624.
  • Revision ID: robertc@robertcollins.net-20070712135140-6y4vgazp2dsrz45b
Record the number of node reference lists a particular index has.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
from bzrlib import errors
22
22
 
 
23
_OPTION_NODE_REFS = "node_ref_lists="
23
24
_SIGNATURE = "Bazaar Graph Index 1\n"
24
25
 
25
26
 
26
27
class GraphIndexBuilder(object):
27
28
    """A builder that can build a GraphIndex."""
28
29
 
 
30
    def __init__(self, reference_lists=0):
 
31
        """Create a GraphIndex builder.
 
32
 
 
33
        :param reference_lists: The number of node references lists for each
 
34
            entry.
 
35
        """
 
36
        self.reference_lists = reference_lists
 
37
 
29
38
    def finish(self):
30
 
        return StringIO(_SIGNATURE + '\n')
 
39
        lines = [_SIGNATURE]
 
40
        lines.append(_OPTION_NODE_REFS + str(self.reference_lists) + '\n')
 
41
        lines.append('\n')
 
42
        return StringIO(''.join(lines))
31
43
 
32
44
 
33
45
class GraphIndex(object):