1155
1155
_fmt = "Text did not match its checksum: %(msg)s"
1158
class KnitError(InternalBzrError):
1163
class KnitCorrupt(KnitError):
1165
_fmt = "Knit %(filename)s corrupt: %(how)s"
1167
def __init__(self, filename, how):
1168
KnitError.__init__(self)
1169
self.filename = filename
1173
class SHA1KnitCorrupt(KnitCorrupt):
1175
_fmt = ("Knit %(filename)s corrupt: sha-1 of reconstructed text does not "
1176
"match expected sha-1. key %(key)s expected sha %(expected)s actual "
1179
def __init__(self, filename, actual, expected, key, content):
1180
KnitError.__init__(self)
1181
self.filename = filename
1182
self.actual = actual
1183
self.expected = expected
1185
self.content = content
1188
class KnitDataStreamIncompatible(KnitError):
1189
# Not raised anymore, as we can convert data streams. In future we may
1190
# need it again for more exotic cases, so we're keeping it around for now.
1192
_fmt = "Cannot insert knit data stream of format \"%(stream_format)s\" into knit of format \"%(target_format)s\"."
1194
def __init__(self, stream_format, target_format):
1195
self.stream_format = stream_format
1196
self.target_format = target_format
1199
class KnitDataStreamUnknown(KnitError):
1200
# Indicates a data stream we don't know how to handle.
1202
_fmt = "Cannot parse knit data stream of format \"%(stream_format)s\"."
1204
def __init__(self, stream_format):
1205
self.stream_format = stream_format
1208
class KnitHeaderError(KnitError):
1210
_fmt = 'Knit header error: %(badline)r unexpected for file "%(filename)s".'
1212
def __init__(self, badline, filename):
1213
KnitError.__init__(self)
1214
self.badline = badline
1215
self.filename = filename
1217
class KnitIndexUnknownMethod(KnitError):
1218
"""Raised when we don't understand the storage method.
1220
Currently only 'fulltext' and 'line-delta' are supported.
1223
_fmt = ("Knit index %(filename)s does not have a known method"
1224
" in options: %(options)r")
1226
def __init__(self, filename, options):
1227
KnitError.__init__(self)
1228
self.filename = filename
1229
self.options = options
1232
1158
class RetryWithNewPacks(BzrError):
1233
1159
"""Raised when we realize that the packs on disk have changed.