~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

resolve conflicts against trunk

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
 
30
32
from bzrlib import (
31
 
    bzrdir_weave,
32
33
    xml5,
33
34
    graph as _mod_graph,
34
35
    ui,
50
51
    )
51
52
from bzrlib.decorators import needs_read_lock, needs_write_lock
52
53
from bzrlib.repository import (
53
 
    CommitBuilder,
54
54
    InterRepository,
55
 
    InterSameDataRepository,
56
 
    MetaDirVersionedFileRepository,
57
 
    MetaDirRepositoryFormat,
58
 
    Repository,
59
55
    RepositoryFormat,
60
56
    )
61
57
from bzrlib.store.text import TextStore
64
60
    FulltextContentFactory,
65
61
    VersionedFiles,
66
62
    )
 
63
from bzrlib.vf_repository import (
 
64
    InterSameDataRepository,
 
65
    VersionedFileCommitBuilder,
 
66
    VersionedFileRepository,
 
67
    VersionedFileRepositoryFormat,
 
68
    MetaDirVersionedFileRepository,
 
69
    MetaDirVersionedFileRepositoryFormat,
 
70
    )
67
71
 
68
72
from bzrlib.plugins.weave_fmt import bzrdir as weave_bzrdir
69
73
 
70
74
 
71
 
class AllInOneRepository(Repository):
 
75
class AllInOneRepository(VersionedFileRepository):
72
76
    """Legacy support - the repository behaviour for all-in-one branches."""
73
77
 
74
78
    @property
146
150
 
147
151
    def get_commit_builder(self, branch, parents, config, timestamp=None,
148
152
                           timezone=None, committer=None, revprops=None,
149
 
                           revision_id=None):
 
153
                           revision_id=None, lossy=False):
150
154
        self._check_ascii_revisionid(revision_id, self.get_commit_builder)
151
 
        result = CommitBuilder(self, parents, config, timestamp, timezone,
152
 
                              committer, revprops, revision_id)
 
155
        result = VersionedFileCommitBuilder(self, parents, config, timestamp,
 
156
            timezone, committer, revprops, revision_id, lossy=lossy)
153
157
        self.start_write_group()
154
158
        return result
155
159
 
189
193
        """Returns the policy for making working trees on new branches."""
190
194
        return True
191
195
 
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
196
 
198
197
class WeaveMetaDirRepository(MetaDirVersionedFileRepository):
199
198
    """A subclass of MetaDirRepository to set weave specific policy."""
240
239
 
241
240
    def get_commit_builder(self, branch, parents, config, timestamp=None,
242
241
                           timezone=None, committer=None, revprops=None,
243
 
                           revision_id=None):
 
242
                           revision_id=None, lossy=False):
244
243
        self._check_ascii_revisionid(revision_id, self.get_commit_builder)
245
 
        result = CommitBuilder(self, parents, config, timestamp, timezone,
246
 
                              committer, revprops, revision_id)
 
244
        result = VersionedFileCommitBuilder(self, parents, config, timestamp,
 
245
            timezone, committer, revprops, revision_id, lossy=lossy)
247
246
        self.start_write_group()
248
247
        return result
249
248
 
264
263
        return self.inventories.add_lines((revision_id,), final_parents, lines,
265
264
            check_content=check_content)[0]
266
265
 
267
 
    def revision_graph_can_have_wrong_parents(self):
268
 
        return False
269
 
 
270
 
 
271
 
class PreSplitOutRepositoryFormat(RepositoryFormat):
 
266
 
 
267
class PreSplitOutRepositoryFormat(VersionedFileRepositoryFormat):
272
268
    """Base class for the pre split out repository formats."""
273
269
 
274
270
    rich_root_data = False
280
276
    _fetch_reconcile = True
281
277
    fast_deltas = False
282
278
    supports_leaving_lock = False
283
 
    supports_full_versioned_files = True
 
279
    # XXX: This is an old format that we don't support full checking on, so
 
280
    # just claim that checking for this inconsistency is not required.
 
281
    revision_graph_can_have_wrong_parents = False
284
282
 
285
283
    def initialize(self, a_bzrdir, shared=False, _internal=False):
286
284
        """Create a weave repository."""
434
432
        return versionedfile.ThunkedVersionedFiles(base_transport,
435
433
            weave.WeaveFile, mapper, repo.is_locked)
436
434
 
437
 
    def _get_extra_interrepo_test_combinations(self):
438
 
        from bzrlib.repofmt import knitrepo
439
 
        return [(InterRepository, RepositoryFormat5(),
440
 
            knitrepo.RepositoryFormatKnit3())]
441
 
 
442
435
 
443
436
class RepositoryFormat6(PreSplitOutRepositoryFormat):
444
437
    """Bzr control format 6.
486
479
            weave.WeaveFile, mapper, repo.is_locked)
487
480
 
488
481
 
489
 
class RepositoryFormat7(MetaDirRepositoryFormat):
 
482
class RepositoryFormat7(MetaDirVersionedFileRepositoryFormat):
490
483
    """Bzr repository 7.
491
484
 
492
485
    This repository format has:
502
495
    supports_ghosts = False
503
496
    supports_chks = False
504
497
    supports_funky_characters = False
505
 
    supports_full_versioned_files = True
 
498
    revision_graph_can_have_wrong_parents = False
506
499
 
507
500
    _fetch_order = 'topological'
508
501
    _fetch_reconcile = True
639
632
                    record, record.get_bytes_as(record.storage_kind)))
640
633
                try:
641
634
                    self.add_lines(record.key, None, lines)
642
 
                except RevisionAlreadyPresent:
 
635
                except errors.RevisionAlreadyPresent:
643
636
                    pass
644
637
 
645
638
    def _load_text(self, key):
826
819
    @needs_read_lock
827
820
    def search_missing_revision_ids(self,
828
821
            revision_id=symbol_versioning.DEPRECATED_PARAMETER,
829
 
            find_ghosts=True, revision_ids=None, if_present_ids=None):
 
822
            find_ghosts=True, revision_ids=None, if_present_ids=None,
 
823
            limit=None):
830
824
        """See InterRepository.search_missing_revision_ids()."""
831
825
        # we want all revisions to satisfy revision_id in source.
832
826
        # but we don't want to stat every file here and there.
872
866
            # that against the revision records.
873
867
            result_set = set(
874
868
                self.source._eliminate_revisions_not_present(required_revisions))
 
869
        if limit is not None:
 
870
            topo_ordered = self.get_graph().iter_topo_order(result_set)
 
871
            result_set = set(itertools.islice(topo_ordered, limit))
875
872
        return self.source.revision_ids_to_search_result(result_set)
876
873
 
877
874