/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.17.9 by Robert Collins
Initial stab at repository format support.
1
# groupcompress, a bzr plugin providing improved disk utilisation
2
# Copyright (C) 2008 Canonical Limited.
3
# 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License version 2 as published
6
# by the Free Software Foundation.
7
# 
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
# 
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
16
# 
17
18
"""Repostory formats using B+Tree indices and groupcompress compression."""
19
20
import md5
21
import time
22
23
from bzrlib import debug, errors, pack, repository
0.17.21 by Robert Collins
Update groupcompress to bzrlib 1.10.
24
from bzrlib.btree_index import (
25
    BTreeBuilder,
26
    BTreeGraphIndex,
27
    )
0.17.9 by Robert Collins
Initial stab at repository format support.
28
from bzrlib.index import GraphIndex, GraphIndexBuilder
29
from bzrlib.repository import InterPackRepo
30
from bzrlib.plugins.groupcompress.groupcompress import (
31
    _GCGraphIndex,
32
    GroupCompressVersionedFiles,
33
    )
34
from bzrlib.osutils import rand_chars
35
from bzrlib.repofmt.pack_repo import (
36
    Pack,
37
    NewPack,
38
    KnitPackRepository,
39
    RepositoryPackCollection,
0.17.21 by Robert Collins
Update groupcompress to bzrlib 1.10.
40
    RepositoryFormatPackDevelopment2,
41
    RepositoryFormatPackDevelopment2Subtree,
0.17.9 by Robert Collins
Initial stab at repository format support.
42
    RepositoryFormatKnitPack1,
43
    RepositoryFormatKnitPack3,
44
    RepositoryFormatKnitPack4,
45
    Packer,
46
    ReconcilePacker,
47
    OptimisingPacker,
48
    )
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
49
try:
50
    from bzrlib.repofmt.pack_repo import (
0.17.26 by Robert Collins
Working better --gc-plain-chk.
51
    CHKInventoryRepository,
0.21.1 by John Arbash Meinel
Start basing the groupcompress chk formats on the dev5 formats.
52
    RepositoryFormatPackDevelopment5,
53
    RepositoryFormatPackDevelopment5Hash16,
0.21.3 by John Arbash Meinel
Start putting together a GroupCompress format that is built on dev5
54
    RepositoryFormatPackDevelopment5Hash255,
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
55
    )
56
    chk_support = True
57
except ImportError:
58
    chk_support = False
0.17.9 by Robert Collins
Initial stab at repository format support.
59
from bzrlib import ui
60
61
62
def open_pack(self):
0.17.22 by Robert Collins
really get gc working with 1.10
63
    return self._pack_collection.pack_factory(self._pack_collection,
64
        upload_suffix=self.suffix,
0.17.9 by Robert Collins
Initial stab at repository format support.
65
        file_mode=self._pack_collection.repo.bzrdir._get_file_mode())
66
67
68
Packer.open_pack = open_pack
69
70
71
class GCPack(NewPack):
72
0.17.22 by Robert Collins
really get gc working with 1.10
73
    def __init__(self, pack_collection, upload_suffix='', file_mode=None):
0.17.9 by Robert Collins
Initial stab at repository format support.
74
        """Create a NewPack instance.
75
76
        :param upload_transport: A writable transport for the pack to be
77
            incrementally uploaded to.
78
        :param index_transport: A writable transport for the pack's indices to
79
            be written to when the pack is finished.
80
        :param pack_transport: A writable transport for the pack to be renamed
81
            to when the upload is complete. This *must* be the same as
82
            upload_transport.clone('../packs').
83
        :param upload_suffix: An optional suffix to be given to any temporary
84
            files created during the pack creation. e.g '.autopack'
85
        :param file_mode: An optional file mode to create the new files with.
86
        """
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
87
        # replaced from bzr.dev to:
88
        # - change inventory reference list length to 1
89
        # - change texts reference lists to 1
90
        # TODO: patch this to be parameterised upstream
91
        
0.17.9 by Robert Collins
Initial stab at repository format support.
92
        # The relative locations of the packs are constrained, but all are
93
        # passed in because the caller has them, so as to avoid object churn.
0.17.22 by Robert Collins
really get gc working with 1.10
94
        index_builder_class = pack_collection._index_builder_class
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
95
        if chk_support:
96
            # from brisbane-core
