~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: Jelmer Vernooij
  • Date: 2011-02-11 17:58:56 UTC
  • mto: This revision was merged to the branch mainline in revision 5662.
  • Revision ID: jelmer@samba.org-20110211175856-alncdirjmi75qr67
Add 'WorkingTreeFormat.missing_parent_conflicts' flag to use in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from bzrlib.lazy_import import lazy_import
29
29
lazy_import(globals(), """
30
 
import itertools
31
 
 
32
30
from bzrlib import (
33
31
    xml5,
34
32
    graph as _mod_graph,
36
34
    )
37
35
""")
38
36
from bzrlib import (
 
37
    bzrdir,
39
38
    debug,
40
39
    errors,
41
40
    lockable_files,
51
50
    )
52
51
from bzrlib.decorators import needs_read_lock, needs_write_lock
53
52
from bzrlib.repository import (
 
53
    CommitBuilder,
54
54
    InterRepository,
 
55
    InterSameDataRepository,
 
56
    MetaDirVersionedFileRepository,
 
57
    MetaDirRepositoryFormat,
 
58
    Repository,
55
59
    RepositoryFormat,
56
60
    )
57
61
from bzrlib.store.text import TextStore
60
64
    FulltextContentFactory,
61
65
    VersionedFiles,
62
66
    )
63
 
from bzrlib.vf_repository import (
64
 
    InterSameDataRepository,
65
 
    VersionedFileCommitBuilder,
66
 
    VersionedFileRepository,
67
 
    VersionedFileRepositoryFormat,
68
 
    MetaDirVersionedFileRepository,
69
 
    MetaDirVersionedFileRepositoryFormat,
70
 
    )
71
 
 
72
 
from bzrlib.plugins.weave_fmt import bzrdir as weave_bzrdir
73
 
 
74
 
 
75
 
class AllInOneRepository(VersionedFileRepository):
 
67
 
 
68
 
 
69
class AllInOneRepository(Repository):
76
70
    """Legacy support - the repository behaviour for all-in-one branches."""
77
71
 
78
72
    @property
150
144
 
151
145
    def get_commit_builder(self, branch, parents, config, timestamp=None,
152
146
                           timezone=None, committer=None, revprops=None,
153
 
                           revision_id=None, lossy=False):
 
147
                           revision_id=None):
154
148
        self._check_ascii_revisionid(revision_id, self.get_commit_builder)
155
 
        result = VersionedFileCommitBuilder(self, parents, config, timestamp,
156
 
            timezone, committer, revprops, revision_id, lossy=lossy)
 
149
        result = CommitBuilder(self, parents, config, timestamp, timezone,
 
150
                              committer, revprops, revision_id)
157
151
        self.start_write_group()
158
152
        return result
159
153
 
193
187
        """Returns the policy for making working trees on new branches."""
194
188
        return True
195
189
 
 
190
    def revision_graph_can_have_wrong_parents(self):
 
191
        # XXX: This is an old format that we don't support full checking on, so
 
192
        # just claim that checking for this inconsistency is not required.
 
193
        return False
 
194
 
196
195
 
197
196
class WeaveMetaDirRepository(MetaDirVersionedFileRepository):
198
197
    """A subclass of MetaDirRepository to set weave specific policy."""
239
238
 
240
239
    def get_commit_builder(self, branch, parents, config, timestamp=None,
241
240
                           timezone=None, committer=None, revprops=None,
242
 
                           revision_id=None, lossy=False):
 
241
                           revision_id=None):
243
242
        self._check_ascii_revisionid(revision_id, self.get_commit_builder)
244
 
        result = VersionedFileCommitBuilder(self, parents, config, timestamp,
245
 
            timezone, committer, revprops, revision_id, lossy=lossy)
 
243
        result = CommitBuilder(self, parents, config, timestamp, timezone,
 
244
                              committer, revprops, revision_id)
246
245
        self.start_write_group()
247
246
        return result
248
247
 
263
262
        return self.inventories.add_lines((revision_id,), final_parents, lines,
264
263
            check_content=check_content)[0]
265
264
 
266
 
 
267
 
class PreSplitOutRepositoryFormat(VersionedFileRepositoryFormat):
 
265
    def revision_graph_can_have_wrong_parents(self):
 
266
        return False
 
267
 
 
268
 
 
269
class PreSplitOutRepositoryFormat(RepositoryFormat):
268
270
    """Base class for the pre split out repository formats."""
269
271
 
270
272
    rich_root_data = False
272
274
    supports_ghosts = False
273
275
    supports_external_lookups = False
274
276
    supports_chks = False
275
 
    supports_nesting_repositories = True
276
277
    _fetch_order = 'topological'
277
278
    _fetch_reconcile = True
278
279
    fast_deltas = False
