90
90
_revision_store, control_store, text_store)
91
91
self._commit_builder_class = _commit_builder_class
92
92
self._serializer = _serializer
93
self._reconcile_fixes_text_parents = True
94
95
def _warn_if_deprecated(self):
95
96
# This class isn't deprecated
147
148
raise errors.NoSuchRevision(self, revision_id)
151
def get_data_stream(self, revision_ids):
152
"""See Repository.get_data_stream."""
153
item_keys = self.item_keys_introduced_by(revision_ids)
154
for knit_kind, file_id, versions in item_keys:
156
if knit_kind == 'file':
157
name = ('file', file_id)
158
knit = self.weave_store.get_weave_or_empty(
159
file_id, self.get_transaction())
160
elif knit_kind == 'inventory':
161
knit = self.get_inventory_weave()
162
elif knit_kind == 'revisions':
163
knit = self._revision_store.get_revision_file(
164
self.get_transaction())
165
elif knit_kind == 'signatures':
166
knit = self._revision_store.get_signature_file(
167
self.get_transaction())
169
raise AssertionError('Unknown knit kind %r' % (knit_kind,))
170
yield name, _get_stream_as_bytes(knit, versions)
173
def get_revision(self, revision_id):
174
"""Return the Revision object for a named revision"""
175
revision_id = osutils.safe_revision_id(revision_id)
176
return self.get_revision_reconcile(revision_id)
150
179
def get_revision_graph(self, revision_id=None):
151
180
"""Return a dictionary containing the revision graph.
240
269
def _make_parents_provider(self):
241
270
return _KnitParentsProvider(self._get_revision_vf())
272
def _find_inconsistent_revision_parents(self):
273
"""Find revisions with different parent lists in the revision object
274
and in the index graph.
276
:returns: an iterator yielding tuples of (revison-id, parents-in-index,
277
parents-in-revision).
279
assert self.is_locked()
280
vf = self._get_revision_vf()
281
for index_version in vf.versions():
282
parents_according_to_index = tuple(vf.get_parents_with_ghosts(
284
revision = self.get_revision(index_version)
285
parents_according_to_revision = tuple(revision.parent_ids)
286
if parents_according_to_index != parents_according_to_revision:
287
yield (index_version, parents_according_to_index,
288
parents_according_to_revision)
290
def _check_for_inconsistent_revision_parents(self):
291
inconsistencies = list(self._find_inconsistent_revision_parents())
293
raise errors.BzrCheckError(
294
"Revision knit has inconsistent parents.")
296
def revision_graph_can_have_wrong_parents(self):
297
# The revision.kndx could potentially claim a revision has a different
298
# parent to the revision text.
244
302
class RepositoryFormatKnit(MetaDirRepositoryFormat):
245
303
"""Bzr repository knit format (generalized).