97
            if pack_collection.chk_index is not None:
98
                chk_index = index_builder_class(reference_lists=0)
99
            else:
100
                chk_index = None
101
            Pack.__init__(self,
102
                # Revisions: parents list, no text compression.
103
                index_builder_class(reference_lists=1),
104
                # Inventory: We want to map compression only, but currently the
105
                # knit code hasn't been updated enough to understand that, so we
106
                # have a regular 2-list index giving parents and compression
107
                # source.
108
                index_builder_class(reference_lists=1),
109
                # Texts: compression and per file graph, for all fileids - so two
110
                # reference lists and two elements in the key tuple.
111
                index_builder_class(reference_lists=1, key_elements=2),
112
                # Signatures: Just blobs to store, no compression, no parents
113
                # listing.
114
                index_builder_class(reference_lists=0),
115
                # CHK based storage - just blobs, no compression or parents.
116
                chk_index=chk_index
117
                )
118
        else:
119
            # from bzr.dev
120
            Pack.__init__(self,
121
                # Revisions: parents list, no text compression.
122
                index_builder_class(reference_lists=1),
123
                # Inventory: compressed, with graph for compatibility with other
124
                # existing bzrlib code.
125
                index_builder_class(reference_lists=1),
126
                # Texts: per file graph:
127
                index_builder_class(reference_lists=1, key_elements=2),
128
                # Signatures: Just blobs to store, no compression, no parents
129
                # listing.
130
                index_builder_class(reference_lists=0),
131
                )
0.17.22 by Robert Collins
really get gc working with 1.10
132
        self._pack_collection = pack_collection
133
        # When we make readonly indices, we need this.
134
        self.index_class = pack_collection._index_class
0.17.9 by Robert Collins
Initial stab at repository format support.
135
        # where should the new pack be opened
0.17.22 by Robert Collins
really get gc working with 1.10
136
        self.upload_transport = pack_collection._upload_transport
0.17.9 by Robert Collins
Initial stab at repository format support.
137
        # where are indices written out to
0.17.22 by Robert Collins
really get gc working with 1.10
138
        self.index_transport = pack_collection._index_transport
0.17.9 by Robert Collins
Initial stab at repository format support.
139
        # where is the pack renamed to when it is finished?
0.17.22 by Robert Collins
really get gc working with 1.10
140
        self.pack_transport = pack_collection._pack_transport
0.17.9 by Robert Collins
Initial stab at repository format support.
141
        # What file mode to upload the pack and indices with.
142
        self._file_mode = file_mode
143
        # tracks the content written to the .pack file.
144
        self._hash = md5.new()
145
        # a four-tuple with the length in bytes of the indices, once the pack
146
        # is finalised. (rev, inv, text, sigs)
147
        self.index_sizes = None
148
        # How much data to cache when writing packs. Note that this is not
149
        # synchronised with reads, because it's not in the transport layer, so
150
        # is not safe unless the client knows it won't be reading from the pack
151
        # under creation.
152
        self._cache_limit = 0
153
        # the temporary pack file name.
154
        self.random_name = rand_chars(20) + upload_suffix
155
        # when was this pack started ?
156
        self.start_time = time.time()
157
        # open an output stream for the data added to the pack.
158
        self.write_stream = self.upload_transport.open_write_stream(
159
            self.random_name, mode=self._file_mode)
160
        if 'pack' in debug.debug_flags:
161
            mutter('%s: create_pack: pack stream open: %s%s t+%6.3fs',
162
                time.ctime(), self.upload_transport.base, self.random_name,
163
                time.time() - self.start_time)
164
        # A list of byte sequences to be written to the new pack, and the 
165
        # aggregate size of them.  Stored as a list rather than separate 
166
        # variables so that the _write_data closure below can update them.
167
        self._buffer = [[], 0]
168
        # create a callable for adding data 
169
        #
170
        # robertc says- this is a closure rather than a method on the object
171
        # so that the variables are locals, and faster than accessing object
172
        # members.
173
        def _write_data(bytes, flush=False, _buffer=self._buffer,
174
            _write=self.write_stream.write, _update=self._hash.update):
175
            _buffer[0].append(bytes)
176
            _buffer[1] += len(bytes)
177
            # buffer cap
178
            if _buffer[1] > self._cache_limit or flush:
