335
602
class InaccessibleParent(PathError):
336
"""Parent not accessible given base %(base)s and relative path %(path)s"""
604
_fmt = ("Parent not accessible given base %(base)s and"
605
" relative path %(path)s")
338
607
def __init__(self, path, base):
339
608
PathError.__init__(self, path)
343
class NoRepositoryPresent(BzrNewError):
344
"""No repository present: %(path)r"""
612
class NoRepositoryPresent(BzrError):
614
_fmt = "No repository present: %(path)r"
345
615
def __init__(self, bzrdir):
346
BzrNewError.__init__(self)
616
BzrError.__init__(self)
347
617
self.path = bzrdir.transport.clone('..').base
350
class FileInWrongBranch(BzrNewError):
351
"""File %(path)s in not in branch %(branch_base)s."""
620
class FileInWrongBranch(BzrError):
622
_fmt = "File %(path)s in not in branch %(branch_base)s."
353
624
def __init__(self, branch, path):
354
BzrNewError.__init__(self)
625
BzrError.__init__(self)
355
626
self.branch = branch
356
627
self.branch_base = branch.base
360
class UnsupportedFormatError(BzrNewError):
361
"""Unsupported branch format: %(format)s"""
364
class UnknownFormatError(BzrNewError):
365
"""Unknown branch format: %(format)r"""
368
class IncompatibleFormat(BzrNewError):
369
"""Format %(format)s is not compatible with .bzr version %(bzrdir)s."""
631
class UnsupportedFormatError(BzrError):
633
_fmt = "Unsupported branch format: %(format)s\nPlease run 'bzr upgrade'"
636
class UnknownFormatError(BzrError):
638
_fmt = "Unknown branch format: %(format)r"
641
class IncompatibleFormat(BzrError):
643
_fmt = "Format %(format)s is not compatible with .bzr version %(bzrdir)s."
371
645
def __init__(self, format, bzrdir_format):
372
BzrNewError.__init__(self)
646
BzrError.__init__(self)
373
647
self.format = format
374
648
self.bzrdir = bzrdir_format
377
class NotVersionedError(BzrNewError):
378
"""%(path)s is not versioned"""
379
def __init__(self, path):
380
BzrNewError.__init__(self)
384
class PathsNotVersionedError(BzrNewError):
385
# used when reporting several paths are not versioned
386
"""Path(s) are not versioned: %(paths_as_string)s"""
651
class IncompatibleRepositories(BzrError):
653
_fmt = "Repository %(target)s is not compatible with repository"\
656
def __init__(self, source, target):
657
BzrError.__init__(self, target=target, source=source)
660
class IncompatibleRevision(BzrError):
662
_fmt = "Revision is not compatible with %(repo_format)s"
664
def __init__(self, repo_format):
665
BzrError.__init__(self)
666
self.repo_format = repo_format
669
class AlreadyVersionedError(BzrError):
670
"""Used when a path is expected not to be versioned, but it is."""
672
_fmt = "%(context_info)s%(path)s is already versioned"
674
def __init__(self, path, context_info=None):
675
"""Construct a new AlreadyVersionedError.
677
:param path: This is the path which is versioned,
678
which should be in a user friendly form.
679
:param context_info: If given, this is information about the context,
680
which could explain why this is expected to not be versioned.
682
BzrError.__init__(self)
684
if context_info is None:
685
self.context_info = ''
687
self.context_info = context_info + ". "
690
class NotVersionedError(BzrError):
691
"""Used when a path is expected to be versioned, but it is not."""
693
_fmt = "%(context_info)s%(path)s is not versioned"
695
def __init__(self, path, context_info=None):
696
"""Construct a new NotVersionedError.
698
:param path: This is the path which is not versioned,
699
which should be in a user friendly form.
700
:param context_info: If given, this is information about the context,
701
which could explain why this is expected to be versioned.
703
BzrError.__init__(self)
705
if context_info is None:
706
self.context_info = ''
708
self.context_info = context_info + ". "
711
class PathsNotVersionedError(BzrError):
712
"""Used when reporting several paths which are not versioned"""
714
_fmt = "Path(s) are not versioned: %(paths_as_string)s"
388
716
def __init__(self, paths):
389
717
from bzrlib.osutils import quotefn
390
BzrNewError.__init__(self)
718
BzrError.__init__(self)
391
719
self.paths = paths
392
720
self.paths_as_string = ' '.join([quotefn(p) for p in paths])
395
class PathsDoNotExist(BzrNewError):
396
"""Path(s) do not exist: %(paths_as_string)s"""
723
class PathsDoNotExist(BzrError):
725
_fmt = "Path(s) do not exist: %(paths_as_string)s%(extra)s"
398
727
# used when reporting that paths are neither versioned nor in the working
401
def __init__(self, paths):
730
def __init__(self, paths, extra=None):
402
731
# circular import
403
732
from bzrlib.osutils import quotefn
404
BzrNewError.__init__(self)
733
BzrError.__init__(self)
405
734
self.paths = paths
406
735
self.paths_as_string = ' '.join([quotefn(p) for p in paths])
409
class BadFileKindError(BzrNewError):
410
"""Cannot operate on %(filename)s of unsupported kind %(kind)s"""
413
class ForbiddenControlFileError(BzrNewError):
414
"""Cannot operate on %(filename)s because it is a control file"""
417
class LockError(BzrNewError):
418
"""Lock error: %(message)s"""
737
self.extra = ': ' + str(extra)
742
class BadFileKindError(BzrError):
744
_fmt = 'Cannot operate on "%(filename)s" of unsupported kind "%(kind)s"'
746
def __init__(self, filename, kind):
747
BzrError.__init__(self, filename=filename, kind=kind)
750
class ForbiddenControlFileError(BzrError):
752
_fmt = "Cannot operate on %(filename)s because it is a control file"
755
class LockError(BzrError):
757
_fmt = "Lock error: %(msg)s"
759
internal_error = True
419
761
# All exceptions from the lock/unlock functions should be from
420
762
# this exception class. They will be translated as necessary. The
421
763
# original exception is available as e.original_error
423
765
# New code should prefer to raise specific subclasses
424
766
def __init__(self, message):
425
self.message = message
767
# Python 2.5 uses a slot for StandardError.message,
768
# so use a different variable name
769
# so it is exposed in self.__dict__
773
class LockActive(LockError):
775
_fmt = "The lock for '%(lock_description)s' is in use and cannot be broken."
777
internal_error = False
779
def __init__(self, lock_description):
780
self.lock_description = lock_description
428
783
class CommitNotPossible(LockError):
429
"""A commit was attempted but we do not have a write lock open."""
785
_fmt = "A commit was attempted but we do not have a write lock open."
430
787
def __init__(self):
434
791
class AlreadyCommitted(LockError):
435
"""A rollback was requested, but is not able to be accomplished."""
793
_fmt = "A rollback was requested, but is not able to be accomplished."
436
795
def __init__(self):
440
799
class ReadOnlyError(LockError):
441
"""A write attempt was made in a read only transaction on %(obj)s"""
801
_fmt = "A write attempt was made in a read only transaction on %(obj)s"
803
# TODO: There should also be an error indicating that you need a write
804
# lock and don't have any lock at all... mbp 20070226
442
806
def __init__(self, obj):
446
class OutSideTransaction(BzrNewError):
447
"""A transaction related operation was attempted after the transaction finished."""
810
class ReadOnlyLockError(LockError):
812
_fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
814
def __init__(self, fname, msg):
815
LockError.__init__(self, '')
820
class OutSideTransaction(BzrError):
822
_fmt = ("A transaction related operation was attempted after"
823
" the transaction finished.")
450
826
class ObjectNotLocked(LockError):
451
"""%(obj)r is not locked"""
453
is_user_error = False
828
_fmt = "%(obj)r is not locked"
455
830
# this can indicate that any particular object is not locked; see also
456
831
# LockNotHeld which means that a particular *lock* object is not held by
851
1491
BzrError.__init__(self, message)
1494
class NoEmailInUsername(BzrError):
1496
_fmt = "%(username)r does not seem to contain a reasonable email address"
1498
def __init__(self, username):
1499
BzrError.__init__(self)
1500
self.username = username
854
1503
class SigningFailed(BzrError):
1505
_fmt = "Failed to gpg sign data with command %(command_line)r"
855
1507
def __init__(self, command_line):
856
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
1508
BzrError.__init__(self, command_line=command_line)
860
1511
class WorkingTreeNotRevision(BzrError):
1513
_fmt = ("The working tree for %(basedir)s has changed since"
1514
" the last commit, but weave merge requires that it be"
861
1517
def __init__(self, tree):
862
BzrError.__init__(self, "The working tree for %s has changed since"
863
" last commit, but weave merge requires that it be"
864
" unchanged." % tree.basedir)
867
class CantReprocessAndShowBase(BzrNewError):
868
"""Can't reprocess and show base.
869
Reprocessing obscures relationship of conflicting lines to base."""
872
class GraphCycleError(BzrNewError):
873
"""Cycle in graph %(graph)r"""
1518
BzrError.__init__(self, basedir=tree.basedir)
1521
class CantReprocessAndShowBase(BzrError):
1523
_fmt = ("Can't reprocess and show base, because reprocessing obscures "
1524
"the relationship of conflicting lines to the base")
1527
class GraphCycleError(BzrError):
1529
_fmt = "Cycle in graph %(graph)r"
874
1531
def __init__(self, graph):
875
BzrNewError.__init__(self)
1532
BzrError.__init__(self)
876
1533
self.graph = graph
879
class NotConflicted(BzrNewError):
880
"""File %(filename)s is not conflicted."""
1536
class WritingCompleted(BzrError):
1538
_fmt = ("The MediumRequest '%(request)s' has already had finish_writing "
1539
"called upon it - accept bytes may not be called anymore.")
1541
internal_error = True
1543
def __init__(self, request):
1544
self.request = request
1547
class WritingNotComplete(BzrError):
1549
_fmt = ("The MediumRequest '%(request)s' has not has finish_writing "
1550
"called upon it - until the write phase is complete no "
1551
"data may be read.")
1553
internal_error = True
1555
def __init__(self, request):
1556
self.request = request
1559
class NotConflicted(BzrError):
1561
_fmt = "File %(filename)s is not conflicted."
882
1563
def __init__(self, filename):
883
BzrNewError.__init__(self)
1564
BzrError.__init__(self)
884
1565
self.filename = filename
1568
class MediumNotConnected(BzrError):
1570
_fmt = """The medium '%(medium)s' is not connected."""
1572
internal_error = True
1574
def __init__(self, medium):
1575
self.medium = medium
887
1578
class MustUseDecorated(Exception):
888
"""A decorating function has requested its original command be used.
890
This should never escape bzr, so does not need to be printable.
894
class NoBundleFound(BzrNewError):
895
"""No bundle was found in %(filename)s"""
1580
_fmt = "A decorating function has requested its original command be used."
1583
class NoBundleFound(BzrError):
1585
_fmt = "No bundle was found in %(filename)s"
896
1587
def __init__(self, filename):
897
BzrNewError.__init__(self)
1588
BzrError.__init__(self)
898
1589
self.filename = filename
901
class BundleNotSupported(BzrNewError):
902
"""Unable to handle bundle version %(version)s: %(msg)s"""
1592
class BundleNotSupported(BzrError):
1594
_fmt = "Unable to handle bundle version %(version)s: %(msg)s"
903
1596
def __init__(self, version, msg):
904
BzrNewError.__init__(self)
1597
BzrError.__init__(self)
905
1598
self.version = version
909
class MissingText(BzrNewError):
910
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
1602
class MissingText(BzrError):
1604
_fmt = ("Branch %(base)s is missing revision"
1605
" %(text_revision)s of %(file_id)s")
912
1607
def __init__(self, branch, text_revision, file_id):
913
BzrNewError.__init__(self)
1608
BzrError.__init__(self)
914
1609
self.branch = branch
915
1610
self.base = branch.base
916
1611
self.text_revision = text_revision
917
1612
self.file_id = file_id
920
class DuplicateKey(BzrNewError):
921
"""Key %(key)s is already present in map"""
924
class MalformedTransform(BzrNewError):
925
"""Tree transform is malformed %(conflicts)r"""
928
class BzrBadParameter(BzrNewError):
929
"""A bad parameter : %(param)s is not usable.
931
This exception should never be thrown, but it is a base class for all
932
parameter-to-function errors.
1614
class DuplicateFileId(BzrError):
1616
_fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1618
def __init__(self, file_id, entry):
1619
BzrError.__init__(self)
1620
self.file_id = file_id
1624
class DuplicateKey(BzrError):
1626
_fmt = "Key %(key)s is already present in map"
1629
class DuplicateHelpPrefix(BzrError):
1631
_fmt = "The prefix %(prefix)s is in the help search path twice."
1633
def __init__(self, prefix):
1634
self.prefix = prefix
1637
class MalformedTransform(BzrError):
1639
_fmt = "Tree transform is malformed %(conflicts)r"
1642
class NoFinalPath(BzrError):
1644
_fmt = ("No final name for trans_id %(trans_id)r\n"
1645
"file-id: %(file_id)r\n"
1646
"root trans-id: %(root_trans_id)r\n")
1648
def __init__(self, trans_id, transform):
1649
self.trans_id = trans_id
1650
self.file_id = transform.final_file_id(trans_id)
1651
self.root_trans_id = transform.root
1654
class BzrBadParameter(BzrError):
1656
_fmt = "Bad parameter: %(param)r"
1658
internal_error = True
1660
# This exception should never be thrown, but it is a base class for all
1661
# parameter-to-function errors.
934
1663
def __init__(self, param):
935
BzrNewError.__init__(self)
1664
BzrError.__init__(self)
936
1665
self.param = param
939
1668
class BzrBadParameterNotUnicode(BzrBadParameter):
940
"""Parameter %(param)s is neither unicode nor utf8."""
943
class ReusingTransform(BzrNewError):
944
"""Attempt to reuse a transform that has already been applied."""
947
class CantMoveRoot(BzrNewError):
948
"""Moving the root directory is not supported at this time"""
1670
_fmt = "Parameter %(param)s is neither unicode nor utf8."
1673
class ReusingTransform(BzrError):
1675
_fmt = "Attempt to reuse a transform that has already been applied."
1678
class CantMoveRoot(BzrError):
1680
_fmt = "Moving the root directory is not supported at this time"
1683
class BzrMoveFailedError(BzrError):
1685
_fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1687
def __init__(self, from_path='', to_path='', extra=None):
1688
BzrError.__init__(self)
1690
self.extra = ': ' + str(extra)
1694
has_from = len(from_path) > 0
1695
has_to = len(to_path) > 0
1697
self.from_path = osutils.splitpath(from_path)[-1]
1702
self.to_path = osutils.splitpath(to_path)[-1]
1707
if has_from and has_to:
1708
self.operator = " =>"
1710
self.from_path = "from " + from_path
1712
self.operator = "to"
1714
self.operator = "file"
1717
class BzrRenameFailedError(BzrMoveFailedError):
1719
_fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
1721
def __init__(self, from_path, to_path, extra=None):
1722
BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1724
class BzrRemoveChangedFilesError(BzrError):
1725
"""Used when user is trying to remove changed files."""
1727
_fmt = ("Can't remove changed or unknown files:\n%(changes_as_text)s"
1728
"Use --keep to not delete them, or --force to delete them regardless.")
1730
def __init__(self, tree_delta):
1731
BzrError.__init__(self)
1732
self.changes_as_text = tree_delta.get_changes_as_text()
1733
#self.paths_as_string = '\n'.join(changed_files)
1734
#self.paths_as_string = '\n'.join([quotefn(p) for p in changed_files])
951
1737
class BzrBadParameterNotString(BzrBadParameter):
952
"""Parameter %(param)s is not a string or unicode string."""
1739
_fmt = "Parameter %(param)s is not a string or unicode string."
955
1742
class BzrBadParameterMissing(BzrBadParameter):
956
"""Parameter $(param)s is required but not present."""
1744
_fmt = "Parameter $(param)s is required but not present."
959
1747
class BzrBadParameterUnicode(BzrBadParameter):
960
"""Parameter %(param)s is unicode but only byte-strings are permitted."""
1749
_fmt = ("Parameter %(param)s is unicode but"
1750
" only byte-strings are permitted.")
963
1753
class BzrBadParameterContainsNewline(BzrBadParameter):
964
"""Parameter %(param)s contains a newline."""
967
class DependencyNotPresent(BzrNewError):
968
"""Unable to import library "%(library)s": %(error)s"""
1755
_fmt = "Parameter %(param)s contains a newline."
1758
class DependencyNotPresent(BzrError):
1760
_fmt = 'Unable to import library "%(library)s": %(error)s'
970
1762
def __init__(self, library, error):
971
BzrNewError.__init__(self, library=library, error=error)
1763
BzrError.__init__(self, library=library, error=error)
974
1766
class ParamikoNotPresent(DependencyNotPresent):
975
"""Unable to import paramiko (required for sftp support): %(error)s"""
1768
_fmt = "Unable to import paramiko (required for sftp support): %(error)s"
977
1770
def __init__(self, error):
978
1771
DependencyNotPresent.__init__(self, 'paramiko', error)
981
class PointlessMerge(BzrNewError):
982
"""Nothing to merge."""
985
class UninitializableFormat(BzrNewError):
986
"""Format %(format)s cannot be initialised by this version of bzr."""
1774
class PointlessMerge(BzrError):
1776
_fmt = "Nothing to merge."
1779
class UninitializableFormat(BzrError):
1781
_fmt = "Format %(format)s cannot be initialised by this version of bzr."
988
1783
def __init__(self, format):
989
BzrNewError.__init__(self)
1784
BzrError.__init__(self)
990
1785
self.format = format
993
class BadConversionTarget(BzrNewError):
994
"""Cannot convert to format %(format)s. %(problem)s"""
1788
class BadConversionTarget(BzrError):
1790
_fmt = "Cannot convert to format %(format)s. %(problem)s"
996
1792
def __init__(self, problem, format):
997
BzrNewError.__init__(self)
1793
BzrError.__init__(self)
998
1794
self.problem = problem
999
1795
self.format = format
1002
class NoDiff(BzrNewError):
1003
"""Diff is not installed on this machine: %(msg)s"""
1798
class NoDiff(BzrError):
1800
_fmt = "Diff is not installed on this machine: %(msg)s"
1005
1802
def __init__(self, msg):
1006
BzrNewError.__init__(self, msg=msg)
1009
class NoDiff3(BzrNewError):
1010
"""Diff3 is not installed on this machine."""
1013
class ExistingLimbo(BzrNewError):
1014
"""This tree contains left-over files from a failed operation.
1015
Please examine %(limbo_dir)s to see if it contains any files you wish to
1016
keep, and delete it when you are done.
1018
def __init__(self, limbo_dir):
1019
BzrNewError.__init__(self)
1020
self.limbo_dir = limbo_dir
1023
class ImmortalLimbo(BzrNewError):
1024
"""Unable to delete transform temporary directory $(limbo_dir)s.
1025
Please examine %(limbo_dir)s to see if it contains any files you wish to
1026
keep, and delete it when you are done.
1028
def __init__(self, limbo_dir):
1029
BzrNewError.__init__(self)
1030
self.limbo_dir = limbo_dir
1033
class OutOfDateTree(BzrNewError):
1034
"""Working tree is out of date, please run 'bzr update'."""
1803
BzrError.__init__(self, msg=msg)
1806
class NoDiff3(BzrError):
1808
_fmt = "Diff3 is not installed on this machine."
1811
class ExistingLimbo(BzrError):
1813
_fmt = """This tree contains left-over files from a failed operation.
1814
Please examine %(limbo_dir)s to see if it contains any files you wish to
1815
keep, and delete it when you are done."""
1817
def __init__(self, limbo_dir):
1818
BzrError.__init__(self)
1819
self.limbo_dir = limbo_dir
1822
class ImmortalLimbo(BzrError):
1824
_fmt = """Unable to delete transform temporary directory $(limbo_dir)s.
1825
Please examine %(limbo_dir)s to see if it contains any files you wish to
1826
keep, and delete it when you are done."""
1828
def __init__(self, limbo_dir):
1829
BzrError.__init__(self)
1830
self.limbo_dir = limbo_dir
1833
class OutOfDateTree(BzrError):
1835
_fmt = "Working tree is out of date, please run 'bzr update'."
1036
1837
def __init__(self, tree):
1037
BzrNewError.__init__(self)
1838
BzrError.__init__(self)
1038
1839
self.tree = tree
1041
class MergeModifiedFormatError(BzrNewError):
1042
"""Error in merge modified format"""
1045
class ConflictFormatError(BzrNewError):
1046
"""Format error in conflict listings"""
1049
class CorruptRepository(BzrNewError):
1050
"""An error has been detected in the repository %(repo_path)s.
1051
Please run bzr reconcile on this repository."""
1842
class PublicBranchOutOfDate(BzrError):
1844
_fmt = 'Public branch "%(public_location)s" lacks revision '\
1847
def __init__(self, public_location, revstring):
1848
import bzrlib.urlutils as urlutils
1849
public_location = urlutils.unescape_for_display(public_location,
1851
BzrError.__init__(self, public_location=public_location,
1852
revstring=revstring)
1855
class MergeModifiedFormatError(BzrError):
1857
_fmt = "Error in merge modified format"
1860
class ConflictFormatError(BzrError):
1862
_fmt = "Format error in conflict listings"
1865
class CorruptRepository(BzrError):
1867
_fmt = ("An error has been detected in the repository %(repo_path)s.\n"
1868
"Please run bzr reconcile on this repository.")
1053
1870
def __init__(self, repo):
1054
BzrNewError.__init__(self)
1871
BzrError.__init__(self)
1055
1872
self.repo_path = repo.bzrdir.root_transport.base
1058
class UpgradeRequired(BzrNewError):
1059
"""To use this feature you must upgrade your branch at %(path)s."""
1875
class UpgradeRequired(BzrError):
1877
_fmt = "To use this feature you must upgrade your branch at %(path)s."
1061
1879
def __init__(self, path):
1062
BzrNewError.__init__(self)
1880
BzrError.__init__(self)
1063
1881
self.path = path
1066
class LocalRequiresBoundBranch(BzrNewError):
1067
"""Cannot perform local-only commits on unbound branches."""
1070
class MissingProgressBarFinish(BzrNewError):
1071
"""A nested progress bar was not 'finished' correctly."""
1074
class InvalidProgressBarType(BzrNewError):
1075
"""Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1076
Select one of: %(valid_types)s"""
1884
class LocalRequiresBoundBranch(BzrError):
1886
_fmt = "Cannot perform local-only commits on unbound branches."
1889
class MissingProgressBarFinish(BzrError):
1891
_fmt = "A nested progress bar was not 'finished' correctly."
1894
class InvalidProgressBarType(BzrError):
1896
_fmt = ("Environment variable BZR_PROGRESS_BAR='%(bar_type)s"
1897
" is not a supported type Select one of: %(valid_types)s")
1078
1899
def __init__(self, bar_type, valid_types):
1079
BzrNewError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1082
class UnsupportedOperation(BzrNewError):
1083
"""The method %(mname)s is not supported on objects of type %(tname)s."""
1900
BzrError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1903
class UnsupportedOperation(BzrError):
1905
_fmt = ("The method %(mname)s is not supported on"
1906
" objects of type %(tname)s.")
1084
1908
def __init__(self, method, method_self):
1085
1909
self.method = method
1086
1910
self.mname = method.__name__
1087
1911
self.tname = type(method_self).__name__
1090
class BinaryFile(BzrNewError):
1091
"""File is binary but should be text."""
1094
class IllegalPath(BzrNewError):
1095
"""The path %(path)s is not permitted on this platform"""
1914
class CannotSetRevisionId(UnsupportedOperation):
1915
"""Raised when a commit is attempting to set a revision id but cant."""
1918
class NonAsciiRevisionId(UnsupportedOperation):
1919
"""Raised when a commit is attempting to set a non-ascii revision id
1924
class BinaryFile(BzrError):
1926
_fmt = "File is binary but should be text."
1929
class IllegalPath(BzrError):
1931
_fmt = "The path %(path)s is not permitted on this platform"
1097
1933
def __init__(self, path):
1098
BzrNewError.__init__(self)
1934
BzrError.__init__(self)
1099
1935
self.path = path
1102
class TestamentMismatch(BzrNewError):
1103
"""Testament did not match expected value.
1104
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1938
class TestamentMismatch(BzrError):
1940
_fmt = """Testament did not match expected value.
1941
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1107
1944
def __init__(self, revision_id, expected, measured):
1108
1945
self.revision_id = revision_id
1109
1946
self.expected = expected
1110
1947
self.measured = measured
1113
class NotABundle(BzrNewError):
1114
"""Not a bzr revision-bundle: %(text)r"""
1950
class NotABundle(BzrError):
1952
_fmt = "Not a bzr revision-bundle: %(text)r"
1116
1954
def __init__(self, text):
1117
BzrNewError.__init__(self)
1955
BzrError.__init__(self)
1118
1956
self.text = text
1121
class BadBundle(BzrNewError):
1122
"""Bad bzr revision-bundle: %(text)r"""
1959
class BadBundle(BzrError):
1961
_fmt = "Bad bzr revision-bundle: %(text)r"
1124
1963
def __init__(self, text):
1125
BzrNewError.__init__(self)
1964
BzrError.__init__(self)
1126
1965
self.text = text
1129
1968
class MalformedHeader(BadBundle):
1130
"""Malformed bzr revision-bundle header: %(text)r"""
1132
def __init__(self, text):
1133
BzrNewError.__init__(self)
1970
_fmt = "Malformed bzr revision-bundle header: %(text)r"
1137
1973
class MalformedPatches(BadBundle):
1138
"""Malformed patches in bzr revision-bundle: %(text)r"""
1140
def __init__(self, text):
1141
BzrNewError.__init__(self)
1975
_fmt = "Malformed patches in bzr revision-bundle: %(text)r"
1145
1978
class MalformedFooter(BadBundle):
1146
"""Malformed footer in bzr revision-bundle: %(text)r"""
1148
def __init__(self, text):
1149
BzrNewError.__init__(self)
1980
_fmt = "Malformed footer in bzr revision-bundle: %(text)r"
1153
1983
class UnsupportedEOLMarker(BadBundle):
1154
"""End of line marker was not \\n in bzr revision-bundle"""
1985
_fmt = "End of line marker was not \\n in bzr revision-bundle"
1156
1987
def __init__(self):
1157
BzrNewError.__init__(self)
1160
class BadInventoryFormat(BzrNewError):
1161
"""Root class for inventory serialization errors"""
1988
# XXX: BadBundle's constructor assumes there's explanatory text,
1989
# but for this there is not
1990
BzrError.__init__(self)
1993
class IncompatibleBundleFormat(BzrError):
1995
_fmt = "Bundle format %(bundle_format)s is incompatible with %(other)s"
1997
def __init__(self, bundle_format, other):
1998
BzrError.__init__(self)
1999
self.bundle_format = bundle_format
2003
class BadInventoryFormat(BzrError):
2005
_fmt = "Root class for inventory serialization errors"
1164
2008
class UnexpectedInventoryFormat(BadInventoryFormat):
1165
"""The inventory was not in the expected format:\n %(msg)s"""
2010
_fmt = "The inventory was not in the expected format:\n %(msg)s"
1167
2012
def __init__(self, msg):
1168
2013
BadInventoryFormat.__init__(self, msg=msg)
1171
class UnknownSSH(BzrNewError):
1172
"""Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
2016
class RootNotRich(BzrError):
2018
_fmt = """This operation requires rich root data storage"""
2021
class NoSmartMedium(BzrError):
2023
_fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
2025
internal_error = True
2027
def __init__(self, transport):
2028
self.transport = transport
2031
class NoSmartServer(NotBranchError):
2033
_fmt = "No smart server available at %(url)s"
2035
def __init__(self, url):
2039
class UnknownSSH(BzrError):
2041
_fmt = "Unrecognised value for BZR_SSH environment variable: %(vendor)s"
1174
2043
def __init__(self, vendor):
1175
BzrNewError.__init__(self)
2044
BzrError.__init__(self)
1176
2045
self.vendor = vendor
1179
class GhostRevisionUnusableHere(BzrNewError):
1180
"""Ghost revision {%(revision_id)s} cannot be used here."""
2048
class SSHVendorNotFound(BzrError):
2050
_fmt = ("Don't know how to handle SSH connections."
2051
" Please set BZR_SSH environment variable.")
2054
class GhostRevisionUnusableHere(BzrError):
2056
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1182
2058
def __init__(self, revision_id):
1183
BzrNewError.__init__(self)
2059
BzrError.__init__(self)
1184
2060
self.revision_id = revision_id
2063
class IllegalUseOfScopeReplacer(BzrError):
2065
_fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2066
" %(msg)s%(extra)s")
2068
internal_error = True
2070
def __init__(self, name, msg, extra=None):
2071
BzrError.__init__(self)
2075
self.extra = ': ' + str(extra)
2080
class InvalidImportLine(BzrError):
2082
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
2084
internal_error = True
2086
def __init__(self, text, msg):
2087
BzrError.__init__(self)
2092
class ImportNameCollision(BzrError):
2094
_fmt = ("Tried to import an object to the same name as"
2095
" an existing object. %(name)s")
2097
internal_error = True
2099
def __init__(self, name):
2100
BzrError.__init__(self)
2104
class NotAMergeDirective(BzrError):
2105
"""File starting with %(firstline)r is not a merge directive"""
2106
def __init__(self, firstline):
2107
BzrError.__init__(self, firstline=firstline)
2110
class NoMergeSource(BzrError):
2111
"""Raise if no merge source was specified for a merge directive"""
2113
_fmt = "A merge directive must provide either a bundle or a public"\
2117
class PatchMissing(BzrError):
2118
"""Raise a patch type was specified but no patch supplied"""
2120
_fmt = "patch_type was %(patch_type)s, but no patch was supplied."
2122
def __init__(self, patch_type):
2123
BzrError.__init__(self)
2124
self.patch_type = patch_type
2127
class UnsupportedInventoryKind(BzrError):
2129
_fmt = """Unsupported entry kind %(kind)s"""
2131
def __init__(self, kind):
2135
class BadSubsumeSource(BzrError):
2137
_fmt = """Can't subsume %(other_tree)s into %(tree)s. %(reason)s"""
2139
def __init__(self, tree, other_tree, reason):
2141
self.other_tree = other_tree
2142
self.reason = reason
2145
class SubsumeTargetNeedsUpgrade(BzrError):
2147
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2149
def __init__(self, other_tree):
2150
self.other_tree = other_tree
2153
class BadReferenceTarget(BzrError):
2155
_fmt = "Can't add reference to %(other_tree)s into %(tree)s. %(reason)s"
2157
internal_error = True
2159
def __init__(self, tree, other_tree, reason):
2161
self.other_tree = other_tree
2162
self.reason = reason
2165
class NoSuchTag(BzrError):
2167
_fmt = "No such tag: %(tag_name)s"
2169
def __init__(self, tag_name):
2170
self.tag_name = tag_name
2173
class TagsNotSupported(BzrError):
2175
_fmt = ("Tags not supported by %(branch)s;"
2176
" you may be able to use bzr upgrade --dirstate-tags.")
2178
def __init__(self, branch):
2179
self.branch = branch
2182
class TagAlreadyExists(BzrError):
2184
_fmt = "Tag %(tag_name)s already exists."
2186
def __init__(self, tag_name):
2187
self.tag_name = tag_name
2190
class MalformedBugIdentifier(BzrError):
2192
_fmt = "Did not understand bug identifier %(bug_id)s: %(reason)s"
2194
def __init__(self, bug_id, reason):
2195
self.bug_id = bug_id
2196
self.reason = reason
2199
class UnknownBugTrackerAbbreviation(BzrError):
2201
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2204
def __init__(self, abbreviation, branch):
2205
self.abbreviation = abbreviation
2206
self.branch = branch
2209
class UnexpectedSmartServerResponse(BzrError):
2211
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2213
def __init__(self, response_tuple):
2214
self.response_tuple = response_tuple
2217
class ContainerError(BzrError):
2218
"""Base class of container errors."""
2221
class UnknownContainerFormatError(ContainerError):
2223
_fmt = "Unrecognised container format: %(container_format)r"
2225
def __init__(self, container_format):
2226
self.container_format = container_format
2229
class UnexpectedEndOfContainerError(ContainerError):
2231
_fmt = "Unexpected end of container stream"
2233
internal_error = False
2236
class UnknownRecordTypeError(ContainerError):
2238
_fmt = "Unknown record type: %(record_type)r"
2240
def __init__(self, record_type):
2241
self.record_type = record_type
2244
class InvalidRecordError(ContainerError):
2246
_fmt = "Invalid record: %(reason)s"
2248
def __init__(self, reason):
2249
self.reason = reason
2252
class ContainerHasExcessDataError(ContainerError):
2254
_fmt = "Container has data after end marker: %(excess)r"
2256
def __init__(self, excess):
2257
self.excess = excess
2260
class DuplicateRecordNameError(ContainerError):
2262
_fmt = "Container has multiple records with the same name: \"%(name)s\""
2264
def __init__(self, name):
2268
class NoDestinationAddress(BzrError):
2270
_fmt = "Message does not have a destination address."
2272
internal_error = True
2275
class SMTPError(BzrError):
2277
_fmt = "SMTP error: %(error)s"
2279
def __init__(self, error):