279
 
    supports_leaving_lock = False
280
 
    # XXX: This is an old format that we don't support full checking on, so
281
 
    # just claim that checking for this inconsistency is not required.
282
 
    revision_graph_can_have_wrong_parents = False
283
280
 
284
281
    def initialize(self, a_bzrdir, shared=False, _internal=False):
285
282
        """Create a weave repository."""
331
328
        result.chk_bytes = None
332
329
        return result
333
330
 
334
 
    def is_deprecated(self):
335
 
        return True
336
 
 
337
331
 
338
332
class RepositoryFormat4(PreSplitOutRepositoryFormat):
339
333
    """Bzr repository format 4.
349
343
 
350
344
    supports_funky_characters = False
351
345
 
352
 
    _matchingbzrdir = weave_bzrdir.BzrDirFormat4()
 
346
    _matchingbzrdir = bzrdir.BzrDirFormat4()
353
347
 
354
348
    def get_format_description(self):
355
349
        """See RepositoryFormat.get_format_description()."""
373
367
        return None
374
368
 
375
369
    def _get_revisions(self, repo_transport, repo):
376
 
        from bzrlib.plugins.weave_fmt.xml4 import serializer_v4
 
370
        from bzrlib.xml4 import serializer_v4
377
371
        return RevisionTextStore(repo_transport.clone('revision-store'),
378
372
            serializer_v4, True, versionedfile.PrefixMapper(),
379
373
            repo.is_locked, repo.is_write_locked)
397
391
    """
398
392
 
399
393
    _versionedfile_class = weave.WeaveFile
400
 
    _matchingbzrdir = weave_bzrdir.BzrDirFormat5()
 
394
    _matchingbzrdir = bzrdir.BzrDirFormat5()
401
395
    supports_funky_characters = False
402
396
 
403
397
    @property
444
438
    """
445
439
 
446
440
    _versionedfile_class = weave.WeaveFile
447
 
    _matchingbzrdir = weave_bzrdir.BzrDirFormat6()
 
441
    _matchingbzrdir = bzrdir.BzrDirFormat6()
448
442
    supports_funky_characters = False
449
443
    @property
450
444
    def _serializer(self):
480
474
            weave.WeaveFile, mapper, repo.is_locked)
481
475
 
482
476
 
483
 
class RepositoryFormat7(MetaDirVersionedFileRepositoryFormat):
 
477
class RepositoryFormat7(MetaDirRepositoryFormat):
484
478
    """Bzr repository 7.
485
479
 
486
480
    This repository format has:
496
490
    supports_ghosts = False
497
491
    supports_chks = False
498
492
    supports_funky_characters = False
499
 
    revision_graph_can_have_wrong_parents = False
500
493
 
501
494
    _fetch_order = 'topological'
502
495
    _fetch_reconcile = True
579
572
        result._transport = repo_transport
580
573
        return result
581
574
 
582
 
    def is_deprecated(self):
583
 
        return True
584
 
 
585
575
 
586
576
class TextVersionedFiles(VersionedFiles):
587
577
    """Just-a-bunch-of-files based VersionedFile stores."""
633
623
                    record, record.get_bytes_as(record.storage_kind)))
634
624
                try:
635
625
                    self.add_lines(record.key, None, lines)
636
 
                except errors.RevisionAlreadyPresent:
 
626
                except RevisionAlreadyPresent:
637
627
                    pass
638
628
 
639
629
    def _load_text(self, key):
820
810
    @needs_read_lock
821
811
    def search_missing_revision_ids(self,
822
812
            revision_id=symbol_versioning.DEPRECATED_PARAMETER,
823
 
            find_ghosts=True, revision_ids=None, if_present_ids=None,
824
 
            limit=None):
 
813
            find_ghosts=True, revision_ids=None, if_present_ids=None):
825
814
        """See InterRepository.search_missing_revision_ids()."""
826
815
        # we want all revisions to satisfy revision_id in source.
827
816
        # but we don't want to stat every file here and there.
867
856
            # that against the revision records.
868
857
            result_set = set(
869
858
                self.source._eliminate_revisions_not_present(required_revisions))
870
 
        if limit is not None:
871
 
            topo_ordered = self.get_graph().iter_topo_order(result_set)
872
 
            result_set = set(itertools.islice(topo_ordered, limit))
873
859
        return self.source.revision_ids_to_search_result(result_set)
874
860
 
875
861
 
876
862
InterRepository.register_optimiser(InterWeaveRepo)
877
 
 
878
 
 
879
 
def get_extra_interrepo_test_combinations():
880
 
    from bzrlib.repofmt import knitrepo
881
 
    return [(InterRepository, RepositoryFormat5(),
882
 
        knitrepo.RepositoryFormatKnit3())]