164
185
_fmt = "The tree builder is already building a tree."
167
class BzrCheckError(BzrError):
188
class BzrCheckError(InternalBzrError):
169
190
_fmt = "Internal check failed: %(message)s"
171
internal_error = True
173
192
def __init__(self, message):
174
193
BzrError.__init__(self)
175
194
self.message = message
178
class DisabledMethod(BzrError):
197
class DisabledMethod(InternalBzrError):
180
199
_fmt = "The smart server method '%(class_name)s' is disabled."
182
internal_error = True
184
201
def __init__(self, class_name):
185
202
BzrError.__init__(self)
186
203
self.class_name = class_name
189
class InvalidEntryName(BzrError):
206
class IncompatibleAPI(BzrError):
208
_fmt = 'The API for "%(api)s" is not compatible with "%(wanted)s". '\
209
'It supports versions "%(minimum)s" to "%(current)s".'
211
def __init__(self, api, wanted, minimum, current):
214
self.minimum = minimum
215
self.current = current
218
class InProcessTransport(BzrError):
220
_fmt = "The transport '%(transport)s' is only accessible within this " \
223
def __init__(self, transport):
224
self.transport = transport
227
class InvalidEntryName(InternalBzrError):
191
229
_fmt = "Invalid entry name: %(name)s"
193
internal_error = True
195
231
def __init__(self, name):
196
232
BzrError.__init__(self)
322
379
_fmt = "Error in command line options"
382
class BadIndexFormatSignature(BzrError):
384
_fmt = "%(value)s is not an index of type %(_type)s."
386
def __init__(self, value, _type):
387
BzrError.__init__(self)
392
class BadIndexData(BzrError):
394
_fmt = "Error in data for index %(value)s."
396
def __init__(self, value):
397
BzrError.__init__(self)
401
class BadIndexDuplicateKey(BzrError):
403
_fmt = "The key '%(key)s' is already in index '%(index)s'."
405
def __init__(self, key, index):
406
BzrError.__init__(self)
411
class BadIndexKey(BzrError):
413
_fmt = "The key '%(key)s' is not a valid key."
415
def __init__(self, key):
416
BzrError.__init__(self)
420
class BadIndexOptions(BzrError):
422
_fmt = "Could not parse options for index %(value)s."
424
def __init__(self, value):
425
BzrError.__init__(self)
429
class BadIndexValue(BzrError):
431
_fmt = "The value '%(value)s' is not a valid value."
433
def __init__(self, value):
434
BzrError.__init__(self)
325
438
class BadOptionValue(BzrError):
327
440
_fmt = """Bad value "%(value)s" for option "%(name)s"."""
379
497
class NotADirectory(PathError):
381
_fmt = "%(path)r is not a directory %(extra)s"
499
_fmt = '"%(path)s" is not a directory %(extra)s'
384
502
class NotInWorkingDirectory(PathError):
386
_fmt = "%(path)r is not in the working directory %(extra)s"
504
_fmt = '"%(path)s" is not in the working directory %(extra)s'
389
507
class DirectoryNotEmpty(PathError):
391
_fmt = "Directory not empty: %(path)r%(extra)s"
394
class ReadingCompleted(BzrError):
509
_fmt = 'Directory not empty: "%(path)s"%(extra)s'
512
class HardLinkNotSupported(PathError):
514
_fmt = 'Hard-linking "%(path)s" is not supported'
517
class ReadingCompleted(InternalBzrError):
396
519
_fmt = ("The MediumRequest '%(request)s' has already had finish_reading "
397
520
"called upon it - the request has been completed and no more "
398
521
"data may be read.")
400
internal_error = True
402
523
def __init__(self, request):
403
524
self.request = request
406
527
class ResourceBusy(PathError):
408
_fmt = "Device or resource busy: %(path)r%(extra)s"
529
_fmt = 'Device or resource busy: "%(path)s"%(extra)s'
411
532
class PermissionDenied(PathError):
413
_fmt = "Permission denied: %(path)r%(extra)s"
534
_fmt = 'Permission denied: "%(path)s"%(extra)s'
416
537
class InvalidURL(PathError):
418
_fmt = "Invalid url supplied to transport: %(path)r%(extra)s"
539
_fmt = 'Invalid url supplied to transport: "%(path)s"%(extra)s'
421
542
class InvalidURLJoin(PathError):
423
_fmt = "Invalid URL join request: %(args)s%(extra)s"
544
_fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
425
546
def __init__(self, msg, base, args):
426
547
PathError.__init__(self, base, msg)
864
1021
_fmt = "Commit refused because there are unknowns in the tree."
867
class NoSuchRevision(BzrError):
869
_fmt = "Branch %(branch)s has no revision %(revision)s"
871
internal_error = True
1024
class NoSuchRevision(InternalBzrError):
1026
_fmt = "%(branch)s has no revision %(revision)s"
873
1028
def __init__(self, branch, revision):
1029
# 'branch' may sometimes be an internal object like a KnitRevisionStore
874
1030
BzrError.__init__(self, branch=branch, revision=revision)
877
class NotLeftParentDescendant(BzrError):
1033
# zero_ninetyone: this exception is no longer raised and should be removed
1034
class NotLeftParentDescendant(InternalBzrError):
879
1036
_fmt = ("Revision %(old_revision)s is not the left parent of"
880
1037
" %(new_revision)s, but branch %(branch_location)s expects this")
882
internal_error = True
884
1039
def __init__(self, branch, old_revision, new_revision):
885
1040
BzrError.__init__(self, branch_location=branch.base,
886
1041
old_revision=old_revision,
887
1042
new_revision=new_revision)
1045
class RangeInChangeOption(BzrError):
1047
_fmt = "Option --change does not accept revision ranges"
890
1050
class NoSuchRevisionSpec(BzrError):
892
1052
_fmt = "No namespace registered for string: %(spec)r"
1359
class KnitDataStreamIncompatible(KnitError):
1360
# Not raised anymore, as we can convert data streams. In future we may
1361
# need it again for more exotic cases, so we're keeping it around for now.
1363
_fmt = "Cannot insert knit data stream of format \"%(stream_format)s\" into knit of format \"%(target_format)s\"."
1365
def __init__(self, stream_format, target_format):
1366
self.stream_format = stream_format
1367
self.target_format = target_format
1370
class KnitDataStreamUnknown(KnitError):
1371
# Indicates a data stream we don't know how to handle.
1373
_fmt = "Cannot parse knit data stream of format \"%(stream_format)s\"."
1375
def __init__(self, stream_format):
1376
self.stream_format = stream_format
1379
class KnitHeaderError(KnitError):
1381
_fmt = 'Knit header error: %(badline)r unexpected for file "%(filename)s".'
1383
def __init__(self, badline, filename):
1384
KnitError.__init__(self)
1385
self.badline = badline
1386
self.filename = filename
1206
1388
class KnitIndexUnknownMethod(KnitError):
1207
1389
"""Raised when we don't understand the storage method.
2125
2382
def __init__(self, response_tuple):
2126
2383
self.response_tuple = response_tuple
2386
class ContainerError(BzrError):
2387
"""Base class of container errors."""
2390
class UnknownContainerFormatError(ContainerError):
2392
_fmt = "Unrecognised container format: %(container_format)r"
2394
def __init__(self, container_format):
2395
self.container_format = container_format
2398
class UnexpectedEndOfContainerError(ContainerError):
2400
_fmt = "Unexpected end of container stream"
2403
class UnknownRecordTypeError(ContainerError):
2405
_fmt = "Unknown record type: %(record_type)r"
2407
def __init__(self, record_type):
2408
self.record_type = record_type
2411
class InvalidRecordError(ContainerError):
2413
_fmt = "Invalid record: %(reason)s"
2415
def __init__(self, reason):
2416
self.reason = reason
2419
class ContainerHasExcessDataError(ContainerError):
2421
_fmt = "Container has data after end marker: %(excess)r"
2423
def __init__(self, excess):
2424
self.excess = excess
2427
class DuplicateRecordNameError(ContainerError):
2429
_fmt = "Container has multiple records with the same name: %(name)s"
2431
def __init__(self, name):
2435
class NoDestinationAddress(InternalBzrError):
2437
_fmt = "Message does not have a destination address."
2440
class RepositoryDataStreamError(BzrError):
2442
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2444
def __init__(self, reason):
2445
self.reason = reason
2448
class SMTPError(BzrError):
2450
_fmt = "SMTP error: %(error)s"
2452
def __init__(self, error):
2456
class NoMessageSupplied(BzrError):
2458
_fmt = "No message supplied."
2461
class NoMailAddressSpecified(BzrError):
2463
_fmt = "No mail-to address specified."
2466
class UnknownMailClient(BzrError):
2468
_fmt = "Unknown mail client: %(mail_client)s"
2470
def __init__(self, mail_client):
2471
BzrError.__init__(self, mail_client=mail_client)
2474
class MailClientNotFound(BzrError):
2476
_fmt = "Unable to find mail client with the following names:"\
2477
" %(mail_command_list_string)s"
2479
def __init__(self, mail_command_list):
2480
mail_command_list_string = ', '.join(mail_command_list)
2481
BzrError.__init__(self, mail_command_list=mail_command_list,
2482
mail_command_list_string=mail_command_list_string)
2484
class SMTPConnectionRefused(SMTPError):
2486
_fmt = "SMTP connection to %(host)s refused"
2488
def __init__(self, error, host):
2493
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2495
_fmt = "Please specify smtp_server. No server at default %(host)s."
2498
class BzrDirError(BzrError):
2500
def __init__(self, bzrdir):
2501
import bzrlib.urlutils as urlutils
2502
display_url = urlutils.unescape_for_display(bzrdir.root_transport.base,
2504
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2507
class AlreadyBranch(BzrDirError):
2509
_fmt = "'%(display_url)s' is already a branch."
2512
class AlreadyTree(BzrDirError):
2514
_fmt = "'%(display_url)s' is already a tree."
2517
class AlreadyCheckout(BzrDirError):
2519
_fmt = "'%(display_url)s' is already a checkout."
2522
class AlreadyLightweightCheckout(BzrDirError):
2524
_fmt = "'%(display_url)s' is already a lightweight checkout."
2527
class ReconfigurationNotSupported(BzrDirError):
2529
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2532
class NoBindLocation(BzrDirError):
2534
_fmt = "No location could be found to bind to at %(display_url)s."
2537
class UncommittedChanges(BzrError):
2539
_fmt = 'Working tree "%(display_url)s" has uncommitted changes.'
2541
def __init__(self, tree):
2542
import bzrlib.urlutils as urlutils
2543
display_url = urlutils.unescape_for_display(
2544
tree.bzrdir.root_transport.base, 'ascii')
2545
BzrError.__init__(self, tree=tree, display_url=display_url)
2548
class MissingTemplateVariable(BzrError):
2550
_fmt = 'Variable {%(name)s} is not available.'
2552
def __init__(self, name):
2556
class NoTemplate(BzrError):
2558
_fmt = 'No template specified.'
2561
class UnableCreateSymlink(BzrError):
2563
_fmt = 'Unable to create symlink %(path_str)son this platform'
2565
def __init__(self, path=None):
2569
path_str = repr(str(path))
2570
except UnicodeEncodeError:
2571
path_str = repr(path)
2573
self.path_str = path_str
2576
class UnsupportedTimezoneFormat(BzrError):
2578
_fmt = ('Unsupported timezone format "%(timezone)s", '
2579
'options are "utc", "original", "local".')
2581
def __init__(self, timezone):
2582
self.timezone = timezone
2585
class UnableEncodePath(BzrError):
2587
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2588
'user encoding %(user_encoding)s')
2590
def __init__(self, path, kind):
2593
self.user_encoding = osutils.get_user_encoding()