335
634
class InaccessibleParent(PathError):
336
"""Parent not accessible given base %(base)s and relative path %(path)s"""
636
_fmt = ('Parent not accessible given base "%(base)s" and'
637
' relative path "%(path)s"')
338
639
def __init__(self, path, base):
339
640
PathError.__init__(self, path)
343
class NoRepositoryPresent(BzrNewError):
344
"""No repository present: %(path)r"""
644
class NoRepositoryPresent(BzrError):
646
_fmt = 'No repository present: "%(path)s"'
345
647
def __init__(self, bzrdir):
346
BzrNewError.__init__(self)
648
BzrError.__init__(self)
347
649
self.path = bzrdir.transport.clone('..').base
350
class FileInWrongBranch(BzrNewError):
351
"""File %(path)s in not in branch %(branch_base)s."""
652
class FileInWrongBranch(BzrError):
654
_fmt = 'File "%(path)s" in not in branch %(branch_base)s.'
353
656
def __init__(self, branch, path):
354
BzrNewError.__init__(self)
657
BzrError.__init__(self)
355
658
self.branch = branch
356
659
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."""
663
class UnsupportedFormatError(BzrError):
665
_fmt = "Unsupported branch format: %(format)s\nPlease run 'bzr upgrade'"
668
class UnknownFormatError(BzrError):
670
_fmt = "Unknown branch format: %(format)r"
673
class IncompatibleFormat(BzrError):
675
_fmt = "Format %(format)s is not compatible with .bzr version %(bzrdir)s."
371
677
def __init__(self, format, bzrdir_format):
372
BzrNewError.__init__(self)
678
BzrError.__init__(self)
373
679
self.format = format
374
680
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"""
683
class IncompatibleRepositories(BzrError):
685
_fmt = "Repository %(target)s is not compatible with repository"\
688
def __init__(self, source, target):
689
BzrError.__init__(self, target=target, source=source)
692
class IncompatibleRevision(BzrError):
694
_fmt = "Revision is not compatible with %(repo_format)s"
696
def __init__(self, repo_format):
697
BzrError.__init__(self)
698
self.repo_format = repo_format
701
class AlreadyVersionedError(BzrError):
702
"""Used when a path is expected not to be versioned, but it is."""
704
_fmt = "%(context_info)s%(path)s is already versioned."
706
def __init__(self, path, context_info=None):
707
"""Construct a new AlreadyVersionedError.
709
:param path: This is the path which is versioned,
710
which should be in a user friendly form.
711
:param context_info: If given, this is information about the context,
712
which could explain why this is expected to not be versioned.
714
BzrError.__init__(self)
716
if context_info is None:
717
self.context_info = ''
719
self.context_info = context_info + ". "
722
class NotVersionedError(BzrError):
723
"""Used when a path is expected to be versioned, but it is not."""
725
_fmt = "%(context_info)s%(path)s is not versioned."
727
def __init__(self, path, context_info=None):
728
"""Construct a new NotVersionedError.
730
:param path: This is the path which is not versioned,
731
which should be in a user friendly form.
732
:param context_info: If given, this is information about the context,
733
which could explain why this is expected to be versioned.
735
BzrError.__init__(self)
737
if context_info is None:
738
self.context_info = ''
740
self.context_info = context_info + ". "
743
class PathsNotVersionedError(BzrError):
744
"""Used when reporting several paths which are not versioned"""
746
_fmt = "Path(s) are not versioned: %(paths_as_string)s"
388
748
def __init__(self, paths):
389
749
from bzrlib.osutils import quotefn
390
BzrNewError.__init__(self)
750
BzrError.__init__(self)
391
751
self.paths = paths
392
752
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"""
755
class PathsDoNotExist(BzrError):
757
_fmt = "Path(s) do not exist: %(paths_as_string)s%(extra)s"
398
759
# used when reporting that paths are neither versioned nor in the working
401
def __init__(self, paths):
762
def __init__(self, paths, extra=None):
402
763
# circular import
403
764
from bzrlib.osutils import quotefn
404
BzrNewError.__init__(self)
765
BzrError.__init__(self)
405
766
self.paths = paths
406
767
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"""
769
self.extra = ': ' + str(extra)
774
class BadFileKindError(BzrError):
776
_fmt = 'Cannot operate on "%(filename)s" of unsupported kind "%(kind)s"'
778
def __init__(self, filename, kind):
779
BzrError.__init__(self, filename=filename, kind=kind)
782
class ForbiddenControlFileError(BzrError):
784
_fmt = 'Cannot operate on "%(filename)s" because it is a control file'
787
class LockError(InternalBzrError):
789
_fmt = "Lock error: %(msg)s"
419
791
# All exceptions from the lock/unlock functions should be from
420
792
# this exception class. They will be translated as necessary. The
421
793
# original exception is available as e.original_error
423
795
# New code should prefer to raise specific subclasses
424
796
def __init__(self, message):
425
self.message = message
797
# Python 2.5 uses a slot for StandardError.message,
798
# so use a different variable name. We now work around this in
799
# BzrError.__str__, but this member name is kept for compatability.
803
class LockActive(LockError):
805
_fmt = "The lock for '%(lock_description)s' is in use and cannot be broken."
807
internal_error = False
809
def __init__(self, lock_description):
810
self.lock_description = lock_description
428
813
class CommitNotPossible(LockError):
429
"""A commit was attempted but we do not have a write lock open."""
815
_fmt = "A commit was attempted but we do not have a write lock open."
430
817
def __init__(self):
434
821
class AlreadyCommitted(LockError):
435
"""A rollback was requested, but is not able to be accomplished."""
823
_fmt = "A rollback was requested, but is not able to be accomplished."
436
825
def __init__(self):
440
829
class ReadOnlyError(LockError):
441
"""A write attempt was made in a read only transaction on %(obj)s"""
831
_fmt = "A write attempt was made in a read only transaction on %(obj)s"
833
# TODO: There should also be an error indicating that you need a write
834
# lock and don't have any lock at all... mbp 20070226
442
836
def __init__(self, obj):
446
class OutSideTransaction(BzrNewError):
447
"""A transaction related operation was attempted after the transaction finished."""
840
class ReadOnlyLockError(LockError):
842
_fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
844
@symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
845
def __init__(self, fname, msg):
846
LockError.__init__(self, '')
851
class LockFailed(LockError):
853
internal_error = False
855
_fmt = "Cannot lock %(lock)s: %(why)s"
857
def __init__(self, lock, why):
858
LockError.__init__(self, '')
863
class OutSideTransaction(BzrError):
865
_fmt = ("A transaction related operation was attempted after"
866
" the transaction finished.")
450
869
class ObjectNotLocked(LockError):
451
"""%(obj)r is not locked"""
453
is_user_error = False
871
_fmt = "%(obj)r is not locked"
455
873
# this can indicate that any particular object is not locked; see also
456
874
# LockNotHeld which means that a particular *lock* object is not held by
851
1547
BzrError.__init__(self, message)
1550
class NoEmailInUsername(BzrError):
1552
_fmt = "%(username)r does not seem to contain a reasonable email address"
1554
def __init__(self, username):
1555
BzrError.__init__(self)
1556
self.username = username
854
1559
class SigningFailed(BzrError):
1561
_fmt = 'Failed to gpg sign data with command "%(command_line)s"'
855
1563
def __init__(self, command_line):
856
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
1564
BzrError.__init__(self, command_line=command_line)
860
1567
class WorkingTreeNotRevision(BzrError):
1569
_fmt = ("The working tree for %(basedir)s has changed since"
1570
" the last commit, but weave merge requires that it be"
861
1573
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"""
1574
BzrError.__init__(self, basedir=tree.basedir)
1577
class CantReprocessAndShowBase(BzrError):
1579
_fmt = ("Can't reprocess and show base, because reprocessing obscures "
1580
"the relationship of conflicting lines to the base")
1583
class GraphCycleError(BzrError):
1585
_fmt = "Cycle in graph %(graph)r"
874
1587
def __init__(self, graph):
875
BzrNewError.__init__(self)
1588
BzrError.__init__(self)
876
1589
self.graph = graph
879
class NotConflicted(BzrNewError):
880
"""File %(filename)s is not conflicted."""
1592
class WritingCompleted(InternalBzrError):
1594
_fmt = ("The MediumRequest '%(request)s' has already had finish_writing "
1595
"called upon it - accept bytes may not be called anymore.")
1597
def __init__(self, request):
1598
self.request = request
1601
class WritingNotComplete(InternalBzrError):
1603
_fmt = ("The MediumRequest '%(request)s' has not has finish_writing "
1604
"called upon it - until the write phase is complete no "
1605
"data may be read.")
1607
def __init__(self, request):
1608
self.request = request
1611
class NotConflicted(BzrError):
1613
_fmt = "File %(filename)s is not conflicted."
882
1615
def __init__(self, filename):
883
BzrNewError.__init__(self)
1616
BzrError.__init__(self)
884
1617
self.filename = filename
1620
class MediumNotConnected(InternalBzrError):
1622
_fmt = """The medium '%(medium)s' is not connected."""
1624
def __init__(self, medium):
1625
self.medium = medium
887
1628
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"""
1630
_fmt = "A decorating function has requested its original command be used."
1633
class NoBundleFound(BzrError):
1635
_fmt = 'No bundle was found in "%(filename)s".'
896
1637
def __init__(self, filename):
897
BzrNewError.__init__(self)
1638
BzrError.__init__(self)
898
1639
self.filename = filename
901
class BundleNotSupported(BzrNewError):
902
"""Unable to handle bundle version %(version)s: %(msg)s"""
1642
class BundleNotSupported(BzrError):
1644
_fmt = "Unable to handle bundle version %(version)s: %(msg)s"
903
1646
def __init__(self, version, msg):
904
BzrNewError.__init__(self)
1647
BzrError.__init__(self)
905
1648
self.version = version
909
class MissingText(BzrNewError):
910
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
1652
class MissingText(BzrError):
1654
_fmt = ("Branch %(base)s is missing revision"
1655
" %(text_revision)s of %(file_id)s")
912
1657
def __init__(self, branch, text_revision, file_id):
913
BzrNewError.__init__(self)
1658
BzrError.__init__(self)
914
1659
self.branch = branch
915
1660
self.base = branch.base
916
1661
self.text_revision = text_revision
917
1662
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.
1665
class DuplicateFileId(BzrError):
1667
_fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1669
def __init__(self, file_id, entry):
1670
BzrError.__init__(self)
1671
self.file_id = file_id
1675
class DuplicateKey(BzrError):
1677
_fmt = "Key %(key)s is already present in map"
1680
class DuplicateHelpPrefix(BzrError):
1682
_fmt = "The prefix %(prefix)s is in the help search path twice."
1684
def __init__(self, prefix):
1685
self.prefix = prefix
1688
class MalformedTransform(BzrError):
1690
_fmt = "Tree transform is malformed %(conflicts)r"
1693
class NoFinalPath(BzrError):
1695
_fmt = ("No final name for trans_id %(trans_id)r\n"
1696
"file-id: %(file_id)r\n"
1697
"root trans-id: %(root_trans_id)r\n")
1699
def __init__(self, trans_id, transform):
1700
self.trans_id = trans_id
1701
self.file_id = transform.final_file_id(trans_id)
1702
self.root_trans_id = transform.root
1705
class BzrBadParameter(InternalBzrError):
1707
_fmt = "Bad parameter: %(param)r"
1709
# This exception should never be thrown, but it is a base class for all
1710
# parameter-to-function errors.
934
1712
def __init__(self, param):
935
BzrNewError.__init__(self)
1713
BzrError.__init__(self)
936
1714
self.param = param
939
1717
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"""
1719
_fmt = "Parameter %(param)s is neither unicode nor utf8."
1722
class ReusingTransform(BzrError):
1724
_fmt = "Attempt to reuse a transform that has already been applied."
1727
class CantMoveRoot(BzrError):
1729
_fmt = "Moving the root directory is not supported at this time"
1732
class BzrMoveFailedError(BzrError):
1734
_fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1736
def __init__(self, from_path='', to_path='', extra=None):
1737
BzrError.__init__(self)
1739
self.extra = ': ' + str(extra)
1743
has_from = len(from_path) > 0
1744
has_to = len(to_path) > 0
1746
self.from_path = osutils.splitpath(from_path)[-1]
1751
self.to_path = osutils.splitpath(to_path)[-1]
1756
if has_from and has_to:
1757
self.operator = " =>"
1759
self.from_path = "from " + from_path
1761
self.operator = "to"
1763
self.operator = "file"
1766
class BzrRenameFailedError(BzrMoveFailedError):
1768
_fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
1770
def __init__(self, from_path, to_path, extra=None):
1771
BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1773
class BzrRemoveChangedFilesError(BzrError):
1774
"""Used when user is trying to remove changed files."""
1776
_fmt = ("Can't safely remove modified or unknown files:\n"
1777
"%(changes_as_text)s"
1778
"Use --keep to not delete them, or --force to delete them regardless.")
1780
def __init__(self, tree_delta):
1781
BzrError.__init__(self)
1782
self.changes_as_text = tree_delta.get_changes_as_text()
1783
#self.paths_as_string = '\n'.join(changed_files)
1784
#self.paths_as_string = '\n'.join([quotefn(p) for p in changed_files])
951
1787
class BzrBadParameterNotString(BzrBadParameter):
952
"""Parameter %(param)s is not a string or unicode string."""
1789
_fmt = "Parameter %(param)s is not a string or unicode string."
955
1792
class BzrBadParameterMissing(BzrBadParameter):
956
"""Parameter $(param)s is required but not present."""
1794
_fmt = "Parameter $(param)s is required but not present."
959
1797
class BzrBadParameterUnicode(BzrBadParameter):
960
"""Parameter %(param)s is unicode but only byte-strings are permitted."""
1799
_fmt = ("Parameter %(param)s is unicode but"
1800
" only byte-strings are permitted.")
963
1803
class BzrBadParameterContainsNewline(BzrBadParameter):
964
"""Parameter %(param)s contains a newline."""
967
class DependencyNotPresent(BzrNewError):
968
"""Unable to import library "%(library)s": %(error)s"""
1805
_fmt = "Parameter %(param)s contains a newline."
1808
class DependencyNotPresent(BzrError):
1810
_fmt = 'Unable to import library "%(library)s": %(error)s'
970
1812
def __init__(self, library, error):
971
BzrNewError.__init__(self, library=library, error=error)
1813
BzrError.__init__(self, library=library, error=error)
974
1816
class ParamikoNotPresent(DependencyNotPresent):
975
"""Unable to import paramiko (required for sftp support): %(error)s"""
1818
_fmt = "Unable to import paramiko (required for sftp support): %(error)s"
977
1820
def __init__(self, error):
978
1821
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."""
1824
class PointlessMerge(BzrError):
1826
_fmt = "Nothing to merge."
1829
class UninitializableFormat(BzrError):
1831
_fmt = "Format %(format)s cannot be initialised by this version of bzr."
988
1833
def __init__(self, format):
989
BzrNewError.__init__(self)
1834
BzrError.__init__(self)
990
1835
self.format = format
993
class BadConversionTarget(BzrNewError):
994
"""Cannot convert to format %(format)s. %(problem)s"""
1838
class BadConversionTarget(BzrError):
1840
_fmt = "Cannot convert to format %(format)s. %(problem)s"
996
1842
def __init__(self, problem, format):
997
BzrNewError.__init__(self)
1843
BzrError.__init__(self)
998
1844
self.problem = problem
999
1845
self.format = format
1002
class NoDiff(BzrNewError):
1003
"""Diff is not installed on this machine: %(msg)s"""
1848
class NoDiff(BzrError):
1850
_fmt = "Diff is not installed on this machine: %(msg)s"
1005
1852
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'."""
1853
BzrError.__init__(self, msg=msg)
1856
class NoDiff3(BzrError):
1858
_fmt = "Diff3 is not installed on this machine."
1861
class ExistingContent(BzrError):
1862
# Added in bzrlib 0.92, used by VersionedFile.add_lines.
1864
_fmt = "The content being inserted is already present."
1867
class ExistingLimbo(BzrError):
1869
_fmt = """This tree contains left-over files from a failed operation.
1870
Please examine %(limbo_dir)s to see if it contains any files you wish to
1871
keep, and delete it when you are done."""
1873
def __init__(self, limbo_dir):
1874
BzrError.__init__(self)
1875
self.limbo_dir = limbo_dir
1878
class ExistingPendingDeletion(BzrError):
1880
_fmt = """This tree contains left-over files from a failed operation.
1881
Please examine %(pending_deletion)s to see if it contains any files you
1882
wish to keep, and delete it when you are done."""
1884
def __init__(self, pending_deletion):
1885
BzrError.__init__(self, pending_deletion=pending_deletion)
1888
class ImmortalLimbo(BzrError):
1890
_fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
1891
Please examine %(limbo_dir)s to see if it contains any files you wish to
1892
keep, and delete it when you are done."""
1894
def __init__(self, limbo_dir):
1895
BzrError.__init__(self)
1896
self.limbo_dir = limbo_dir
1899
class ImmortalPendingDeletion(BzrError):
1901
_fmt = """Unable to delete transform temporary directory
1902
%(pending_deletion)s. Please examine %(pending_deletions)s to see if it
1903
contains any files you wish to keep, and delete it when you are done."""
1905
def __init__(self, pending_deletion):
1906
BzrError.__init__(self, pending_deletion=pending_deletion)
1909
class OutOfDateTree(BzrError):
1911
_fmt = "Working tree is out of date, please run 'bzr update'."
1036
1913
def __init__(self, tree):
1037
BzrNewError.__init__(self)
1914
BzrError.__init__(self)
1038
1915
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."""
1918
class PublicBranchOutOfDate(BzrError):
1920
_fmt = 'Public branch "%(public_location)s" lacks revision '\
1923
def __init__(self, public_location, revstring):
1924
import bzrlib.urlutils as urlutils
1925
public_location = urlutils.unescape_for_display(public_location,
1927
BzrError.__init__(self, public_location=public_location,
1928
revstring=revstring)
1931
class MergeModifiedFormatError(BzrError):
1933
_fmt = "Error in merge modified format"
1936
class ConflictFormatError(BzrError):
1938
_fmt = "Format error in conflict listings"
1941
class CorruptRepository(BzrError):
1943
_fmt = ("An error has been detected in the repository %(repo_path)s.\n"
1944
"Please run bzr reconcile on this repository.")
1053
1946
def __init__(self, repo):
1054
BzrNewError.__init__(self)
1947
BzrError.__init__(self)
1055
1948
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."""
1951
class UpgradeRequired(BzrError):
1953
_fmt = "To use this feature you must upgrade your branch at %(path)s."
1061
1955
def __init__(self, path):
1062
BzrNewError.__init__(self)
1956
BzrError.__init__(self)
1063
1957
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"""
1960
class LocalRequiresBoundBranch(BzrError):
1962
_fmt = "Cannot perform local-only commits on unbound branches."
1965
class MissingProgressBarFinish(BzrError):
1967
_fmt = "A nested progress bar was not 'finished' correctly."
1970
class InvalidProgressBarType(BzrError):
1972
_fmt = ("Environment variable BZR_PROGRESS_BAR='%(bar_type)s"
1973
" is not a supported type Select one of: %(valid_types)s")
1078
1975
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."""
1976
BzrError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1979
class UnsupportedOperation(BzrError):
1981
_fmt = ("The method %(mname)s is not supported on"
1982
" objects of type %(tname)s.")
1084
1984
def __init__(self, method, method_self):
1085
1985
self.method = method
1086
1986
self.mname = method.__name__
1087
1987
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"""
1990
class CannotSetRevisionId(UnsupportedOperation):
1991
"""Raised when a commit is attempting to set a revision id but cant."""
1994
class NonAsciiRevisionId(UnsupportedOperation):
1995
"""Raised when a commit is attempting to set a non-ascii revision id
2000
class BinaryFile(BzrError):
2002
_fmt = "File is binary but should be text."
2005
class IllegalPath(BzrError):
2007
_fmt = "The path %(path)s is not permitted on this platform"
1097
2009
def __init__(self, path):
1098
BzrNewError.__init__(self)
2010
BzrError.__init__(self)
1099
2011
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
2014
class TestamentMismatch(BzrError):
2016
_fmt = """Testament did not match expected value.
2017
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1107
2020
def __init__(self, revision_id, expected, measured):
1108
2021
self.revision_id = revision_id
1109
2022
self.expected = expected
1110
2023
self.measured = measured
1113
class NotABundle(BzrNewError):
1114
"""Not a bzr revision-bundle: %(text)r"""
2026
class NotABundle(BzrError):
2028
_fmt = "Not a bzr revision-bundle: %(text)r"
1116
2030
def __init__(self, text):
1117
BzrNewError.__init__(self)
2031
BzrError.__init__(self)
1118
2032
self.text = text
1121
class BadBundle(BzrNewError):
1122
"""Bad bzr revision-bundle: %(text)r"""
2035
class BadBundle(BzrError):
2037
_fmt = "Bad bzr revision-bundle: %(text)r"
1124
2039
def __init__(self, text):
1125
BzrNewError.__init__(self)
2040
BzrError.__init__(self)
1126
2041
self.text = text
1129
2044
class MalformedHeader(BadBundle):
1130
"""Malformed bzr revision-bundle header: %(text)r"""
1132
def __init__(self, text):
1133
BzrNewError.__init__(self)
2046
_fmt = "Malformed bzr revision-bundle header: %(text)r"
1137
2049
class MalformedPatches(BadBundle):
1138
"""Malformed patches in bzr revision-bundle: %(text)r"""
1140
def __init__(self, text):
1141
BzrNewError.__init__(self)
2051
_fmt = "Malformed patches in bzr revision-bundle: %(text)r"
1145
2054
class MalformedFooter(BadBundle):
1146
"""Malformed footer in bzr revision-bundle: %(text)r"""
1148
def __init__(self, text):
1149
BzrNewError.__init__(self)
2056
_fmt = "Malformed footer in bzr revision-bundle: %(text)r"
1153
2059
class UnsupportedEOLMarker(BadBundle):
1154
"""End of line marker was not \\n in bzr revision-bundle"""
2061
_fmt = "End of line marker was not \\n in bzr revision-bundle"
1156
2063
def __init__(self):
1157
BzrNewError.__init__(self)
1160
class BadInventoryFormat(BzrNewError):
1161
"""Root class for inventory serialization errors"""
2064
# XXX: BadBundle's constructor assumes there's explanatory text,
2065
# but for this there is not
2066
BzrError.__init__(self)
2069
class IncompatibleBundleFormat(BzrError):
2071
_fmt = "Bundle format %(bundle_format)s is incompatible with %(other)s"
2073
def __init__(self, bundle_format, other):
2074
BzrError.__init__(self)
2075
self.bundle_format = bundle_format
2079
class BadInventoryFormat(BzrError):
2081
_fmt = "Root class for inventory serialization errors"
1164
2084
class UnexpectedInventoryFormat(BadInventoryFormat):
1165
"""The inventory was not in the expected format:\n %(msg)s"""
2086
_fmt = "The inventory was not in the expected format:\n %(msg)s"
1167
2088
def __init__(self, msg):
1168
2089
BadInventoryFormat.__init__(self, msg=msg)
1171
class UnknownSSH(BzrNewError):
1172
"""Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
2092
class RootNotRich(BzrError):
2094
_fmt = """This operation requires rich root data storage"""
2097
class NoSmartMedium(InternalBzrError):
2099
_fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
2101
def __init__(self, transport):
2102
self.transport = transport
2105
class NoSmartServer(NotBranchError):
2107
_fmt = "No smart server available at %(url)s"
2109
def __init__(self, url):
2113
class UnknownSSH(BzrError):
2115
_fmt = "Unrecognised value for BZR_SSH environment variable: %(vendor)s"
1174
2117
def __init__(self, vendor):
1175
BzrNewError.__init__(self)
2118
BzrError.__init__(self)
1176
2119
self.vendor = vendor
1179
class GhostRevisionUnusableHere(BzrNewError):
1180
"""Ghost revision {%(revision_id)s} cannot be used here."""
2122
class SSHVendorNotFound(BzrError):
2124
_fmt = ("Don't know how to handle SSH connections."
2125
" Please set BZR_SSH environment variable.")
2128
class GhostRevisionUnusableHere(BzrError):
2130
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1182
2132
def __init__(self, revision_id):
1183
BzrNewError.__init__(self)
2133
BzrError.__init__(self)
1184
2134
self.revision_id = revision_id
2137
class IllegalUseOfScopeReplacer(InternalBzrError):
2139
_fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2140
" %(msg)s%(extra)s")
2142
def __init__(self, name, msg, extra=None):
2143
BzrError.__init__(self)
2147
self.extra = ': ' + str(extra)
2152
class InvalidImportLine(InternalBzrError):
2154
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
2156
def __init__(self, text, msg):
2157
BzrError.__init__(self)
2162
class ImportNameCollision(InternalBzrError):
2164
_fmt = ("Tried to import an object to the same name as"
2165
" an existing object. %(name)s")
2167
def __init__(self, name):
2168
BzrError.__init__(self)
2172
class NotAMergeDirective(BzrError):
2173
"""File starting with %(firstline)r is not a merge directive"""
2174
def __init__(self, firstline):
2175
BzrError.__init__(self, firstline=firstline)
2178
class NoMergeSource(BzrError):
2179
"""Raise if no merge source was specified for a merge directive"""
2181
_fmt = "A merge directive must provide either a bundle or a public"\
2185
class IllegalMergeDirectivePayload(BzrError):
2186
"""A merge directive contained something other than a patch or bundle"""
2188
_fmt = "Bad merge directive payload %(start)r"
2190
def __init__(self, start):
2195
class PatchVerificationFailed(BzrError):
2196
"""A patch from a merge directive could not be verified"""
2198
_fmt = "Preview patch does not match requested changes."
2201
class PatchMissing(BzrError):
2202
"""Raise a patch type was specified but no patch supplied"""
2204
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2206
def __init__(self, patch_type):
2207
BzrError.__init__(self)
2208
self.patch_type = patch_type
2211
class UnsupportedInventoryKind(BzrError):
2213
_fmt = """Unsupported entry kind %(kind)s"""
2215
def __init__(self, kind):
2219
class BadSubsumeSource(BzrError):
2221
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2223
def __init__(self, tree, other_tree, reason):
2225
self.other_tree = other_tree
2226
self.reason = reason
2229
class SubsumeTargetNeedsUpgrade(BzrError):
2231
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2233
def __init__(self, other_tree):
2234
self.other_tree = other_tree
2237
class BadReferenceTarget(InternalBzrError):
2239
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2242
def __init__(self, tree, other_tree, reason):
2244
self.other_tree = other_tree
2245
self.reason = reason
2248
class NoSuchTag(BzrError):
2250
_fmt = "No such tag: %(tag_name)s"
2252
def __init__(self, tag_name):
2253
self.tag_name = tag_name
2256
class TagsNotSupported(BzrError):
2258
_fmt = ("Tags not supported by %(branch)s;"
2259
" you may be able to use bzr upgrade --dirstate-tags.")
2261
def __init__(self, branch):
2262
self.branch = branch
2265
class TagAlreadyExists(BzrError):
2267
_fmt = "Tag %(tag_name)s already exists."
2269
def __init__(self, tag_name):
2270
self.tag_name = tag_name
2273
class MalformedBugIdentifier(BzrError):
2275
_fmt = "Did not understand bug identifier %(bug_id)s: %(reason)s"
2277
def __init__(self, bug_id, reason):
2278
self.bug_id = bug_id
2279
self.reason = reason
2282
class UnknownBugTrackerAbbreviation(BzrError):
2284
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2287
def __init__(self, abbreviation, branch):
2288
self.abbreviation = abbreviation
2289
self.branch = branch
2292
class UnexpectedSmartServerResponse(BzrError):
2294
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2296
def __init__(self, response_tuple):
2297
self.response_tuple = response_tuple
2300
class ContainerError(BzrError):
2301
"""Base class of container errors."""
2304
class UnknownContainerFormatError(ContainerError):
2306
_fmt = "Unrecognised container format: %(container_format)r"
2308
def __init__(self, container_format):
2309
self.container_format = container_format
2312
class UnexpectedEndOfContainerError(ContainerError):
2314
_fmt = "Unexpected end of container stream"
2317
class UnknownRecordTypeError(ContainerError):
2319
_fmt = "Unknown record type: %(record_type)r"
2321
def __init__(self, record_type):
2322
self.record_type = record_type
2325
class InvalidRecordError(ContainerError):
2327
_fmt = "Invalid record: %(reason)s"
2329
def __init__(self, reason):
2330
self.reason = reason
2333
class ContainerHasExcessDataError(ContainerError):
2335
_fmt = "Container has data after end marker: %(excess)r"
2337
def __init__(self, excess):
2338
self.excess = excess
2341
class DuplicateRecordNameError(ContainerError):
2343
_fmt = "Container has multiple records with the same name: %(name)s"
2345
def __init__(self, name):
2349
class NoDestinationAddress(InternalBzrError):
2351
_fmt = "Message does not have a destination address."
2354
class RepositoryDataStreamError(BzrError):
2356
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2358
def __init__(self, reason):
2359
self.reason = reason
2362
class SMTPError(BzrError):
2364
_fmt = "SMTP error: %(error)s"
2366
def __init__(self, error):
2370
class NoMessageSupplied(BzrError):
2372
_fmt = "No message supplied."
2375
class UnknownMailClient(BzrError):
2377
_fmt = "Unknown mail client: %(mail_client)s"
2379
def __init__(self, mail_client):
2380
BzrError.__init__(self, mail_client=mail_client)
2383
class MailClientNotFound(BzrError):
2385
_fmt = "Unable to find mail client with the following names:"\
2386
" %(mail_command_list_string)s"
2388
def __init__(self, mail_command_list):
2389
mail_command_list_string = ', '.join(mail_command_list)
2390
BzrError.__init__(self, mail_command_list=mail_command_list,
2391
mail_command_list_string=mail_command_list_string)
2393
class SMTPConnectionRefused(SMTPError):
2395
_fmt = "SMTP connection to %(host)s refused"
2397
def __init__(self, error, host):
2402
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2404
_fmt = "Please specify smtp_server. No server at default %(host)s."
2407
class BzrDirError(BzrError):
2409
def __init__(self, bzrdir):
2410
import bzrlib.urlutils as urlutils
2411
display_url = urlutils.unescape_for_display(bzrdir.root_transport.base,
2413
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2416
class AlreadyBranch(BzrDirError):
2418
_fmt = "'%(display_url)s' is already a branch."
2421
class AlreadyTree(BzrDirError):
2423
_fmt = "'%(display_url)s' is already a tree."
2426
class AlreadyCheckout(BzrDirError):
2428
_fmt = "'%(display_url)s' is already a checkout."
2431
class ReconfigurationNotSupported(BzrDirError):
2433
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2436
class NoBindLocation(BzrDirError):
2438
_fmt = "No location could be found to bind to at %(display_url)s."
2441
class UncommittedChanges(BzrError):
2443
_fmt = 'Working tree "%(display_url)s" has uncommitted changes.'
2445
def __init__(self, tree):
2446
import bzrlib.urlutils as urlutils
2447
display_url = urlutils.unescape_for_display(
2448
tree.bzrdir.root_transport.base, 'ascii')
2449
BzrError.__init__(self, tree=tree, display_url=display_url)