~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/weave_fmt/repository.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-10 07:46:15 UTC
  • mfrom: (5844 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5845.
  • Revision ID: jelmer@samba.org-20110510074615-eptod049ndjxc4i7
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
from bzrlib.lazy_import import lazy_import
29
29
lazy_import(globals(), """
30
30
from bzrlib import (
31
 
    bzrdir_weave,
32
31
    xml5,
33
32
    graph as _mod_graph,
34
33
    ui,
50
49
    )
51
50
from bzrlib.decorators import needs_read_lock, needs_write_lock
52
51
from bzrlib.repository import (
53
 
    CommitBuilder,
54
52
    InterRepository,
55
 
    InterSameDataRepository,
56
 
    MetaDirVersionedFileRepository,
57
 
    MetaDirRepositoryFormat,
58
 
    Repository,
59
53
    RepositoryFormat,
60
54
    )
61
55
from bzrlib.store.text import TextStore
64
58
    FulltextContentFactory,
65
59
    VersionedFiles,
66
60
    )
 
61
from bzrlib.vf_repository import (
 
62
    InterSameDataRepository,
 
63
    VersionedFileCommitBuilder,
 
64
    VersionedFileRepository,
 
65
    VersionedFileRepositoryFormat,
 
66
    MetaDirVersionedFileRepository,
 
67
    MetaDirVersionedFileRepositoryFormat,
 
68
    )
67
69
 
68
70
from bzrlib.plugins.weave_fmt import bzrdir as weave_bzrdir
69
71
 
70
72
 
71
 
class AllInOneRepository(Repository):
 
73
class AllInOneRepository(VersionedFileRepository):
72
74
    """Legacy support - the repository behaviour for all-in-one branches."""
73
75
 
74
76
    @property
146
148
 
147
149
    def get_commit_builder(self, branch, parents, config, timestamp=None,
148
150
                           timezone=None, committer=None, revprops=None,
149
 
                           revision_id=None):
 
151
                           revision_id=None, lossy=False):
150
152
        self._check_ascii_revisionid(revision_id, self.get_commit_builder)
151
 
        result = CommitBuilder(self, parents, config, timestamp, timezone,
152
 
                              committer, revprops, revision_id)
 
153
        result = VersionedFileCommitBuilder(self, parents, config, timestamp,
 
154
            timezone, committer, revprops, revision_id, lossy=lossy)
153
155
        self.start_write_group()
154
156
        return result
155
157
 
189
191
        """Returns the policy for making working trees on new branches."""
190
192
        return True
191
193
 
192
 
    def revision_graph_can_have_wrong_parents(self):
193
 
        # XXX: This is an old format that we don't support full checking on, so
194
 
        # just claim that checking for this inconsistency is not required.
195
 
        return False
196
 
 
197
194
 
198
195
class WeaveMetaDirRepository(MetaDirVersionedFileRepository):
199
196
    """A subclass of MetaDirRepository to set weave specific policy."""
240
237
 
241
238
    def get_commit_builder(self, branch, parents, config, timestamp=None,
242
239
                           timezone=None, committer=None, revprops=None,
243
 
                           revision_id=None):
 
240
                           revision_id=None, lossy=False):
244
241
        self._check_ascii_revisionid(revision_id, self.get_commit_builder)
245
 
        result = CommitBuilder(self, parents, config, timestamp, timezone,
246
 
                              committer, revprops, revision_id)
 
242
        result = VersionedFileCommitBuilder(self, parents, config, timestamp,
 
243
            timezone, committer, revprops, revision_id, lossy=lossy)
247
244
        self.start_write_group()
248
245
        return result
249
246
 
264
261
        return self.inventories.add_lines((revision_id,), final_parents, lines,
265
262
            check_content=check_content)[0]
266
263
 
267
 
    def revision_graph_can_have_wrong_parents(self):
268
 
        return False
269
 
 
270
 
 
271
 
class PreSplitOutRepositoryFormat(RepositoryFormat):
 
264
 
 
265
class PreSplitOutRepositoryFormat(VersionedFileRepositoryFormat):
272
266
    """Base class for the pre split out repository formats."""
273
267
 
274
268
    rich_root_data = False
280
274
    _fetch_reconcile = True
281
275
    fast_deltas = False
282
276
    supports_leaving_lock = False
283
 
    supports_full_versioned_files = True
 
277
    # XXX: This is an old format that we don't support full checking on, so
 
278
    # just claim that checking for this inconsistency is not required.
 
279
    revision_graph_can_have_wrong_parents = False
284
280
 
285
281
    def initialize(self, a_bzrdir, shared=False, _internal=False):
286
282
        """Create a weave repository."""
434
430
        return versionedfile.ThunkedVersionedFiles(base_transport,
435
431
            weave.WeaveFile, mapper, repo.is_locked)
436
432
 
437
 
    def _get_extra_interrepo_test_combinations(self):
438
 
        from bzrlib.repofmt import knitrepo
439
 
        return [(InterRepository, RepositoryFormat5(),
440
 
            knitrepo.RepositoryFormatKnit3())]
441
 
 
442
433
 
443
434
class RepositoryFormat6(PreSplitOutRepositoryFormat):
444
435
    """Bzr control format 6.
486
477
            weave.WeaveFile, mapper, repo.is_locked)
487
478
 
488
479
 
489
 
class RepositoryFormat7(MetaDirRepositoryFormat):
 
480
class RepositoryFormat7(MetaDirVersionedFileRepositoryFormat):
490
481
    """Bzr repository 7.
491
482
 
492
483
    This repository format has:
502
493
    supports_ghosts = False
503
494
    supports_chks = False
504
495
    supports_funky_characters = False
505
 
    supports_full_versioned_files = True
 
496
    revision_graph_can_have_wrong_parents = False
506
497
 
507
498
    _fetch_order = 'topological'
508
499
    _fetch_reconcile = True
639
630
                    record, record.get_bytes_as(record.storage_kind)))
640
631
                try:
641
632
                    self.add_lines(record.key, None, lines)
642
 
                except RevisionAlreadyPresent:
 
633
                except errors.RevisionAlreadyPresent:
643
634
                    pass
644
635
 
645
636
    def _load_text(self, key):