179
                bytes = ''.join(_buffer[0])
180
                _write(bytes)
181
                _update(bytes)
182
                _buffer[:] = [[], 0]
183
        # expose this on self, for the occasion when clients want to add data.
184
        self._write_data = _write_data
185
        # a pack writer object to serialise pack records.
186
        self._writer = pack.ContainerWriter(self._write_data)
187
        self._writer.begin()
188
        # what state is the pack in? (open, finished, aborted)
189
        self._state = 'open'
190
191
192
RepositoryPackCollection.pack_factory = NewPack
193
194
class GCRepositoryPackCollection(RepositoryPackCollection):
195
196
    pack_factory = GCPack
197
198
    def _make_index(self, name, suffix):
199
        """Overridden to use BTreeGraphIndex objects."""
200
        size_offset = self._suffix_offsets[suffix]
201
        index_name = name + suffix
202
        index_size = self._names[name][size_offset]
203
        return BTreeGraphIndex(
204
            self._index_transport, index_name, index_size)
205
206
    def _start_write_group(self):
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
207
        # Overridden to add 'self.pack_factory()'
0.17.9 by Robert Collins
Initial stab at repository format support.
208
        # Do not permit preparation for writing if we're not in a 'write lock'.
209
        if not self.repo.is_write_locked():
210
            raise errors.NotWriteLocked(self)
0.17.22 by Robert Collins
really get gc working with 1.10
211
        self._new_pack = self.pack_factory(self, upload_suffix='.pack',
0.17.9 by Robert Collins
Initial stab at repository format support.
212
            file_mode=self.repo.bzrdir._get_file_mode())
213
        # allow writing: queue writes to a new index
214
        self.revision_index.add_writable_index(self._new_pack.revision_index,
215
            self._new_pack)
216
        self.inventory_index.add_writable_index(self._new_pack.inventory_index,
217
            self._new_pack)
218
        self.text_index.add_writable_index(self._new_pack.text_index,
219
            self._new_pack)
220
        self.signature_index.add_writable_index(self._new_pack.signature_index,
221
            self._new_pack)
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
222
        if chk_support and self.chk_index is not None:
223
            self.chk_index.add_writable_index(self._new_pack.chk_index,
224
                self._new_pack)
225
            self.repo.chk_bytes._index._add_callback = self.chk_index.add_callback
0.17.9 by Robert Collins
Initial stab at repository format support.
226
227
        self.repo.inventories._index._add_callback = self.inventory_index.add_callback
228
        self.repo.revisions._index._add_callback = self.revision_index.add_callback
229
        self.repo.signatures._index._add_callback = self.signature_index.add_callback
230
        self.repo.texts._index._add_callback = self.text_index.add_callback
231
0.20.7 by John Arbash Meinel
(ugly hack) autopacking doesn't work, so don't do it.
232
    def _do_autopack(self):
233
        return False
234
0.17.9 by Robert Collins
Initial stab at repository format support.
235
236
237
class GCPackRepository(KnitPackRepository):
238
    """GC customisation of KnitPackRepository."""
239
240
    def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
241
        _serializer):
242
        """Overridden to change pack collection class."""
243
        KnitPackRepository.__init__(self, _format, a_bzrdir, control_files,
244
            _commit_builder_class, _serializer)
245
        # and now replace everything it did :)
246
        index_transport = self._transport.clone('indices')
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
247
        if chk_support:
248
            self._pack_collection = GCRepositoryPackCollection(self,
249
                self._transport, index_transport,
250
                self._transport.clone('upload'),
251
                self._transport.clone('packs'),
252
                _format.index_builder_class,
253
                _format.index_class,
254
                use_chk_index=self._format.supports_chks,
255
                )
256
        else:
257
            self._pack_collection = GCRepositoryPackCollection(self,
258
                self._transport, index_transport,
259
                self._transport.clone('upload'),
260
                self._transport.clone('packs'),
261
                _format.index_builder_class,
262
                _format.index_class)
0.17.9 by Robert Collins
Initial stab at repository format support.
263
        self.inventories = GroupCompressVersionedFiles(
264
            _GCGraphIndex(self._pack_collection.inventory_index.combined_index,
265
                add_callback=self._pack_collection.inventory_index.add_callback,
266
                parents=True, is_locked=self.is_locked),
267
            access=self._pack_collection.inventory_index.data_access)
