335
742
class InaccessibleParent(PathError):
336
"""Parent not accessible given base %(base)s and relative path %(path)s"""
744
_fmt = ('Parent not accessible given base "%(base)s" and'
745
' relative path "%(path)s"')
338
747
def __init__(self, path, base):
339
748
PathError.__init__(self, path)
343
class NoRepositoryPresent(BzrNewError):
344
"""No repository present: %(path)r"""
752
class NoRepositoryPresent(BzrError):
754
_fmt = 'No repository present: "%(path)s"'
345
755
def __init__(self, bzrdir):
346
BzrNewError.__init__(self)
756
BzrError.__init__(self)
347
757
self.path = bzrdir.transport.clone('..').base
350
class FileInWrongBranch(BzrNewError):
351
"""File %(path)s in not in branch %(branch_base)s."""
760
class FileInWrongBranch(BzrError):
762
_fmt = 'File "%(path)s" is not in branch %(branch_base)s.'
353
764
def __init__(self, branch, path):
354
BzrNewError.__init__(self)
765
BzrError.__init__(self)
355
766
self.branch = branch
356
767
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."""
771
class UnsupportedFormatError(BzrError):
773
_fmt = "Unsupported branch format: %(format)s\nPlease run 'bzr upgrade'"
776
class UnknownFormatError(BzrError):
778
_fmt = "Unknown %(kind)s format: %(format)r"
780
def __init__(self, format, kind='branch'):
785
class IncompatibleFormat(BzrError):
787
_fmt = "Format %(format)s is not compatible with .bzr version %(bzrdir)s."
371
789
def __init__(self, format, bzrdir_format):
372
BzrNewError.__init__(self)
790
BzrError.__init__(self)
373
791
self.format = format
374
792
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"""
795
class IncompatibleRepositories(BzrError):
796
"""Report an error that two repositories are not compatible.
798
Note that the source and target repositories are permitted to be strings:
799
this exception is thrown from the smart server and may refer to a
800
repository the client hasn't opened.
803
_fmt = "%(target)s\n" \
804
"is not compatible with\n" \
808
def __init__(self, source, target, details=None):
810
details = "(no details)"
811
BzrError.__init__(self, target=target, source=source, details=details)
814
class IncompatibleRevision(BzrError):
816
_fmt = "Revision is not compatible with %(repo_format)s"
818
def __init__(self, repo_format):
819
BzrError.__init__(self)
820
self.repo_format = repo_format
823
class AlreadyVersionedError(BzrError):
824
"""Used when a path is expected not to be versioned, but it is."""
826
_fmt = "%(context_info)s%(path)s is already versioned."
828
def __init__(self, path, context_info=None):
829
"""Construct a new AlreadyVersionedError.
831
:param path: This is the path which is versioned,
832
which should be in a user friendly form.
833
:param context_info: If given, this is information about the context,
834
which could explain why this is expected to not be versioned.
836
BzrError.__init__(self)
838
if context_info is None:
839
self.context_info = ''
841
self.context_info = context_info + ". "
844
class NotVersionedError(BzrError):
845
"""Used when a path is expected to be versioned, but it is not."""
847
_fmt = "%(context_info)s%(path)s is not versioned."
849
def __init__(self, path, context_info=None):
850
"""Construct a new NotVersionedError.
852
:param path: This is the path which is not versioned,
853
which should be in a user friendly form.
854
:param context_info: If given, this is information about the context,
855
which could explain why this is expected to be versioned.
857
BzrError.__init__(self)
859
if context_info is None:
860
self.context_info = ''
862
self.context_info = context_info + ". "
865
class PathsNotVersionedError(BzrError):
866
"""Used when reporting several paths which are not versioned"""
868
_fmt = "Path(s) are not versioned: %(paths_as_string)s"
388
870
def __init__(self, paths):
389
871
from bzrlib.osutils import quotefn
390
BzrNewError.__init__(self)
872
BzrError.__init__(self)
391
873
self.paths = paths
392
874
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"""
877
class PathsDoNotExist(BzrError):
879
_fmt = "Path(s) do not exist: %(paths_as_string)s%(extra)s"
398
881
# used when reporting that paths are neither versioned nor in the working
401
def __init__(self, paths):
884
def __init__(self, paths, extra=None):
402
885
# circular import
403
886
from bzrlib.osutils import quotefn
404
BzrNewError.__init__(self)
887
BzrError.__init__(self)
405
888
self.paths = paths
406
889
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"""
891
self.extra = ': ' + str(extra)
896
class BadFileKindError(BzrError):
898
_fmt = 'Cannot operate on "%(filename)s" of unsupported kind "%(kind)s"'
900
def __init__(self, filename, kind):
901
BzrError.__init__(self, filename=filename, kind=kind)
904
class BadFilenameEncoding(BzrError):
906
_fmt = ('Filename %(filename)r is not valid in your current filesystem'
907
' encoding %(fs_encoding)s')
909
def __init__(self, filename, fs_encoding):
910
BzrError.__init__(self)
911
self.filename = filename
912
self.fs_encoding = fs_encoding
915
class ForbiddenControlFileError(BzrError):
917
_fmt = 'Cannot operate on "%(filename)s" because it is a control file'
920
class LockError(InternalBzrError):
922
_fmt = "Lock error: %(msg)s"
419
924
# All exceptions from the lock/unlock functions should be from
420
925
# this exception class. They will be translated as necessary. The
421
926
# original exception is available as e.original_error
423
928
# New code should prefer to raise specific subclasses
424
929
def __init__(self, message):
425
self.message = message
930
# Python 2.5 uses a slot for StandardError.message,
931
# so use a different variable name. We now work around this in
932
# BzrError.__str__, but this member name is kept for compatability.
936
class LockActive(LockError):
938
_fmt = "The lock for '%(lock_description)s' is in use and cannot be broken."
940
internal_error = False
942
def __init__(self, lock_description):
943
self.lock_description = lock_description
428
946
class CommitNotPossible(LockError):
429
"""A commit was attempted but we do not have a write lock open."""
948
_fmt = "A commit was attempted but we do not have a write lock open."
430
950
def __init__(self):
434
954
class AlreadyCommitted(LockError):
435
"""A rollback was requested, but is not able to be accomplished."""
956
_fmt = "A rollback was requested, but is not able to be accomplished."
436
958
def __init__(self):
440
962
class ReadOnlyError(LockError):
441
"""A write attempt was made in a read only transaction on %(obj)s"""
964
_fmt = "A write attempt was made in a read only transaction on %(obj)s"
966
# TODO: There should also be an error indicating that you need a write
967
# lock and don't have any lock at all... mbp 20070226
442
969
def __init__(self, obj):
446
class OutSideTransaction(BzrNewError):
447
"""A transaction related operation was attempted after the transaction finished."""
973
class LockFailed(LockError):
975
internal_error = False
977
_fmt = "Cannot lock %(lock)s: %(why)s"
979
def __init__(self, lock, why):
980
LockError.__init__(self, '')
985
class OutSideTransaction(BzrError):
987
_fmt = ("A transaction related operation was attempted after"
988
" the transaction finished.")
450
991
class ObjectNotLocked(LockError):
451
"""%(obj)r is not locked"""
453
is_user_error = False
993
_fmt = "%(obj)r is not locked"
455
995
# this can indicate that any particular object is not locked; see also
456
996
# LockNotHeld which means that a particular *lock* object is not held by
824
1672
class InvalidHttpRange(InvalidHttpResponse):
825
"""Invalid http range "%(range)s" for %(path)s: %(msg)s"""
1674
_fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
827
1676
def __init__(self, path, range, msg):
828
1677
self.range = range
829
1678
InvalidHttpResponse.__init__(self, path, msg)
832
1681
class InvalidHttpContentType(InvalidHttpResponse):
833
"""Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s"""
1683
_fmt = 'Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s'
835
1685
def __init__(self, path, ctype, msg):
836
1686
self.ctype = ctype
837
1687
InvalidHttpResponse.__init__(self, path, msg)
1690
class RedirectRequested(TransportError):
1692
_fmt = '%(source)s is%(permanently)s redirected to %(target)s'
1694
def __init__(self, source, target, is_permanent=False):
1695
self.source = source
1696
self.target = target
1698
self.permanently = ' permanently'
1700
self.permanently = ''
1701
TransportError.__init__(self)
1704
class TooManyRedirections(TransportError):
1706
_fmt = "Too many redirections"
840
1709
class ConflictsInTree(BzrError):
842
BzrError.__init__(self, "Working tree has conflicts.")
1711
_fmt = "Working tree has conflicts."
845
1714
class ParseConfigError(BzrError):
846
1716
def __init__(self, errors, filename):
847
1717
if filename is None:
849
1719
message = "Error(s) parsing config file %s:\n%s" % \
850
(filename, ('\n'.join(e.message for e in errors)))
1720
(filename, ('\n'.join(e.msg for e in errors)))
851
1721
BzrError.__init__(self, message)
1724
class NoEmailInUsername(BzrError):
1726
_fmt = "%(username)r does not seem to contain a reasonable email address"
1728
def __init__(self, username):
1729
BzrError.__init__(self)
1730
self.username = username
854
1733
class SigningFailed(BzrError):
1735
_fmt = 'Failed to gpg sign data with command "%(command_line)s"'
855
1737
def __init__(self, command_line):
856
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
1738
BzrError.__init__(self, command_line=command_line)
860
1741
class WorkingTreeNotRevision(BzrError):
1743
_fmt = ("The working tree for %(basedir)s has changed since"
1744
" the last commit, but weave merge requires that it be"
861
1747
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"""
1748
BzrError.__init__(self, basedir=tree.basedir)
1751
class CantReprocessAndShowBase(BzrError):
1753
_fmt = ("Can't reprocess and show base, because reprocessing obscures "
1754
"the relationship of conflicting lines to the base")
1757
class GraphCycleError(BzrError):
1759
_fmt = "Cycle in graph %(graph)r"
874
1761
def __init__(self, graph):
875
BzrNewError.__init__(self)
1762
BzrError.__init__(self)
876
1763
self.graph = graph
879
class NotConflicted(BzrNewError):
880
"""File %(filename)s is not conflicted."""
1766
class WritingCompleted(InternalBzrError):
1768
_fmt = ("The MediumRequest '%(request)s' has already had finish_writing "
1769
"called upon it - accept bytes may not be called anymore.")
1771
def __init__(self, request):
1772
self.request = request
1775
class WritingNotComplete(InternalBzrError):
1777
_fmt = ("The MediumRequest '%(request)s' has not has finish_writing "
1778
"called upon it - until the write phase is complete no "
1779
"data may be read.")
1781
def __init__(self, request):
1782
self.request = request
1785
class NotConflicted(BzrError):
1787
_fmt = "File %(filename)s is not conflicted."
882
1789
def __init__(self, filename):
883
BzrNewError.__init__(self)
1790
BzrError.__init__(self)
884
1791
self.filename = filename
1794
class MediumNotConnected(InternalBzrError):
1796
_fmt = """The medium '%(medium)s' is not connected."""
1798
def __init__(self, medium):
1799
self.medium = medium
887
1802
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"""
1804
_fmt = "A decorating function has requested its original command be used."
1807
class NoBundleFound(BzrError):
1809
_fmt = 'No bundle was found in "%(filename)s".'
896
1811
def __init__(self, filename):
897
BzrNewError.__init__(self)
1812
BzrError.__init__(self)
898
1813
self.filename = filename
901
class BundleNotSupported(BzrNewError):
902
"""Unable to handle bundle version %(version)s: %(msg)s"""
1816
class BundleNotSupported(BzrError):
1818
_fmt = "Unable to handle bundle version %(version)s: %(msg)s"
903
1820
def __init__(self, version, msg):
904
BzrNewError.__init__(self)
1821
BzrError.__init__(self)
905
1822
self.version = version
909
class MissingText(BzrNewError):
910
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
1826
class MissingText(BzrError):
1828
_fmt = ("Branch %(base)s is missing revision"
1829
" %(text_revision)s of %(file_id)s")
912
1831
def __init__(self, branch, text_revision, file_id):
913
BzrNewError.__init__(self)
1832
BzrError.__init__(self)
914
1833
self.branch = branch
915
1834
self.base = branch.base
916
1835
self.text_revision = text_revision
917
1836
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.
1839
class DuplicateFileId(BzrError):
1841
_fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1843
def __init__(self, file_id, entry):
1844
BzrError.__init__(self)
1845
self.file_id = file_id
1849
class DuplicateKey(BzrError):
1851
_fmt = "Key %(key)s is already present in map"
1854
class DuplicateHelpPrefix(BzrError):
1856
_fmt = "The prefix %(prefix)s is in the help search path twice."
1858
def __init__(self, prefix):
1859
self.prefix = prefix
1862
class MalformedTransform(BzrError):
1864
_fmt = "Tree transform is malformed %(conflicts)r"
1867
class NoFinalPath(BzrError):
1869
_fmt = ("No final name for trans_id %(trans_id)r\n"
1870
"file-id: %(file_id)r\n"
1871
"root trans-id: %(root_trans_id)r\n")
1873
def __init__(self, trans_id, transform):
1874
self.trans_id = trans_id
1875
self.file_id = transform.final_file_id(trans_id)
1876
self.root_trans_id = transform.root
1879
class BzrBadParameter(InternalBzrError):
1881
_fmt = "Bad parameter: %(param)r"
1883
# This exception should never be thrown, but it is a base class for all
1884
# parameter-to-function errors.
934
1886
def __init__(self, param):
935
BzrNewError.__init__(self)
1887
BzrError.__init__(self)
936
1888
self.param = param
939
1891
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"""
1893
_fmt = "Parameter %(param)s is neither unicode nor utf8."
1896
class ReusingTransform(BzrError):
1898
_fmt = "Attempt to reuse a transform that has already been applied."
1901
class CantMoveRoot(BzrError):
1903
_fmt = "Moving the root directory is not supported at this time"
1906
class BzrMoveFailedError(BzrError):
1908
_fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1910
def __init__(self, from_path='', to_path='', extra=None):
1911
from bzrlib.osutils import splitpath
1912
BzrError.__init__(self)
1914
self.extra = ': ' + str(extra)
1918
has_from = len(from_path) > 0
1919
has_to = len(to_path) > 0
1921
self.from_path = splitpath(from_path)[-1]
1926
self.to_path = splitpath(to_path)[-1]
1931
if has_from and has_to:
1932
self.operator = " =>"
1934
self.from_path = "from " + from_path
1936
self.operator = "to"
1938
self.operator = "file"
1941
class BzrRenameFailedError(BzrMoveFailedError):
1943
_fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
1945
def __init__(self, from_path, to_path, extra=None):
1946
BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1948
class BzrRemoveChangedFilesError(BzrError):
1949
"""Used when user is trying to remove changed files."""
1951
_fmt = ("Can't safely remove modified or unknown files:\n"
1952
"%(changes_as_text)s"
1953
"Use --keep to not delete them, or --force to delete them regardless.")
1955
def __init__(self, tree_delta):
1956
BzrError.__init__(self)
1957
self.changes_as_text = tree_delta.get_changes_as_text()
1958
#self.paths_as_string = '\n'.join(changed_files)
1959
#self.paths_as_string = '\n'.join([quotefn(p) for p in changed_files])
951
1962
class BzrBadParameterNotString(BzrBadParameter):
952
"""Parameter %(param)s is not a string or unicode string."""
1964
_fmt = "Parameter %(param)s is not a string or unicode string."
955
1967
class BzrBadParameterMissing(BzrBadParameter):
956
"""Parameter $(param)s is required but not present."""
1969
_fmt = "Parameter $(param)s is required but not present."
959
1972
class BzrBadParameterUnicode(BzrBadParameter):
960
"""Parameter %(param)s is unicode but only byte-strings are permitted."""
1974
_fmt = ("Parameter %(param)s is unicode but"
1975
" only byte-strings are permitted.")
963
1978
class BzrBadParameterContainsNewline(BzrBadParameter):
964
"""Parameter %(param)s contains a newline."""
967
class DependencyNotPresent(BzrNewError):
968
"""Unable to import library "%(library)s": %(error)s"""
1980
_fmt = "Parameter %(param)s contains a newline."
1983
class DependencyNotPresent(BzrError):
1985
_fmt = 'Unable to import library "%(library)s": %(error)s'
970
1987
def __init__(self, library, error):
971
BzrNewError.__init__(self, library=library, error=error)
1988
BzrError.__init__(self, library=library, error=error)
974
1991
class ParamikoNotPresent(DependencyNotPresent):
975
"""Unable to import paramiko (required for sftp support): %(error)s"""
1993
_fmt = "Unable to import paramiko (required for sftp support): %(error)s"
977
1995
def __init__(self, error):
978
1996
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."""
1999
class PointlessMerge(BzrError):
2001
_fmt = "Nothing to merge."
2004
class UninitializableFormat(BzrError):
2006
_fmt = "Format %(format)s cannot be initialised by this version of bzr."
988
2008
def __init__(self, format):
989
BzrNewError.__init__(self)
2009
BzrError.__init__(self)
990
2010
self.format = format
993
class BadConversionTarget(BzrNewError):
994
"""Cannot convert to format %(format)s. %(problem)s"""
996
def __init__(self, problem, format):
997
BzrNewError.__init__(self)
2013
class BadConversionTarget(BzrError):
2015
_fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
2018
def __init__(self, problem, format, from_format=None):
2019
BzrError.__init__(self)
998
2020
self.problem = problem
999
2021
self.format = format
1002
class NoDiff(BzrNewError):
1003
"""Diff is not installed on this machine: %(msg)s"""
2022
self.from_format = from_format or '(unspecified)'
2025
class NoDiffFound(BzrError):
2027
_fmt = 'Could not find an appropriate Differ for file "%(path)s"'
2029
def __init__(self, path):
2030
BzrError.__init__(self, path)
2033
class ExecutableMissing(BzrError):
2035
_fmt = "%(exe_name)s could not be found on this machine"
2037
def __init__(self, exe_name):
2038
BzrError.__init__(self, exe_name=exe_name)
2041
class NoDiff(BzrError):
2043
_fmt = "Diff is not installed on this machine: %(msg)s"
1005
2045
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'."""
1036
def __init__(self, tree):
1037
BzrNewError.__init__(self)
2046
BzrError.__init__(self, msg=msg)
2049
class NoDiff3(BzrError):
2051
_fmt = "Diff3 is not installed on this machine."
2054
class ExistingContent(BzrError):
2055
# Added in bzrlib 0.92, used by VersionedFile.add_lines.
2057
_fmt = "The content being inserted is already present."
2060
class ExistingLimbo(BzrError):
2062
_fmt = """This tree contains left-over files from a failed operation.
2063
Please examine %(limbo_dir)s to see if it contains any files you wish to
2064
keep, and delete it when you are done."""
2066
def __init__(self, limbo_dir):
2067
BzrError.__init__(self)
2068
self.limbo_dir = limbo_dir
2071
class ExistingPendingDeletion(BzrError):
2073
_fmt = """This tree contains left-over files from a failed operation.
2074
Please examine %(pending_deletion)s to see if it contains any files you
2075
wish to keep, and delete it when you are done."""
2077
def __init__(self, pending_deletion):
2078
BzrError.__init__(self, pending_deletion=pending_deletion)
2081
class ImmortalLimbo(BzrError):
2083
_fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
2084
Please examine %(limbo_dir)s to see if it contains any files you wish to
2085
keep, and delete it when you are done."""
2087
def __init__(self, limbo_dir):
2088
BzrError.__init__(self)
2089
self.limbo_dir = limbo_dir
2092
class ImmortalPendingDeletion(BzrError):
2094
_fmt = ("Unable to delete transform temporary directory "
2095
"%(pending_deletion)s. Please examine %(pending_deletion)s to see if it "
2096
"contains any files you wish to keep, and delete it when you are done.")
2098
def __init__(self, pending_deletion):
2099
BzrError.__init__(self, pending_deletion=pending_deletion)
2102
class OutOfDateTree(BzrError):
2104
_fmt = "Working tree is out of date, please run 'bzr update'.%(more)s"
2106
def __init__(self, tree, more=None):
2111
BzrError.__init__(self)
1038
2112
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."""
2116
class PublicBranchOutOfDate(BzrError):
2118
_fmt = 'Public branch "%(public_location)s" lacks revision '\
2121
def __init__(self, public_location, revstring):
2122
import bzrlib.urlutils as urlutils
2123
public_location = urlutils.unescape_for_display(public_location,
2125
BzrError.__init__(self, public_location=public_location,
2126
revstring=revstring)
2129
class MergeModifiedFormatError(BzrError):
2131
_fmt = "Error in merge modified format"
2134
class ConflictFormatError(BzrError):
2136
_fmt = "Format error in conflict listings"
2139
class CorruptDirstate(BzrError):
2141
_fmt = ("Inconsistency in dirstate file %(dirstate_path)s.\n"
2142
"Error: %(description)s")
2144
def __init__(self, dirstate_path, description):
2145
BzrError.__init__(self)
2146
self.dirstate_path = dirstate_path
2147
self.description = description
2150
class CorruptRepository(BzrError):
2152
_fmt = ("An error has been detected in the repository %(repo_path)s.\n"
2153
"Please run bzr reconcile on this repository.")
1053
2155
def __init__(self, repo):
1054
BzrNewError.__init__(self)
2156
BzrError.__init__(self)
1055
2157
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."""
2160
class InconsistentDelta(BzrError):
2161
"""Used when we get a delta that is not valid."""
2163
_fmt = ("An inconsistent delta was supplied involving %(path)r,"
2164
" %(file_id)r\nreason: %(reason)s")
2166
def __init__(self, path, file_id, reason):
2167
BzrError.__init__(self)
2169
self.file_id = file_id
2170
self.reason = reason
2173
class InconsistentDeltaDelta(InconsistentDelta):
2174
"""Used when we get a delta that is not valid."""
2176
_fmt = ("An inconsistent delta was supplied: %(delta)r"
2177
"\nreason: %(reason)s")
2179
def __init__(self, delta, reason):
2180
BzrError.__init__(self)
2182
self.reason = reason
2185
class UpgradeRequired(BzrError):
2187
_fmt = "To use this feature you must upgrade your branch at %(path)s."
1061
2189
def __init__(self, path):
1062
BzrNewError.__init__(self)
2190
BzrError.__init__(self)
1063
2191
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"""
1078
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."""
2194
class RepositoryUpgradeRequired(UpgradeRequired):
2196
_fmt = "To use this feature you must upgrade your repository at %(path)s."
2199
class RichRootUpgradeRequired(UpgradeRequired):
2201
_fmt = ("To use this feature you must upgrade your branch at %(path)s to"
2202
" a format which supports rich roots.")
2205
class LocalRequiresBoundBranch(BzrError):
2207
_fmt = "Cannot perform local-only commits on unbound branches."
2210
class UnsupportedOperation(BzrError):
2212
_fmt = ("The method %(mname)s is not supported on"
2213
" objects of type %(tname)s.")
1084
2215
def __init__(self, method, method_self):
1085
2216
self.method = method
1086
2217
self.mname = method.__name__
1087
2218
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"""
2221
class CannotSetRevisionId(UnsupportedOperation):
2222
"""Raised when a commit is attempting to set a revision id but cant."""
2225
class NonAsciiRevisionId(UnsupportedOperation):
2226
"""Raised when a commit is attempting to set a non-ascii revision id
2231
class BinaryFile(BzrError):
2233
_fmt = "File is binary but should be text."
2236
class IllegalPath(BzrError):
2238
_fmt = "The path %(path)s is not permitted on this platform"
1097
2240
def __init__(self, path):
1098
BzrNewError.__init__(self)
2241
BzrError.__init__(self)
1099
2242
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
2245
class TestamentMismatch(BzrError):
2247
_fmt = """Testament did not match expected value.
2248
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1107
2251
def __init__(self, revision_id, expected, measured):
1108
2252
self.revision_id = revision_id
1109
2253
self.expected = expected
1110
2254
self.measured = measured
1113
class NotABundle(BzrNewError):
1114
"""Not a bzr revision-bundle: %(text)r"""
1116
def __init__(self, text):
1117
BzrNewError.__init__(self)
1121
class BadBundle(BzrNewError):
1122
"""Bad bzr revision-bundle: %(text)r"""
1124
def __init__(self, text):
1125
BzrNewError.__init__(self)
1129
class MalformedHeader(BadBundle):
1130
"""Malformed bzr revision-bundle header: %(text)r"""
1132
def __init__(self, text):
1133
BzrNewError.__init__(self)
1137
class MalformedPatches(BadBundle):
1138
"""Malformed patches in bzr revision-bundle: %(text)r"""
1140
def __init__(self, text):
1141
BzrNewError.__init__(self)
1145
class MalformedFooter(BadBundle):
1146
"""Malformed footer in bzr revision-bundle: %(text)r"""
1148
def __init__(self, text):
1149
BzrNewError.__init__(self)
2257
class NotABundle(BzrError):
2259
_fmt = "Not a bzr revision-bundle: %(text)r"
2261
def __init__(self, text):
2262
BzrError.__init__(self)
2266
class BadBundle(BzrError):
2268
_fmt = "Bad bzr revision-bundle: %(text)r"
2270
def __init__(self, text):
2271
BzrError.__init__(self)
2275
class MalformedHeader(BadBundle):
2277
_fmt = "Malformed bzr revision-bundle header: %(text)r"
2280
class MalformedPatches(BadBundle):
2282
_fmt = "Malformed patches in bzr revision-bundle: %(text)r"
2285
class MalformedFooter(BadBundle):
2287
_fmt = "Malformed footer in bzr revision-bundle: %(text)r"
1153
2290
class UnsupportedEOLMarker(BadBundle):
1154
"""End of line marker was not \\n in bzr revision-bundle"""
2292
_fmt = "End of line marker was not \\n in bzr revision-bundle"
1156
2294
def __init__(self):
1157
BzrNewError.__init__(self)
1160
class BadInventoryFormat(BzrNewError):
1161
"""Root class for inventory serialization errors"""
2295
# XXX: BadBundle's constructor assumes there's explanatory text,
2296
# but for this there is not
2297
BzrError.__init__(self)
2300
class IncompatibleBundleFormat(BzrError):
2302
_fmt = "Bundle format %(bundle_format)s is incompatible with %(other)s"
2304
def __init__(self, bundle_format, other):
2305
BzrError.__init__(self)
2306
self.bundle_format = bundle_format
2310
class BadInventoryFormat(BzrError):
2312
_fmt = "Root class for inventory serialization errors"
1164
2315
class UnexpectedInventoryFormat(BadInventoryFormat):
1165
"""The inventory was not in the expected format:\n %(msg)s"""
2317
_fmt = "The inventory was not in the expected format:\n %(msg)s"
1167
2319
def __init__(self, msg):
1168
2320
BadInventoryFormat.__init__(self, msg=msg)
1171
class UnknownSSH(BzrNewError):
1172
"""Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
2323
class RootNotRich(BzrError):
2325
_fmt = """This operation requires rich root data storage"""
2328
class NoSmartMedium(InternalBzrError):
2330
_fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
2332
def __init__(self, transport):
2333
self.transport = transport
2336
class UnknownSSH(BzrError):
2338
_fmt = "Unrecognised value for BZR_SSH environment variable: %(vendor)s"
1174
2340
def __init__(self, vendor):
1175
BzrNewError.__init__(self)
2341
BzrError.__init__(self)
1176
2342
self.vendor = vendor
1179
class GhostRevisionUnusableHere(BzrNewError):
1180
"""Ghost revision {%(revision_id)s} cannot be used here."""
2345
class SSHVendorNotFound(BzrError):
2347
_fmt = ("Don't know how to handle SSH connections."
2348
" Please set BZR_SSH environment variable.")
2351
class GhostRevisionsHaveNoRevno(BzrError):
2352
"""When searching for revnos, if we encounter a ghost, we are stuck"""
2354
_fmt = ("Could not determine revno for {%(revision_id)s} because"
2355
" its ancestry shows a ghost at {%(ghost_revision_id)s}")
2357
def __init__(self, revision_id, ghost_revision_id):
2358
self.revision_id = revision_id
2359
self.ghost_revision_id = ghost_revision_id
2362
class GhostRevisionUnusableHere(BzrError):
2364
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1182
2366
def __init__(self, revision_id):
1183
BzrNewError.__init__(self)
2367
BzrError.__init__(self)
1184
2368
self.revision_id = revision_id
2371
class IllegalUseOfScopeReplacer(InternalBzrError):
2373
_fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2374
" %(msg)s%(extra)s")
2376
def __init__(self, name, msg, extra=None):
2377
BzrError.__init__(self)
2381
self.extra = ': ' + str(extra)
2386
class InvalidImportLine(InternalBzrError):
2388
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
2390
def __init__(self, text, msg):
2391
BzrError.__init__(self)
2396
class ImportNameCollision(InternalBzrError):
2398
_fmt = ("Tried to import an object to the same name as"
2399
" an existing object. %(name)s")
2401
def __init__(self, name):
2402
BzrError.__init__(self)
2406
class NotAMergeDirective(BzrError):
2407
"""File starting with %(firstline)r is not a merge directive"""
2408
def __init__(self, firstline):
2409
BzrError.__init__(self, firstline=firstline)
2412
class NoMergeSource(BzrError):
2413
"""Raise if no merge source was specified for a merge directive"""
2415
_fmt = "A merge directive must provide either a bundle or a public"\
2419
class IllegalMergeDirectivePayload(BzrError):
2420
"""A merge directive contained something other than a patch or bundle"""
2422
_fmt = "Bad merge directive payload %(start)r"
2424
def __init__(self, start):
2429
class PatchVerificationFailed(BzrError):
2430
"""A patch from a merge directive could not be verified"""
2432
_fmt = "Preview patch does not match requested changes."
2435
class PatchMissing(BzrError):
2436
"""Raise a patch type was specified but no patch supplied"""
2438
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2440
def __init__(self, patch_type):
2441
BzrError.__init__(self)
2442
self.patch_type = patch_type
2445
class TargetNotBranch(BzrError):
2446
"""A merge directive's target branch is required, but isn't a branch"""
2448
_fmt = ("Your branch does not have all of the revisions required in "
2449
"order to merge this merge directive and the target "
2450
"location specified in the merge directive is not a branch: "
2453
def __init__(self, location):
2454
BzrError.__init__(self)
2455
self.location = location
2458
class UnsupportedInventoryKind(BzrError):
2460
_fmt = """Unsupported entry kind %(kind)s"""
2462
def __init__(self, kind):
2466
class BadSubsumeSource(BzrError):
2468
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2470
def __init__(self, tree, other_tree, reason):
2472
self.other_tree = other_tree
2473
self.reason = reason
2476
class SubsumeTargetNeedsUpgrade(BzrError):
2478
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2480
def __init__(self, other_tree):
2481
self.other_tree = other_tree
2484
class BadReferenceTarget(InternalBzrError):
2486
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2489
def __init__(self, tree, other_tree, reason):
2491
self.other_tree = other_tree
2492
self.reason = reason
2495
class NoSuchTag(BzrError):
2497
_fmt = "No such tag: %(tag_name)s"
2499
def __init__(self, tag_name):
2500
self.tag_name = tag_name
2503
class TagsNotSupported(BzrError):
2505
_fmt = ("Tags not supported by %(branch)s;"
2506
" you may be able to use bzr upgrade.")
2508
def __init__(self, branch):
2509
self.branch = branch
2512
class TagAlreadyExists(BzrError):
2514
_fmt = "Tag %(tag_name)s already exists."
2516
def __init__(self, tag_name):
2517
self.tag_name = tag_name
2520
class MalformedBugIdentifier(BzrError):
2522
_fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2523
'See "bzr help bugs" for more information on this feature.')
2525
def __init__(self, bug_id, reason):
2526
self.bug_id = bug_id
2527
self.reason = reason
2530
class InvalidBugTrackerURL(BzrError):
2532
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2533
"contain {id}: %(url)s")
2535
def __init__(self, abbreviation, url):
2536
self.abbreviation = abbreviation
2540
class UnknownBugTrackerAbbreviation(BzrError):
2542
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2545
def __init__(self, abbreviation, branch):
2546
self.abbreviation = abbreviation
2547
self.branch = branch
2550
class InvalidLineInBugsProperty(BzrError):
2552
_fmt = ("Invalid line in bugs property: '%(line)s'")
2554
def __init__(self, line):
2558
class InvalidBugStatus(BzrError):
2560
_fmt = ("Invalid bug status: '%(status)s'")
2562
def __init__(self, status):
2563
self.status = status
2566
class UnexpectedSmartServerResponse(BzrError):
2568
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2570
def __init__(self, response_tuple):
2571
self.response_tuple = response_tuple
2574
class ErrorFromSmartServer(BzrError):
2575
"""An error was received from a smart server.
2577
:seealso: UnknownErrorFromSmartServer
2580
_fmt = "Error received from smart server: %(error_tuple)r"
2582
internal_error = True
2584
def __init__(self, error_tuple):
2585
self.error_tuple = error_tuple
2587
self.error_verb = error_tuple[0]
2589
self.error_verb = None
2590
self.error_args = error_tuple[1:]
2593
class UnknownErrorFromSmartServer(BzrError):
2594
"""An ErrorFromSmartServer could not be translated into a typical bzrlib
2597
This is distinct from ErrorFromSmartServer so that it is possible to
2598
distinguish between the following two cases:
2599
- ErrorFromSmartServer was uncaught. This is logic error in the client
2600
and so should provoke a traceback to the user.
2601
- ErrorFromSmartServer was caught but its error_tuple could not be
2602
translated. This is probably because the server sent us garbage, and
2603
should not provoke a traceback.
2606
_fmt = "Server sent an unexpected error: %(error_tuple)r"
2608
internal_error = False
2610
def __init__(self, error_from_smart_server):
2613
:param error_from_smart_server: An ErrorFromSmartServer instance.
2615
self.error_from_smart_server = error_from_smart_server
2616
self.error_tuple = error_from_smart_server.error_tuple
2619
class ContainerError(BzrError):
2620
"""Base class of container errors."""
2623
class UnknownContainerFormatError(ContainerError):
2625
_fmt = "Unrecognised container format: %(container_format)r"
2627
def __init__(self, container_format):
2628
self.container_format = container_format
2631
class UnexpectedEndOfContainerError(ContainerError):
2633
_fmt = "Unexpected end of container stream"
2636
class UnknownRecordTypeError(ContainerError):
2638
_fmt = "Unknown record type: %(record_type)r"
2640
def __init__(self, record_type):
2641
self.record_type = record_type
2644
class InvalidRecordError(ContainerError):
2646
_fmt = "Invalid record: %(reason)s"
2648
def __init__(self, reason):
2649
self.reason = reason
2652
class ContainerHasExcessDataError(ContainerError):
2654
_fmt = "Container has data after end marker: %(excess)r"
2656
def __init__(self, excess):
2657
self.excess = excess
2660
class DuplicateRecordNameError(ContainerError):
2662
_fmt = "Container has multiple records with the same name: %(name)s"
2664
def __init__(self, name):
2668
class NoDestinationAddress(InternalBzrError):
2670
_fmt = "Message does not have a destination address."
2673
class RepositoryDataStreamError(BzrError):
2675
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2677
def __init__(self, reason):
2678
self.reason = reason
2681
class SMTPError(BzrError):
2683
_fmt = "SMTP error: %(error)s"
2685
def __init__(self, error):
2689
class NoMessageSupplied(BzrError):
2691
_fmt = "No message supplied."
2694
class NoMailAddressSpecified(BzrError):
2696
_fmt = "No mail-to address (--mail-to) or output (-o) specified."
2699
class UnknownMailClient(BzrError):
2701
_fmt = "Unknown mail client: %(mail_client)s"
2703
def __init__(self, mail_client):
2704
BzrError.__init__(self, mail_client=mail_client)
2707
class MailClientNotFound(BzrError):
2709
_fmt = "Unable to find mail client with the following names:"\
2710
" %(mail_command_list_string)s"
2712
def __init__(self, mail_command_list):
2713
mail_command_list_string = ', '.join(mail_command_list)
2714
BzrError.__init__(self, mail_command_list=mail_command_list,
2715
mail_command_list_string=mail_command_list_string)
2717
class SMTPConnectionRefused(SMTPError):
2719
_fmt = "SMTP connection to %(host)s refused"
2721
def __init__(self, error, host):
2726
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2728
_fmt = "Please specify smtp_server. No server at default %(host)s."
2731
class BzrDirError(BzrError):
2733
def __init__(self, bzrdir):
2734
import bzrlib.urlutils as urlutils
2735
display_url = urlutils.unescape_for_display(bzrdir.root_transport.base,
2737
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2740
class UnsyncedBranches(BzrDirError):
2742
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2743
" bzr help sync-for-reconfigure.")
2745
def __init__(self, bzrdir, target_branch):
2746
BzrDirError.__init__(self, bzrdir)
2747
import bzrlib.urlutils as urlutils
2748
self.target_url = urlutils.unescape_for_display(target_branch.base,
2752
class AlreadyBranch(BzrDirError):
2754
_fmt = "'%(display_url)s' is already a branch."
2757
class AlreadyTree(BzrDirError):
2759
_fmt = "'%(display_url)s' is already a tree."
2762
class AlreadyCheckout(BzrDirError):
2764
_fmt = "'%(display_url)s' is already a checkout."
2767
class AlreadyLightweightCheckout(BzrDirError):
2769
_fmt = "'%(display_url)s' is already a lightweight checkout."
2772
class AlreadyUsingShared(BzrDirError):
2774
_fmt = "'%(display_url)s' is already using a shared repository."
2777
class AlreadyStandalone(BzrDirError):
2779
_fmt = "'%(display_url)s' is already standalone."
2782
class AlreadyWithTrees(BzrDirError):
2784
_fmt = ("Shared repository '%(display_url)s' already creates "
2788
class AlreadyWithNoTrees(BzrDirError):
2790
_fmt = ("Shared repository '%(display_url)s' already doesn't create "
2794
class ReconfigurationNotSupported(BzrDirError):
2796
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2799
class NoBindLocation(BzrDirError):
2801
_fmt = "No location could be found to bind to at %(display_url)s."
2804
class UncommittedChanges(BzrError):
2806
_fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2807
' (See bzr status).%(more)s')
2809
def __init__(self, tree, more=None):
2814
import bzrlib.urlutils as urlutils
2815
display_url = urlutils.unescape_for_display(
2816
tree.bzrdir.root_transport.base, 'ascii')
2817
BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2820
class MissingTemplateVariable(BzrError):
2822
_fmt = 'Variable {%(name)s} is not available.'
2824
def __init__(self, name):
2828
class NoTemplate(BzrError):
2830
_fmt = 'No template specified.'
2833
class UnableCreateSymlink(BzrError):
2835
_fmt = 'Unable to create symlink %(path_str)son this platform'
2837
def __init__(self, path=None):
2841
path_str = repr(str(path))
2842
except UnicodeEncodeError:
2843
path_str = repr(path)
2845
self.path_str = path_str
2848
class UnsupportedTimezoneFormat(BzrError):
2850
_fmt = ('Unsupported timezone format "%(timezone)s", '
2851
'options are "utc", "original", "local".')
2853
def __init__(self, timezone):
2854
self.timezone = timezone
2857
class CommandAvailableInPlugin(StandardError):
2859
internal_error = False
2861
def __init__(self, cmd_name, plugin_metadata, provider):
2863
self.plugin_metadata = plugin_metadata
2864
self.cmd_name = cmd_name
2865
self.provider = provider
2869
_fmt = ('"%s" is not a standard bzr command. \n'
2870
'However, the following official plugin provides this command: %s\n'
2871
'You can install it by going to: %s'
2872
% (self.cmd_name, self.plugin_metadata['name'],
2873
self.plugin_metadata['url']))
2878
class NoPluginAvailable(BzrError):
2882
class UnableEncodePath(BzrError):
2884
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2885
'user encoding %(user_encoding)s')
2887
def __init__(self, path, kind):
2888
from bzrlib.osutils import get_user_encoding
2891
self.user_encoding = osutils.get_user_encoding()
2894
class NoSuchAlias(BzrError):
2896
_fmt = ('The alias "%(alias_name)s" does not exist.')
2898
def __init__(self, alias_name):
2899
BzrError.__init__(self, alias_name=alias_name)
2902
class DirectoryLookupFailure(BzrError):
2903
"""Base type for lookup errors."""
2908
class InvalidLocationAlias(DirectoryLookupFailure):
2910
_fmt = '"%(alias_name)s" is not a valid location alias.'
2912
def __init__(self, alias_name):
2913
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2916
class UnsetLocationAlias(DirectoryLookupFailure):
2918
_fmt = 'No %(alias_name)s location assigned.'
2920
def __init__(self, alias_name):
2921
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2924
class CannotBindAddress(BzrError):
2926
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2928
def __init__(self, host, port, orig_error):
2929
# nb: in python2.4 socket.error doesn't have a useful repr
2930
BzrError.__init__(self, host=host, port=port,
2931
orig_error=repr(orig_error.args))
2934
class UnknownRules(BzrError):
2936
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
2938
def __init__(self, unknowns):
2939
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2942
class HookFailed(BzrError):
2943
"""Raised when a pre_change_branch_tip hook function fails anything other
2944
than TipChangeRejected.
2947
_fmt = ("Hook '%(hook_name)s' during %(hook_stage)s failed:\n"
2948
"%(traceback_text)s%(exc_value)s")
2950
def __init__(self, hook_stage, hook_name, exc_info):
2952
self.hook_stage = hook_stage
2953
self.hook_name = hook_name
2954
self.exc_info = exc_info
2955
self.exc_type = exc_info[0]
2956
self.exc_value = exc_info[1]
2957
self.exc_tb = exc_info[2]
2958
self.traceback_text = ''.join(traceback.format_tb(self.exc_tb))
2961
class TipChangeRejected(BzrError):
2962
"""A pre_change_branch_tip hook function may raise this to cleanly and
2963
explicitly abort a change to a branch tip.
2966
_fmt = u"Tip change rejected: %(msg)s"
2968
def __init__(self, msg):
2972
class ShelfCorrupt(BzrError):
2974
_fmt = "Shelf corrupt."
2977
class NoSuchShelfId(BzrError):
2979
_fmt = 'No changes are shelved with id "%(shelf_id)d".'
2981
def __init__(self, shelf_id):
2982
BzrError.__init__(self, shelf_id=shelf_id)
2985
class InvalidShelfId(BzrError):
2987
_fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
2989
def __init__(self, invalid_id):
2990
BzrError.__init__(self, invalid_id=invalid_id)
2993
class JailBreak(BzrError):
2995
_fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
2997
def __init__(self, url):
2998
BzrError.__init__(self, url=url)
3001
class UserAbort(BzrError):
3003
_fmt = 'The user aborted the operation.'
3006
class MustHaveWorkingTree(BzrError):
3008
_fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
3010
def __init__(self, format, url):
3011
BzrError.__init__(self, format=format, url=url)
3014
class NoSuchView(BzrError):
3015
"""A view does not exist.
3018
_fmt = u"No such view: %(view_name)s."
3020
def __init__(self, view_name):
3021
self.view_name = view_name
3024
class ViewsNotSupported(BzrError):
3025
"""Views are not supported by a tree format.
3028
_fmt = ("Views are not supported by %(tree)s;"
3029
" use 'bzr upgrade' to change your tree to a later format.")
3031
def __init__(self, tree):
3035
class FileOutsideView(BzrError):
3037
_fmt = ('Specified file "%(file_name)s" is outside the current view: '
3040
def __init__(self, file_name, view_files):
3041
self.file_name = file_name
3042
self.view_str = ", ".join(view_files)
3045
class UnresumableWriteGroup(BzrError):
3047
_fmt = ("Repository %(repository)s cannot resume write group "
3048
"%(write_groups)r: %(reason)s")
3050
internal_error = True
3052
def __init__(self, repository, write_groups, reason):
3053
self.repository = repository
3054
self.write_groups = write_groups
3055
self.reason = reason
3058
class UnsuspendableWriteGroup(BzrError):
3060
_fmt = ("Repository %(repository)s cannot suspend a write group.")
3062
internal_error = True
3064
def __init__(self, repository):
3065
self.repository = repository
3068
class LossyPushToSameVCS(BzrError):
3070
_fmt = ("Lossy push not possible between %(source_branch)r and "
3071
"%(target_branch)r that are in the same VCS.")
3073
internal_error = True
3075
def __init__(self, source_branch, target_branch):
3076
self.source_branch = source_branch
3077
self.target_branch = target_branch