~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/pack_repo.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-05 15:34:09 UTC
  • mto: (5757.7.2 knitpackrepo-6)
  • mto: This revision was merged to the branch mainline in revision 5774.
  • Revision ID: jelmer@samba.org-20110405153409-chtwr25n6wcfo5w3
Move knit-specific constructor to repofmt.knitpack_repo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
from bzrlib.knit import (
41
41
    KnitPlainFactory,
42
42
    KnitVersionedFiles,
43
 
    _KnitGraphIndex,
44
43
    _DirectPackAccess,
45
44
    )
46
45
""")
2090
2089
 
2091
2090
    """
2092
2091
 
2093
 
    def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
2094
 
        _serializer):
2095
 
        KnitRepository.__init__(self, _format, a_bzrdir, control_files,
2096
 
            _commit_builder_class, _serializer)
2097
 
        index_transport = self._transport.clone('indices')
2098
 
        self._pack_collection = RepositoryPackCollection(self, self._transport,
2099
 
            index_transport,
2100
 
            self._transport.clone('upload'),
2101
 
            self._transport.clone('packs'),
2102
 
            _format.index_builder_class,
2103
 
            _format.index_class,
2104
 
            use_chk_index=self._format.supports_chks,
2105
 
            )
2106
 
        self.inventories = KnitVersionedFiles(
2107
 
            _KnitGraphIndex(self._pack_collection.inventory_index.combined_index,
2108
 
                add_callback=self._pack_collection.inventory_index.add_callback,
2109
 
                deltas=True, parents=True, is_locked=self.is_locked),
2110
 
            data_access=self._pack_collection.inventory_index.data_access,
2111
 
            max_delta_chain=200)
2112
 
        self.revisions = KnitVersionedFiles(
2113
 
            _KnitGraphIndex(self._pack_collection.revision_index.combined_index,
2114
 
                add_callback=self._pack_collection.revision_index.add_callback,
2115
 
                deltas=False, parents=True, is_locked=self.is_locked,
2116
 
                track_external_parent_refs=True),
2117
 
            data_access=self._pack_collection.revision_index.data_access,
2118
 
            max_delta_chain=0)
2119
 
        self.signatures = KnitVersionedFiles(
2120
 
            _KnitGraphIndex(self._pack_collection.signature_index.combined_index,
2121
 
                add_callback=self._pack_collection.signature_index.add_callback,
2122
 
                deltas=False, parents=False, is_locked=self.is_locked),
2123
 
            data_access=self._pack_collection.signature_index.data_access,
2124
 
            max_delta_chain=0)
2125
 
        self.texts = KnitVersionedFiles(
2126
 
            _KnitGraphIndex(self._pack_collection.text_index.combined_index,
2127
 
                add_callback=self._pack_collection.text_index.add_callback,
2128
 
                deltas=True, parents=True, is_locked=self.is_locked),
2129
 
            data_access=self._pack_collection.text_index.data_access,
2130
 
            max_delta_chain=200)
2131
 
        if _format.supports_chks:
2132
 
            # No graph, no compression:- references from chks are between
2133
 
            # different objects not temporal versions of the same; and without
2134
 
            # some sort of temporal structure knit compression will just fail.
2135
 
            self.chk_bytes = KnitVersionedFiles(
2136
 
                _KnitGraphIndex(self._pack_collection.chk_index.combined_index,
2137
 
                    add_callback=self._pack_collection.chk_index.add_callback,
2138
 
                    deltas=False, parents=False, is_locked=self.is_locked),
2139
 
                data_access=self._pack_collection.chk_index.data_access,
2140
 
                max_delta_chain=0)
2141
 
        else:
2142
 
            self.chk_bytes = None
2143
 
        # True when the repository object is 'write locked' (as opposed to the
2144
 
        # physical lock only taken out around changes to the pack-names list.)
2145
 
        # Another way to represent this would be a decorator around the control
2146
 
        # files object that presents logical locks as physical ones - if this
2147
 
        # gets ugly consider that alternative design. RBC 20071011
2148
 
        self._write_lock_count = 0
2149
 
        self._transaction = None
2150
 
        # for tests
2151
 
        self._reconcile_does_inventory_gc = True
2152
 
        self._reconcile_fixes_text_parents = True
2153
 
        self._reconcile_backsup_inventory = False
2154
 
 
2155
2092
    def _abort_write_group(self):
2156
2093
        self.revisions._index._key_dependencies.clear()
2157
2094
        self._pack_collection._abort_write_group()