268
        self.revisions = GroupCompressVersionedFiles(
269
            _GCGraphIndex(self._pack_collection.revision_index.combined_index,
270
                add_callback=self._pack_collection.revision_index.add_callback,
271
                parents=True, is_locked=self.is_locked),
272
            access=self._pack_collection.revision_index.data_access,
273
            delta=False)
274
        self.signatures = GroupCompressVersionedFiles(
275
            _GCGraphIndex(self._pack_collection.signature_index.combined_index,
276
                add_callback=self._pack_collection.signature_index.add_callback,
277
                parents=False, is_locked=self.is_locked),
278
            access=self._pack_collection.signature_index.data_access,
279
            delta=False)
280
        self.texts = GroupCompressVersionedFiles(
281
            _GCGraphIndex(self._pack_collection.text_index.combined_index,
282
                add_callback=self._pack_collection.text_index.add_callback,
283
                parents=True, is_locked=self.is_locked),
284
            access=self._pack_collection.text_index.data_access)
0.17.26 by Robert Collins
Working better --gc-plain-chk.
285
        if chk_support and _format.supports_chks:
286
            # No graph, no compression:- references from chks are between
287
            # different objects not temporal versions of the same; and without
288
            # some sort of temporal structure knit compression will just fail.
289
            self.chk_bytes = GroupCompressVersionedFiles(
290
                _GCGraphIndex(self._pack_collection.chk_index.combined_index,
291
                    add_callback=self._pack_collection.chk_index.add_callback,
292
                    parents=False, is_locked=self.is_locked),
293
                access=self._pack_collection.chk_index.data_access)
294
        else:
295
            self.chk_bytes = None
0.17.9 by Robert Collins
Initial stab at repository format support.
296
        # True when the repository object is 'write locked' (as opposed to the
297
        # physical lock only taken out around changes to the pack-names list.) 
298
        # Another way to represent this would be a decorator around the control
299
        # files object that presents logical locks as physical ones - if this
300
        # gets ugly consider that alternative design. RBC 20071011
301
        self._write_lock_count = 0
302
        self._transaction = None
303
        # for tests
304
        self._reconcile_does_inventory_gc = True
305
        self._reconcile_fixes_text_parents = True
306
        self._reconcile_backsup_inventory = False
0.20.7 by John Arbash Meinel
(ugly hack) autopacking doesn't work, so don't do it.
307
        # Note: We cannot unpack a delta that references a text we haven't seen yet.
308
        #       there are 2 options, work in fulltexts, or require topological
309
        #       sorting. Using fulltexts is more optimal for local operations,
310
        #       because the source can be smart about extracting multiple
311
        #       in-a-row (and sharing strings). Topological is better for
312
        #       remote, because we access less data.
313
        self._fetch_order = 'topological'
314
        self._fetch_uses_deltas = False
0.17.9 by Robert Collins
Initial stab at repository format support.
315
316
0.17.26 by Robert Collins
Working better --gc-plain-chk.
317
if chk_support:
318
    class GCCHKPackRepository(CHKInventoryRepository):
319
        """GC customisation of CHKInventoryRepository."""
320
321
        def __init__(self, _format, a_bzrdir, control_files, _commit_builder_class,
322
            _serializer):
323
            """Overridden to change pack collection class."""
324
            KnitPackRepository.__init__(self, _format, a_bzrdir, control_files,
325
                _commit_builder_class, _serializer)
326
            # and now replace everything it did :)
327
            index_transport = self._transport.clone('indices')
0.20.4 by John Arbash Meinel
Simplify the internals. We've already checked 'chk_support' so we don't need to check again.
328
            self._pack_collection = GCRepositoryPackCollection(self,
329
                self._transport, index_transport,
330
                self._transport.clone('upload'),
331
                self._transport.clone('packs'),
332
                _format.index_builder_class,
333
                _format.index_class,
334
                use_chk_index=self._format.supports_chks,
335
                )
0.17.26 by Robert Collins
Working better --gc-plain-chk.
336
            self.inventories = GroupCompressVersionedFiles(
337
                _GCGraphIndex(self._pack_collection.inventory_index.combined_index,
338
                    add_callback=self._pack_collection.inventory_index.add_callback,
339
                    parents=True, is_locked=self.is_locked),
340
                access=self._pack_collection.inventory_index.data_access)
