57
59
def __repr__(self):
58
60
return 'KnitParentsProvider(%r)' % self._knit
62
@symbol_versioning.deprecated_method(symbol_versioning.one_one)
60
63
def get_parents(self, revision_ids):
62
for revision_id in revision_ids:
64
"""See graph._StackedParentsProvider.get_parents"""
65
parent_map = self.get_parent_map(revision_ids)
66
return [parent_map.get(r, None) for r in revision_ids]
68
def get_parent_map(self, keys):
69
"""See graph._StackedParentsProvider.get_parent_map"""
71
for revision_id in keys:
63
72
if revision_id == _mod_revision.NULL_REVISION:
73
parent_map[revision_id] = ()
67
parents = self._knit.get_parents_with_ghosts(revision_id)
77
self._knit.get_parents_with_ghosts(revision_id))
68
78
except errors.RevisionNotPresent:
71
81
if len(parents) == 0:
72
parents = [_mod_revision.NULL_REVISION]
73
parents_list.append(parents)
82
parents = (_mod_revision.NULL_REVISION,)
83
parent_map[revision_id] = parents
77
87
class KnitRepository(MetaDirRepository):
147
157
except errors.RevisionNotPresent:
148
158
raise errors.NoSuchRevision(self, revision_id)
160
@symbol_versioning.deprecated_method(symbol_versioning.one_two)
151
162
def get_data_stream(self, revision_ids):
152
"""See Repository.get_data_stream."""
153
item_keys = self.item_keys_introduced_by(revision_ids)
163
"""See Repository.get_data_stream.
165
Deprecated in 1.2 for get_data_stream_for_search.
167
search_result = self.revision_ids_to_search_result(set(revision_ids))
168
return self.get_data_stream_for_search(search_result)
171
def get_data_stream_for_search(self, search):
172
"""See Repository.get_data_stream_for_search."""
173
item_keys = self.item_keys_introduced_by(search.get_keys())
154
174
for knit_kind, file_id, versions in item_keys:
155
175
name = (knit_kind,)
156
176
if knit_kind == 'file':
256
276
return self._get_revision_vf()
278
def has_revisions(self, revision_ids):
279
"""See Repository.has_revisions()."""
281
transaction = self.get_transaction()
282
for revision_id in revision_ids:
283
if self._revision_store.has_revision_id(revision_id, transaction):
284
result.add(revision_id)
258
287
@needs_write_lock
259
288
def reconcile(self, other=None, thorough=False):
260
289
"""Reconcile this repository."""
459
488
class RepositoryFormatKnit3(RepositoryFormatKnit):
460
"""Bzr repository knit format 2.
489
"""Bzr repository knit format 3.
462
491
This repository format has:
463
492
- knits for file texts and inventory
503
532
return "Knit repository format 3"
535
class RepositoryFormatKnit4(RepositoryFormatKnit):
536
"""Bzr repository knit format 4.
538
This repository format has everything in format 3, except for
540
- knits for file texts and inventory
541
- hash subdirectory based stores.
542
- knits for revisions and signatures
543
- TextStores for revisions and signatures.
544
- a format marker of its own
545
- an optional 'shared-storage' flag
546
- an optional 'no-working-trees' flag
548
- support for recording full info about the tree root
551
repository_class = KnitRepository
552
_commit_builder_class = RootCommitBuilder
553
rich_root_data = True
554
supports_tree_reference = False
555
_serializer = xml6.serializer_v6
557
def _get_matching_bzrdir(self):
558
return bzrdir.format_registry.make_bzrdir('rich-root')
560
def _ignore_setting_bzrdir(self, format):
563
_matchingbzrdir = property(_get_matching_bzrdir, _ignore_setting_bzrdir)
565
def check_conversion_target(self, target_format):
566
if not target_format.rich_root_data:
567
raise errors.BadConversionTarget(
568
'Does not support rich root data.', target_format)
570
def get_format_string(self):
571
"""See RepositoryFormat.get_format_string()."""
572
return 'Bazaar Knit Repository Format 4 (bzr 1.0)\n'
574
def get_format_description(self):
575
"""See RepositoryFormat.get_format_description()."""
576
return "Knit repository format 4"
506
579
def _get_stream_as_bytes(knit, required_versions):
507
580
"""Generate a serialised data stream.