~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: John Arbash Meinel
  • Date: 2010-08-27 17:53:08 UTC
  • mfrom: (5390 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5393.
  • Revision ID: john@arbash-meinel.com-20100827175308-qsvcc11dkfvkrny1
Merge bzr.dev 5390

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
""")
50
50
from bzrlib import (
51
51
    bzrdir,
 
52
    btree_index,
52
53
    errors,
53
54
    lockable_files,
54
55
    lockdir,
56
57
    )
57
58
 
58
59
from bzrlib.decorators import needs_write_lock, only_raises
59
 
from bzrlib.btree_index import (
60
 
    BTreeGraphIndex,
61
 
    BTreeBuilder,
62
 
    )
63
60
from bzrlib.index import (
64
61
    GraphIndex,
65
62
    InMemoryGraphIndex,
231
228
        unlimited_cache = False
232
229
        if index_type == 'chk':
233
230
            unlimited_cache = True
234
 
        setattr(self, index_type + '_index',
235
 
            self.index_class(self.index_transport,
236
 
                self.index_name(index_type, self.name),
237
 
                self.index_sizes[self.index_offset(index_type)],
238
 
                unlimited_cache=unlimited_cache))
 
231
        index = self.index_class(self.index_transport,
 
232
                    self.index_name(index_type, self.name),
 
233
                    self.index_sizes[self.index_offset(index_type)],
 
234
                    unlimited_cache=unlimited_cache)
 
235
        if index_type == 'chk':
 
236
            index._leaf_factory = btree_index._gcchk_factory
 
237
        setattr(self, index_type + '_index', index)
239
238
 
240
239
 
241
240
class ExistingPack(Pack):
1680
1679
            txt_index = self._make_index(name, '.tix')
1681
1680
            sig_index = self._make_index(name, '.six')
1682
1681
            if self.chk_index is not None:
1683
 
                chk_index = self._make_index(name, '.cix', unlimited_cache=True)
 
1682
                chk_index = self._make_index(name, '.cix', is_chk=True)
1684
1683
            else:
1685
1684
                chk_index = None
1686
1685
            result = ExistingPack(self._pack_transport, name, rev_index,
1706
1705
            sig_index = self._make_index(name, '.six', resume=True)
1707
1706
            if self.chk_index is not None:
1708
1707
                chk_index = self._make_index(name, '.cix', resume=True,
1709
 
                                             unlimited_cache=True)
 
1708
                                             is_chk=True)
1710
1709
            else:
1711
1710
                chk_index = None
1712
1711
            result = self.resumed_pack_factory(name, rev_index, inv_index,
1742
1741
        return self._index_class(self.transport, 'pack-names', None
1743
1742
                ).iter_all_entries()
1744
1743
 
1745
 
    def _make_index(self, name, suffix, resume=False, unlimited_cache=False):
 
1744
    def _make_index(self, name, suffix, resume=False, is_chk=False):
1746
1745
        size_offset = self._suffix_offsets[suffix]
1747
1746
        index_name = name + suffix
1748
1747
        if resume:
1751
1750
        else:
1752
1751
            transport = self._index_transport
1753
1752
            index_size = self._names[name][size_offset]
1754
 
        return self._index_class(transport, index_name, index_size,
1755
 
                                 unlimited_cache=unlimited_cache)
 
1753
        index = self._index_class(transport, index_name, index_size,
 
1754
                                  unlimited_cache=is_chk)
 
1755
        if is_chk and self._index_class is btree_index.BTreeGraphIndex: 
 
1756
            index._leaf_factory = btree_index._gcchk_factory
 
1757
        return index
1756
1758
 
1757
1759
    def _max_pack_count(self, total_revisions):
1758
1760
        """Return the maximum number of packs to use for total revisions.
2829
2831
    _commit_builder_class = PackCommitBuilder
2830
2832
    supports_external_lookups = True
2831
2833
    # What index classes to use
2832
 
    index_builder_class = BTreeBuilder
2833
 
    index_class = BTreeGraphIndex
 
2834
    index_builder_class = btree_index.BTreeBuilder
 
2835
    index_class = btree_index.BTreeGraphIndex
2834
2836
 
2835
2837
    @property
2836
2838
    def _serializer(self):
2865
2867
    supports_tree_reference = False # no subtrees
2866
2868
    supports_external_lookups = True
2867
2869
    # What index classes to use
2868
 
    index_builder_class = BTreeBuilder
2869
 
    index_class = BTreeGraphIndex
 
2870
    index_builder_class = btree_index.BTreeBuilder
 
2871
    index_class = btree_index.BTreeGraphIndex
2870
2872
 
2871
2873
    @property
2872
2874
    def _serializer(self):
2907
2909
    supports_tree_reference = True
2908
2910
    supports_external_lookups = True
2909
2911
    # What index classes to use
2910
 
    index_builder_class = BTreeBuilder
2911
 
    index_class = BTreeGraphIndex
 
2912
    index_builder_class = btree_index.BTreeBuilder
 
2913
    index_class = btree_index.BTreeGraphIndex
2912
2914
 
2913
2915
    @property
2914
2916
    def _serializer(self):