634
634
def get_format_signature(self):
635
635
"""See VersionedFile.get_format_signature()."""
637
# delta_part = "delta"
639
# delta_part = "full"
640
640
if self.factory.annotated:
641
641
annotated_part = "annotated"
643
643
annotated_part = "plain"
644
return "knit-%s-%s" % (delta_part, annotated_part)
644
return "knit-%s" % (annotated_part,)
646
646
def get_graph_with_ghosts(self):
647
647
"""See VersionedFile.get_graph_with_ghosts()."""
690
690
:seealso: get_data_stream
692
692
if format != self.get_format_signature():
693
mutter('incompatible format signature inserting to %r', self)
693
694
raise KnitDataStreamIncompatible(
694
695
format, self.get_format_signature())
697
for version_id, options, length, parents in data_list:
698
if self.has_version(version_id):
699
# First check: the list of parents.
700
my_parents = self.get_parents_with_ghosts(version_id)
701
if my_parents != parents:
702
# XXX: KnitCorrupt is not quite the right exception here.
705
'parents list %r from data stream does not match '
706
'already recorded parents %r for %s'
707
% (parents, my_parents, version_id))
709
# Also check the SHA-1 of the fulltext this content will
711
raw_data = reader_callable(length)
712
my_fulltext_sha1 = self.get_sha1(version_id)
713
df, rec = self._data._parse_record_header(version_id, raw_data)
714
stream_fulltext_sha1 = rec[3]
715
if my_fulltext_sha1 != stream_fulltext_sha1:
716
# Actually, we don't know if it's this knit that's corrupt,
717
# or the data stream we're trying to insert.
719
self.filename, 'sha-1 does not match %s' % version_id)
721
self._add_raw_records(
722
[(version_id, options, parents, length)],
723
reader_callable(length))
695
730
# To avoid lots of small writes (and small reads from the
696
731
# reader_callable), we batch up the records to insert as we process the
697
732
# stream, rather than inserting them one-by-one. This means in the