341
            self.revisions = GroupCompressVersionedFiles(
342
                _GCGraphIndex(self._pack_collection.revision_index.combined_index,
343
                    add_callback=self._pack_collection.revision_index.add_callback,
344
                    parents=True, is_locked=self.is_locked),
345
                access=self._pack_collection.revision_index.data_access,
346
                delta=False)
347
            self.signatures = GroupCompressVersionedFiles(
348
                _GCGraphIndex(self._pack_collection.signature_index.combined_index,
349
                    add_callback=self._pack_collection.signature_index.add_callback,
350
                    parents=False, is_locked=self.is_locked),
351
                access=self._pack_collection.signature_index.data_access,
352
                delta=False)
353
            self.texts = GroupCompressVersionedFiles(
354
                _GCGraphIndex(self._pack_collection.text_index.combined_index,
355
                    add_callback=self._pack_collection.text_index.add_callback,
356
                    parents=True, is_locked=self.is_locked),
357
                access=self._pack_collection.text_index.data_access)
0.20.4 by John Arbash Meinel
Simplify the internals. We've already checked 'chk_support' so we don't need to check again.
358
            assert _format.supports_chks
359
            # No parents, individual CHK pages don't have specific ancestry
360
            self.chk_bytes = GroupCompressVersionedFiles(
361
                _GCGraphIndex(self._pack_collection.chk_index.combined_index,
362
                    add_callback=self._pack_collection.chk_index.add_callback,
363
                    parents=False, is_locked=self.is_locked),
364
                access=self._pack_collection.chk_index.data_access)
0.17.26 by Robert Collins
Working better --gc-plain-chk.
365
            # True when the repository object is 'write locked' (as opposed to the
0.20.4 by John Arbash Meinel
Simplify the internals. We've already checked 'chk_support' so we don't need to check again.
366
            # physical lock only taken out around changes to the pack-names list.)
0.17.26 by Robert Collins
Working better --gc-plain-chk.
367
            # Another way to represent this would be a decorator around the control
368
            # files object that presents logical locks as physical ones - if this
369
            # gets ugly consider that alternative design. RBC 20071011
370
            self._write_lock_count = 0
371
            self._transaction = None
372
            # for tests
373
            self._reconcile_does_inventory_gc = True
374
            self._reconcile_fixes_text_parents = True
375
            self._reconcile_backsup_inventory = False
0.20.7 by John Arbash Meinel
(ugly hack) autopacking doesn't work, so don't do it.
376
            self._fetch_order = 'topological'
377
            self._fetch_uses_deltas = False
0.17.26 by Robert Collins
Working better --gc-plain-chk.
378
379
0.17.21 by Robert Collins
Update groupcompress to bzrlib 1.10.
380
class RepositoryFormatPackGCPlain(RepositoryFormatPackDevelopment2):
0.17.9 by Robert Collins
Initial stab at repository format support.
381
    """A B+Tree index using pack repository."""
382
383
    repository_class = GCPackRepository
384
385
    def get_format_string(self):
386
        """See RepositoryFormat.get_format_string()."""
387
        return ("Bazaar development format - btree+gc "
388
            "(needs bzr.dev from 1.6)\n")
389
390
    def get_format_description(self):
391
        """See RepositoryFormat.get_format_description()."""
392
        return ("Development repository format - btree+groupcompress "
393
            ", interoperates with pack-0.92\n")
394
395
396
class RepositoryFormatPackGCRichRoot(RepositoryFormatKnitPack4):
397
    """A B+Tree index using pack repository."""
398
399
    repository_class = GCPackRepository
400
401
    def get_format_string(self):
402
        """See RepositoryFormat.get_format_string()."""
403
        return ("Bazaar development format - btree+gc-rich-root "
404
            "(needs bzr.dev from 1.6)\n")
405
406
    def get_format_description(self):
407
        """See RepositoryFormat.get_format_description()."""
408
        return ("Development repository format - btree+groupcompress "
409
            ", interoperates with rich-root-pack\n")
410
411
0.17.21 by Robert Collins
Update groupcompress to bzrlib 1.10.
412
class RepositoryFormatPackGCSubtrees(RepositoryFormatPackDevelopment2Subtree):
0.17.9 by Robert Collins
Initial stab at repository format support.
413
    """A B+Tree index using pack repository."""
