~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Robert Collins
  • Date: 2010-06-28 02:41:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5324.
  • Revision ID: robertc@robertcollins.net-20100628024122-g951fzp74f3u6wst
Sanity check that new_trace_file in pop_log_file is valid, and also fix a test that monkey patched get_terminal_encoding.

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