236
213
class UnsupportedFormatError(BzrError):
237
"""Specified path is a bzr branch that we recognize but cannot read."""
214
"""Specified path is a bzr branch that we cannot read."""
238
215
def __str__(self):
239
216
return 'unsupported branch format: %s' % self.args[0]
242
class UnknownFormatError(BzrError):
243
"""Specified path is a bzr branch whose format we do not recognize."""
245
return 'unknown branch format: %s' % self.args[0]
248
class IncompatibleFormat(BzrNewError):
249
"""Format %(format)s is not compatible with .bzr version %(bzrdir)s."""
251
def __init__(self, format, bzrdir_format):
252
BzrNewError.__init__(self)
254
self.bzrdir = bzrdir_format
257
219
class NotVersionedError(BzrNewError):
258
220
"""%(path)s is not versioned"""
259
221
def __init__(self, path):
271
233
"""Cannot operate on a file because it is a control file."""
274
class LockError(BzrNewError):
275
"""Lock error: %(message)s"""
236
class LockError(Exception):
276
238
# All exceptions from the lock/unlock functions should be from
277
239
# this exception class. They will be translated as necessary. The
278
240
# original exception is available as e.original_error
280
# New code should prefer to raise specific subclasses
281
def __init__(self, message):
282
self.message = message
285
243
class CommitNotPossible(LockError):
286
244
"""A commit was attempted but we do not have a write lock open."""
291
247
class AlreadyCommitted(LockError):
292
248
"""A rollback was requested, but is not able to be accomplished."""
297
251
class ReadOnlyError(LockError):
298
"""A write attempt was made in a read only transaction on %(obj)s"""
299
def __init__(self, obj):
303
class BranchNotLocked(LockError):
304
"""Branch %(branch)r is not locked"""
305
def __init__(self, branch):
306
# XXX: sometimes called with a LockableFiles instance not a Branch
310
class ReadOnlyObjectDirtiedError(ReadOnlyError):
311
"""Cannot change object %(obj)r in read only transaction"""
312
def __init__(self, obj):
316
class UnlockableTransport(LockError):
317
"""Cannot lock: transport is read only: %(transport)s"""
318
def __init__(self, transport):
319
self.transport = transport
322
class LockContention(LockError):
323
"""Could not acquire lock %(lock)s"""
324
# TODO: show full url for lock, combining the transport and relative bits?
325
def __init__(self, lock):
329
class LockBroken(LockError):
330
"""Lock was broken while still open: %(lock)s - check storage consistency!"""
331
def __init__(self, lock):
335
class LockBreakMismatch(LockError):
336
"""Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)r, wanted to break %(target)r"""
337
def __init__(self, lock, holder, target):
343
class LockNotHeld(LockError):
344
"""Lock not held: %(lock)s"""
345
def __init__(self, lock):
349
class BranchNotLocked(LockError):
350
"""Branch %(branch)r not locked"""
351
def __init__(self, branch):
252
"""A write attempt was made in a read only transaction."""
355
255
class PointlessCommit(BzrNewError):
356
256
"""No changes to commit"""
359
class UpgradeReadonly(BzrNewError):
360
"""Upgrade URL cannot work with readonly URL's."""
363
class UpToDateFormat(BzrNewError):
364
"""The branch format %(format)s is already at the most recent format."""
366
def __init__(self, format):
367
BzrNewError.__init__(self)
371
258
class StrictCommitFailed(Exception):
372
259
"""Commit refused because there are unknowns in the tree."""
401
288
BzrCommandError.__init__(self, msg)
404
290
class NoCommonAncestor(BzrError):
405
291
def __init__(self, revision_a, revision_b):
406
292
msg = "Revisions have no common ancestor: %s %s." \
407
293
% (revision_a, revision_b)
408
294
BzrError.__init__(self, msg)
411
296
class NoCommonRoot(BzrError):
412
297
def __init__(self, revision_a, revision_b):
413
298
msg = "Revisions are not derived from the same root: %s %s." \
414
299
% (revision_a, revision_b)
415
300
BzrError.__init__(self, msg)
418
302
class NotAncestor(BzrError):
419
303
def __init__(self, rev_id, not_ancestor_id):
420
304
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
489
370
"""Parents are mismatched between two revisions."""
492
class WeaveInvalidChecksum(WeaveError):
493
"""Text did not match it's checksum: %(message)s"""
496
class WeaveTextDiffers(WeaveError):
497
"""Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"""
499
def __init__(self, revision_id, weave_a, weave_b):
500
WeaveError.__init__(self)
501
self.revision_id = revision_id
502
self.weave_a = weave_a
503
self.weave_b = weave_b
506
class WeaveTextDiffers(WeaveError):
507
"""Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"""
509
def __init__(self, revision_id, weave_a, weave_b):
510
WeaveError.__init__(self)
511
self.revision_id = revision_id
512
self.weave_a = weave_a
513
self.weave_b = weave_b
516
373
class NoSuchExportFormat(BzrNewError):
517
374
"""Export format %(format)r not supported"""
518
375
def __init__(self, format):
567
421
(filename, ('\n'.join(e.message for e in errors)))
568
422
BzrError.__init__(self, message)
571
424
class SigningFailed(BzrError):
572
425
def __init__(self, command_line):
573
426
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
577
429
class WorkingTreeNotRevision(BzrError):
578
430
def __init__(self, tree):
579
431
BzrError.__init__(self, "The working tree for %s has changed since"
580
432
" last commit, but weave merge requires that it be"
581
433
" unchanged." % tree.basedir)
584
435
class CantReprocessAndShowBase(BzrNewError):
585
436
"""Can't reprocess and show base.
586
437
Reprocessing obscures relationship of conflicting lines to base."""
589
439
class GraphCycleError(BzrNewError):
590
440
"""Cycle in graph %(graph)r"""
591
441
def __init__(self, graph):
592
442
BzrNewError.__init__(self)
593
443
self.graph = graph
596
445
class NotConflicted(BzrNewError):
597
446
"""File %(filename)s is not conflicted."""
599
447
def __init__(self, filename):
600
448
BzrNewError.__init__(self)
601
449
self.filename = filename
604
451
class MustUseDecorated(Exception):
605
452
"""A decorating function has requested its original command be used.
607
454
This should never escape bzr, so does not need to be printable.
611
457
class MissingText(BzrNewError):
612
458
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
614
459
def __init__(self, branch, text_revision, file_id):
615
BzrNewError.__init__(self)
616
460
self.branch = branch
617
461
self.base = branch.base
618
462
self.text_revision = text_revision
619
463
self.file_id = file_id
621
class DuplicateKey(BzrNewError):
622
"""Key %(key)s is already present in map"""
624
class MalformedTransform(BzrNewError):
625
"""Tree transform is malformed %(conflicts)r"""
628
class BzrBadParameter(BzrNewError):
629
"""A bad parameter : %(param)s is not usable.
631
This exception should never be thrown, but it is a base class for all
632
parameter-to-function errors.
634
def __init__(self, param):
635
BzrNewError.__init__(self)
639
class BzrBadParameterNotUnicode(BzrBadParameter):
640
"""Parameter %(param)s is neither unicode nor utf8."""
643
class ReusingTransform(BzrNewError):
644
"""Attempt to reuse a transform that has already been applied."""
647
class CantMoveRoot(BzrNewError):
648
"""Moving the root directory is not supported at this time"""
651
class BzrBadParameterNotString(BzrBadParameter):
652
"""Parameter %(param)s is not a string or unicode string."""
655
class BzrBadParameterMissing(BzrBadParameter):
656
"""Parameter $(param)s is required but not present."""
659
class DependencyNotPresent(BzrNewError):
660
"""Unable to import library: %(library)s, %(error)s"""
662
def __init__(self, library, error):
663
BzrNewError.__init__(self, library=library, error=error)
666
class ParamikoNotPresent(DependencyNotPresent):
667
"""Unable to import paramiko (required for sftp support): %(error)s"""
669
def __init__(self, error):
670
DependencyNotPresent.__init__(self, 'paramiko', error)
673
class UninitializableFormat(BzrNewError):
674
"""Format %(format)s cannot be initialised by this version of bzr."""
676
def __init__(self, format):
677
BzrNewError.__init__(self)
681
class NoDiff3(BzrNewError):
682
"""Diff3 is not installed on this machine."""
685
class ExistingLimbo(BzrNewError):
686
"""This tree contains left-over files from a failed operation.
687
Please examine %(limbo_dir)s to see if it contains any files you wish to
688
keep, and delete it when you are done.
690
def __init__(self, limbo_dir):
691
BzrNewError.__init__(self)
692
self.limbo_dir = limbo_dir
695
class ImmortalLimbo(BzrNewError):
696
"""Unable to delete transform temporary directory $(limbo_dir)s.
697
Please examine %(limbo_dir)s to see if it contains any files you wish to
698
keep, and delete it when you are done.
700
def __init__(self, limbo_dir):
701
BzrNewError.__init__(self)
702
self.limbo_dir = limbo_dir
705
class OutOfDateTree(BzrNewError):
706
"""Working tree is out of date, please run 'bzr update'."""
708
def __init__(self, tree):
709
BzrNewError.__init__(self)