414
415
    repository_class = GCPackRepository
416
417
    def get_format_string(self):
418
        """See RepositoryFormat.get_format_string()."""
419
        return ("Bazaar development format - btree+gc-subtrees "
420
            "(needs bzr.dev from 1.6)\n")
421
422
    def get_format_description(self):
423
        """See RepositoryFormat.get_format_description()."""
424
        return ("Development repository format - btree+groupcompress "
425
            ", interoperates with pack-0.92-subtrees\n")
426
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
427
if chk_support:
0.21.1 by John Arbash Meinel
Start basing the groupcompress chk formats on the dev5 formats.
428
    class RepositoryFormatPackGCPlainCHK(RepositoryFormatPackDevelopment5):
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
429
        """A CHK+group compress pack repository."""
430
0.17.26 by Robert Collins
Working better --gc-plain-chk.
431
        repository_class = GCCHKPackRepository
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
432
433
        def get_format_string(self):
434
            """See RepositoryFormat.get_format_string()."""
0.21.1 by John Arbash Meinel
Start basing the groupcompress chk formats on the dev5 formats.
435
            return ('Bazaar development format - chk+gc'
436
                    ' (needs bzr.dev from 1.13)\n')
437
438
        def get_format_description(self):
439
            """See RepositoryFormat.get_format_description()."""
440
            return ("Development repository format - chk+groupcompress")
441
0.21.2 by John Arbash Meinel
Bring in the trunk simplifications.
442
0.21.1 by John Arbash Meinel
Start basing the groupcompress chk formats on the dev5 formats.
443
    class RepositoryFormatPackGCPlainCHK16(RepositoryFormatPackDevelopment5Hash16):
444
        """A hashed CHK+group compress pack repository."""
445
446
        repository_class = GCCHKPackRepository
447
448
        def get_format_string(self):
449
            """See RepositoryFormat.get_format_string()."""
450
            return ('Bazaar development format - hash16chk+gc'
451
                    ' (needs bzr.dev from 1.13)\n')
452
453
        def get_format_description(self):
454
            """See RepositoryFormat.get_format_description()."""
455
            return ("Development repository format - hash16chk+groupcompress")
0.17.25 by Robert Collins
Preliminary --gc-plain-chk support.
456
457
0.21.3 by John Arbash Meinel
Start putting together a GroupCompress format that is built on dev5
458
    class RepositoryFormatPackGCPlainCHK255(RepositoryFormatPackDevelopment5Hash255):
459
        """A hashed CHK+group compress pack repository."""
460
461
        repository_class = GCCHKPackRepository
462
463
        def get_format_string(self):
464
            """See RepositoryFormat.get_format_string()."""
465
            return ('Bazaar development format - hash255chk+gc'
466
                    ' (needs bzr.dev from 1.13)\n')
467
468
        def get_format_description(self):
469
            """See RepositoryFormat.get_format_description()."""
470
            return ("Development repository format - hash255chk+groupcompress")
471
472
0.17.9 by Robert Collins
Initial stab at repository format support.
473
def pack_incompatible(source, target, orig_method=InterPackRepo.is_compatible):
0.17.26 by Robert Collins
Working better --gc-plain-chk.
474
    """Be incompatible with the regular fetch code."""
0.17.9 by Robert Collins
Initial stab at repository format support.
475
    formats = (RepositoryFormatPackGCPlain, RepositoryFormatPackGCRichRoot,
476
        RepositoryFormatPackGCSubtrees)
0.17.26 by Robert Collins
Working better --gc-plain-chk.
477
    if chk_support:
0.21.1 by John Arbash Meinel
Start basing the groupcompress chk formats on the dev5 formats.
478
        formats = formats + (RepositoryFormatPackGCPlainCHK,
0.21.3 by John Arbash Meinel
Start putting together a GroupCompress format that is built on dev5
479
                             RepositoryFormatPackGCPlainCHK16,
480
                             RepositoryFormatPackGCPlainCHK255)
0.17.10 by Robert Collins
Correct optimiser disabling.
481
    if isinstance(source._format, formats) or isinstance(target._format, formats):
0.17.9 by Robert Collins
Initial stab at repository format support.
482
        return False
483
    else:
484
        return orig_method(source, target)
485
486
487
InterPackRepo.is_compatible = staticmethod(pack_incompatible)