1689
815
class InvalidHttpRange(InvalidHttpResponse):
1691
_fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
816
"""Invalid http range "%(range)s" for %(path)s: %(msg)s"""
1693
818
def __init__(self, path, range, msg):
1694
819
self.range = range
1695
820
InvalidHttpResponse.__init__(self, path, msg)
1698
823
class InvalidHttpContentType(InvalidHttpResponse):
1700
_fmt = 'Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s'
824
"""Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s"""
1702
826
def __init__(self, path, ctype, msg):
1703
827
self.ctype = ctype
1704
828
InvalidHttpResponse.__init__(self, path, msg)
1707
class RedirectRequested(TransportError):
1709
_fmt = '%(source)s is%(permanently)s redirected to %(target)s'
1711
def __init__(self, source, target, is_permanent=False):
1712
self.source = source
1713
self.target = target
1715
self.permanently = ' permanently'
1717
self.permanently = ''
1718
TransportError.__init__(self)
1721
class TooManyRedirections(TransportError):
1723
_fmt = "Too many redirections"
1726
831
class ConflictsInTree(BzrError):
1728
_fmt = "Working tree has conflicts."
833
BzrError.__init__(self, "Working tree has conflicts.")
1731
836
class ParseConfigError(BzrError):
1733
837
def __init__(self, errors, filename):
1734
838
if filename is None:
1736
840
message = "Error(s) parsing config file %s:\n%s" % \
1737
(filename, ('\n'.join(e.msg for e in errors)))
841
(filename, ('\n'.join(e.message for e in errors)))
1738
842
BzrError.__init__(self, message)
1741
class NoEmailInUsername(BzrError):
1743
_fmt = "%(username)r does not seem to contain a reasonable email address"
1745
def __init__(self, username):
1746
BzrError.__init__(self)
1747
self.username = username
1750
845
class SigningFailed(BzrError):
1752
_fmt = 'Failed to gpg sign data with command "%(command_line)s"'
1754
846
def __init__(self, command_line):
1755
BzrError.__init__(self, command_line=command_line)
847
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
1758
851
class WorkingTreeNotRevision(BzrError):
1760
_fmt = ("The working tree for %(basedir)s has changed since"
1761
" the last commit, but weave merge requires that it be"
1764
852
def __init__(self, tree):
1765
BzrError.__init__(self, basedir=tree.basedir)
1768
class CantReprocessAndShowBase(BzrError):
1770
_fmt = ("Can't reprocess and show base, because reprocessing obscures "
1771
"the relationship of conflicting lines to the base")
1774
class GraphCycleError(BzrError):
1776
_fmt = "Cycle in graph %(graph)r"
853
BzrError.__init__(self, "The working tree for %s has changed since"
854
" last commit, but weave merge requires that it be"
855
" unchanged." % tree.basedir)
858
class CantReprocessAndShowBase(BzrNewError):
859
"""Can't reprocess and show base.
860
Reprocessing obscures relationship of conflicting lines to base."""
863
class GraphCycleError(BzrNewError):
864
"""Cycle in graph %(graph)r"""
1778
865
def __init__(self, graph):
1779
BzrError.__init__(self)
866
BzrNewError.__init__(self)
1780
867
self.graph = graph
1783
class WritingCompleted(InternalBzrError):
1785
_fmt = ("The MediumRequest '%(request)s' has already had finish_writing "
1786
"called upon it - accept bytes may not be called anymore.")
1788
def __init__(self, request):
1789
self.request = request
1792
class WritingNotComplete(InternalBzrError):
1794
_fmt = ("The MediumRequest '%(request)s' has not has finish_writing "
1795
"called upon it - until the write phase is complete no "
1796
"data may be read.")
1798
def __init__(self, request):
1799
self.request = request
1802
class NotConflicted(BzrError):
1804
_fmt = "File %(filename)s is not conflicted."
870
class NotConflicted(BzrNewError):
871
"""File %(filename)s is not conflicted."""
1806
873
def __init__(self, filename):
1807
BzrError.__init__(self)
874
BzrNewError.__init__(self)
1808
875
self.filename = filename
1811
class MediumNotConnected(InternalBzrError):
1813
_fmt = """The medium '%(medium)s' is not connected."""
1815
def __init__(self, medium):
1816
self.medium = medium
1819
878
class MustUseDecorated(Exception):
1821
_fmt = "A decorating function has requested its original command be used."
1824
class NoBundleFound(BzrError):
1826
_fmt = 'No bundle was found in "%(filename)s".'
879
"""A decorating function has requested its original command be used.
881
This should never escape bzr, so does not need to be printable.
885
class NoBundleFound(BzrNewError):
886
"""No bundle was found in %(filename)s"""
1828
887
def __init__(self, filename):
1829
BzrError.__init__(self)
888
BzrNewError.__init__(self)
1830
889
self.filename = filename
1833
class BundleNotSupported(BzrError):
1835
_fmt = "Unable to handle bundle version %(version)s: %(msg)s"
892
class BundleNotSupported(BzrNewError):
893
"""Unable to handle bundle version %(version)s: %(msg)s"""
1837
894
def __init__(self, version, msg):
1838
BzrError.__init__(self)
895
BzrNewError.__init__(self)
1839
896
self.version = version
1843
class MissingText(BzrError):
1845
_fmt = ("Branch %(base)s is missing revision"
1846
" %(text_revision)s of %(file_id)s")
900
class MissingText(BzrNewError):
901
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
1848
903
def __init__(self, branch, text_revision, file_id):
1849
BzrError.__init__(self)
904
BzrNewError.__init__(self)
1850
905
self.branch = branch
1851
906
self.base = branch.base
1852
907
self.text_revision = text_revision
1853
908
self.file_id = file_id
1856
class DuplicateFileId(BzrError):
1858
_fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1860
def __init__(self, file_id, entry):
1861
BzrError.__init__(self)
1862
self.file_id = file_id
1866
class DuplicateKey(BzrError):
1868
_fmt = "Key %(key)s is already present in map"
1871
class DuplicateHelpPrefix(BzrError):
1873
_fmt = "The prefix %(prefix)s is in the help search path twice."
1875
def __init__(self, prefix):
1876
self.prefix = prefix
1879
class MalformedTransform(BzrError):
1881
_fmt = "Tree transform is malformed %(conflicts)r"
1884
class NoFinalPath(BzrError):
1886
_fmt = ("No final name for trans_id %(trans_id)r\n"
1887
"file-id: %(file_id)r\n"
1888
"root trans-id: %(root_trans_id)r\n")
1890
def __init__(self, trans_id, transform):
1891
self.trans_id = trans_id
1892
self.file_id = transform.final_file_id(trans_id)
1893
self.root_trans_id = transform.root
1896
class BzrBadParameter(InternalBzrError):
1898
_fmt = "Bad parameter: %(param)r"
1900
# This exception should never be thrown, but it is a base class for all
1901
# parameter-to-function errors.
911
class DuplicateKey(BzrNewError):
912
"""Key %(key)s is already present in map"""
915
class MalformedTransform(BzrNewError):
916
"""Tree transform is malformed %(conflicts)r"""
919
class BzrBadParameter(BzrNewError):
920
"""A bad parameter : %(param)s is not usable.
922
This exception should never be thrown, but it is a base class for all
923
parameter-to-function errors.
1903
925
def __init__(self, param):
1904
BzrError.__init__(self)
926
BzrNewError.__init__(self)
1905
927
self.param = param
1908
930
class BzrBadParameterNotUnicode(BzrBadParameter):
1910
_fmt = "Parameter %(param)s is neither unicode nor utf8."
1913
class ReusingTransform(BzrError):
1915
_fmt = "Attempt to reuse a transform that has already been applied."
1918
class CantMoveRoot(BzrError):
1920
_fmt = "Moving the root directory is not supported at this time"
1923
class TransformRenameFailed(BzrError):
1925
_fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
1927
def __init__(self, from_path, to_path, why, errno):
1928
self.from_path = from_path
1929
self.to_path = to_path
1934
class BzrMoveFailedError(BzrError):
1936
_fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1938
def __init__(self, from_path='', to_path='', extra=None):
1939
from bzrlib.osutils import splitpath
1940
BzrError.__init__(self)
1942
self.extra = ': ' + str(extra)
1946
has_from = len(from_path) > 0
1947
has_to = len(to_path) > 0
1949
self.from_path = splitpath(from_path)[-1]
1954
self.to_path = splitpath(to_path)[-1]
1959
if has_from and has_to:
1960
self.operator = " =>"
1962
self.from_path = "from " + from_path
1964
self.operator = "to"
1966
self.operator = "file"
1969
class BzrRenameFailedError(BzrMoveFailedError):
1971
_fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
1973
def __init__(self, from_path, to_path, extra=None):
1974
BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1976
class BzrRemoveChangedFilesError(BzrError):
1977
"""Used when user is trying to remove changed files."""
1979
_fmt = ("Can't safely remove modified or unknown files:\n"
1980
"%(changes_as_text)s"
1981
"Use --keep to not delete them, or --force to delete them regardless.")
1983
def __init__(self, tree_delta):
1984
BzrError.__init__(self)
1985
self.changes_as_text = tree_delta.get_changes_as_text()
1986
#self.paths_as_string = '\n'.join(changed_files)
1987
#self.paths_as_string = '\n'.join([quotefn(p) for p in changed_files])
931
"""Parameter %(param)s is neither unicode nor utf8."""
934
class ReusingTransform(BzrNewError):
935
"""Attempt to reuse a transform that has already been applied."""
938
class CantMoveRoot(BzrNewError):
939
"""Moving the root directory is not supported at this time"""
1990
942
class BzrBadParameterNotString(BzrBadParameter):
1992
_fmt = "Parameter %(param)s is not a string or unicode string."
943
"""Parameter %(param)s is not a string or unicode string."""
1995
946
class BzrBadParameterMissing(BzrBadParameter):
1997
_fmt = "Parameter $(param)s is required but not present."
947
"""Parameter $(param)s is required but not present."""
2000
950
class BzrBadParameterUnicode(BzrBadParameter):
2002
_fmt = ("Parameter %(param)s is unicode but"
2003
" only byte-strings are permitted.")
951
"""Parameter %(param)s is unicode but only byte-strings are permitted."""
2006
954
class BzrBadParameterContainsNewline(BzrBadParameter):
2008
_fmt = "Parameter %(param)s contains a newline."
2011
class DependencyNotPresent(BzrError):
2013
_fmt = 'Unable to import library "%(library)s": %(error)s'
955
"""Parameter %(param)s contains a newline."""
958
class DependencyNotPresent(BzrNewError):
959
"""Unable to import library "%(library)s": %(error)s"""
2015
961
def __init__(self, library, error):
2016
BzrError.__init__(self, library=library, error=error)
962
BzrNewError.__init__(self, library=library, error=error)
2019
965
class ParamikoNotPresent(DependencyNotPresent):
2021
_fmt = "Unable to import paramiko (required for sftp support): %(error)s"
966
"""Unable to import paramiko (required for sftp support): %(error)s"""
2023
968
def __init__(self, error):
2024
969
DependencyNotPresent.__init__(self, 'paramiko', error)
2027
class PointlessMerge(BzrError):
2029
_fmt = "Nothing to merge."
2032
class UninitializableFormat(BzrError):
2034
_fmt = "Format %(format)s cannot be initialised by this version of bzr."
972
class UninitializableFormat(BzrNewError):
973
"""Format %(format)s cannot be initialised by this version of bzr."""
2036
975
def __init__(self, format):
2037
BzrError.__init__(self)
2038
self.format = format
2041
class BadConversionTarget(BzrError):
2043
_fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
2046
def __init__(self, problem, format, from_format=None):
2047
BzrError.__init__(self)
2048
self.problem = problem
2049
self.format = format
2050
self.from_format = from_format or '(unspecified)'
2053
class NoDiffFound(BzrError):
2055
_fmt = 'Could not find an appropriate Differ for file "%(path)s"'
2057
def __init__(self, path):
2058
BzrError.__init__(self, path)
2061
class ExecutableMissing(BzrError):
2063
_fmt = "%(exe_name)s could not be found on this machine"
2065
def __init__(self, exe_name):
2066
BzrError.__init__(self, exe_name=exe_name)
2069
class NoDiff(BzrError):
2071
_fmt = "Diff is not installed on this machine: %(msg)s"
976
BzrNewError.__init__(self)
980
class NoDiff(BzrNewError):
981
"""Diff is not installed on this machine: %(msg)s"""
2073
983
def __init__(self, msg):
2074
BzrError.__init__(self, msg=msg)
2077
class NoDiff3(BzrError):
2079
_fmt = "Diff3 is not installed on this machine."
2082
class ExistingContent(BzrError):
2083
# Added in bzrlib 0.92, used by VersionedFile.add_lines.
2085
_fmt = "The content being inserted is already present."
2088
class ExistingLimbo(BzrError):
2090
_fmt = """This tree contains left-over files from a failed operation.
2091
Please examine %(limbo_dir)s to see if it contains any files you wish to
2092
keep, and delete it when you are done."""
2094
def __init__(self, limbo_dir):
2095
BzrError.__init__(self)
2096
self.limbo_dir = limbo_dir
2099
class ExistingPendingDeletion(BzrError):
2101
_fmt = """This tree contains left-over files from a failed operation.
2102
Please examine %(pending_deletion)s to see if it contains any files you
2103
wish to keep, and delete it when you are done."""
2105
def __init__(self, pending_deletion):
2106
BzrError.__init__(self, pending_deletion=pending_deletion)
2109
class ImmortalLimbo(BzrError):
2111
_fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
2112
Please examine %(limbo_dir)s to see if it contains any files you wish to
2113
keep, and delete it when you are done."""
2115
def __init__(self, limbo_dir):
2116
BzrError.__init__(self)
2117
self.limbo_dir = limbo_dir
2120
class ImmortalPendingDeletion(BzrError):
2122
_fmt = ("Unable to delete transform temporary directory "
2123
"%(pending_deletion)s. Please examine %(pending_deletion)s to see if it "
2124
"contains any files you wish to keep, and delete it when you are done.")
2126
def __init__(self, pending_deletion):
2127
BzrError.__init__(self, pending_deletion=pending_deletion)
2130
class OutOfDateTree(BzrError):
2132
_fmt = "Working tree is out of date, please run 'bzr update'.%(more)s"
2134
def __init__(self, tree, more=None):
2139
BzrError.__init__(self)
984
BzrNewError.__init__(self, msg=msg)
987
class NoDiff3(BzrNewError):
988
"""Diff3 is not installed on this machine."""
991
class ExistingLimbo(BzrNewError):
992
"""This tree contains left-over files from a failed operation.
993
Please examine %(limbo_dir)s to see if it contains any files you wish to
994
keep, and delete it when you are done.
996
def __init__(self, limbo_dir):
997
BzrNewError.__init__(self)
998
self.limbo_dir = limbo_dir
1001
class ImmortalLimbo(BzrNewError):
1002
"""Unable to delete transform temporary directory $(limbo_dir)s.
1003
Please examine %(limbo_dir)s to see if it contains any files you wish to
1004
keep, and delete it when you are done.
1006
def __init__(self, limbo_dir):
1007
BzrNewError.__init__(self)
1008
self.limbo_dir = limbo_dir
1011
class OutOfDateTree(BzrNewError):
1012
"""Working tree is out of date, please run 'bzr update'."""
1014
def __init__(self, tree):
1015
BzrNewError.__init__(self)
2140
1016
self.tree = tree
2144
class PublicBranchOutOfDate(BzrError):
2146
_fmt = 'Public branch "%(public_location)s" lacks revision '\
2149
def __init__(self, public_location, revstring):
2150
import bzrlib.urlutils as urlutils
2151
public_location = urlutils.unescape_for_display(public_location,
2153
BzrError.__init__(self, public_location=public_location,
2154
revstring=revstring)
2157
class MergeModifiedFormatError(BzrError):
2159
_fmt = "Error in merge modified format"
2162
class ConflictFormatError(BzrError):
2164
_fmt = "Format error in conflict listings"
2167
class CorruptDirstate(BzrError):
2169
_fmt = ("Inconsistency in dirstate file %(dirstate_path)s.\n"
2170
"Error: %(description)s")
2172
def __init__(self, dirstate_path, description):
2173
BzrError.__init__(self)
2174
self.dirstate_path = dirstate_path
2175
self.description = description
2178
class CorruptRepository(BzrError):
2180
_fmt = ("An error has been detected in the repository %(repo_path)s.\n"
2181
"Please run bzr reconcile on this repository.")
1019
class MergeModifiedFormatError(BzrNewError):
1020
"""Error in merge modified format"""
1023
class ConflictFormatError(BzrNewError):
1024
"""Format error in conflict listings"""
1027
class CorruptRepository(BzrNewError):
1028
"""An error has been detected in the repository %(repo_path)s.
1029
Please run bzr reconcile on this repository."""
2183
1031
def __init__(self, repo):
2184
BzrError.__init__(self)
2185
self.repo_path = repo.user_url
2188
class InconsistentDelta(BzrError):
2189
"""Used when we get a delta that is not valid."""
2191
_fmt = ("An inconsistent delta was supplied involving %(path)r,"
2192
" %(file_id)r\nreason: %(reason)s")
2194
def __init__(self, path, file_id, reason):
2195
BzrError.__init__(self)
2197
self.file_id = file_id
2198
self.reason = reason
2201
class InconsistentDeltaDelta(InconsistentDelta):
2202
"""Used when we get a delta that is not valid."""
2204
_fmt = ("An inconsistent delta was supplied: %(delta)r"
2205
"\nreason: %(reason)s")
2207
def __init__(self, delta, reason):
2208
BzrError.__init__(self)
2210
self.reason = reason
2213
class UpgradeRequired(BzrError):
2215
_fmt = "To use this feature you must upgrade your branch at %(path)s."
1032
BzrNewError.__init__(self)
1033
self.repo_path = repo.bzrdir.root_transport.base
1036
class UpgradeRequired(BzrNewError):
1037
"""To use this feature you must upgrade your branch at %(path)s."""
2217
1039
def __init__(self, path):
2218
BzrError.__init__(self)
1040
BzrNewError.__init__(self)
2219
1041
self.path = path
2222
class RepositoryUpgradeRequired(UpgradeRequired):
2224
_fmt = "To use this feature you must upgrade your repository at %(path)s."
2227
class RichRootUpgradeRequired(UpgradeRequired):
2229
_fmt = ("To use this feature you must upgrade your branch at %(path)s to"
2230
" a format which supports rich roots.")
2233
class LocalRequiresBoundBranch(BzrError):
2235
_fmt = "Cannot perform local-only commits on unbound branches."
2238
class UnsupportedOperation(BzrError):
2240
_fmt = ("The method %(mname)s is not supported on"
2241
" objects of type %(tname)s.")
1044
class LocalRequiresBoundBranch(BzrNewError):
1045
"""Cannot perform local-only commits on unbound branches."""
1048
class MissingProgressBarFinish(BzrNewError):
1049
"""A nested progress bar was not 'finished' correctly."""
1052
class InvalidProgressBarType(BzrNewError):
1053
"""Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1054
Select one of: %(valid_types)s"""
1056
def __init__(self, bar_type, valid_types):
1057
BzrNewError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1060
class UnsupportedOperation(BzrNewError):
1061
"""The method %(mname)s is not supported on objects of type %(tname)s."""
2243
1062
def __init__(self, method, method_self):
2244
1063
self.method = method
2245
1064
self.mname = method.__name__
2246
1065
self.tname = type(method_self).__name__
2249
class CannotSetRevisionId(UnsupportedOperation):
2250
"""Raised when a commit is attempting to set a revision id but cant."""
2253
class NonAsciiRevisionId(UnsupportedOperation):
2254
"""Raised when a commit is attempting to set a non-ascii revision id
2259
class BinaryFile(BzrError):
2261
_fmt = "File is binary but should be text."
2264
class IllegalPath(BzrError):
2266
_fmt = "The path %(path)s is not permitted on this platform"
1068
class BinaryFile(BzrNewError):
1069
"""File is binary but should be text."""
1072
class IllegalPath(BzrNewError):
1073
"""The path %(path)s is not permitted on this platform"""
2268
1075
def __init__(self, path):
2269
BzrError.__init__(self)
1076
BzrNewError.__init__(self)
2270
1077
self.path = path
2273
class TestamentMismatch(BzrError):
2275
_fmt = """Testament did not match expected value.
2276
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1080
class TestamentMismatch(BzrNewError):
1081
"""Testament did not match expected value.
1082
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
2279
1085
def __init__(self, revision_id, expected, measured):
2280
1086
self.revision_id = revision_id
2281
1087
self.expected = expected
2282
1088
self.measured = measured
2285
class NotABundle(BzrError):
2287
_fmt = "Not a bzr revision-bundle: %(text)r"
2289
def __init__(self, text):
2290
BzrError.__init__(self)
2294
class BadBundle(BzrError):
2296
_fmt = "Bad bzr revision-bundle: %(text)r"
2298
def __init__(self, text):
2299
BzrError.__init__(self)
2303
class MalformedHeader(BadBundle):
2305
_fmt = "Malformed bzr revision-bundle header: %(text)r"
2308
class MalformedPatches(BadBundle):
2310
_fmt = "Malformed patches in bzr revision-bundle: %(text)r"
2313
class MalformedFooter(BadBundle):
2315
_fmt = "Malformed footer in bzr revision-bundle: %(text)r"
1091
class NotABundle(BzrNewError):
1092
"""Not a bzr revision-bundle: %(text)r"""
1094
def __init__(self, text):
1095
BzrNewError.__init__(self)
1099
class BadBundle(BzrNewError):
1100
"""Bad bzr revision-bundle: %(text)r"""
1102
def __init__(self, text):
1103
BzrNewError.__init__(self)
1107
class MalformedHeader(BadBundle):
1108
"""Malformed bzr revision-bundle header: %(text)r"""
1110
def __init__(self, text):
1111
BzrNewError.__init__(self)
1115
class MalformedPatches(BadBundle):
1116
"""Malformed patches in bzr revision-bundle: %(text)r"""
1118
def __init__(self, text):
1119
BzrNewError.__init__(self)
1123
class MalformedFooter(BadBundle):
1124
"""Malformed footer in bzr revision-bundle: %(text)r"""
1126
def __init__(self, text):
1127
BzrNewError.__init__(self)
2318
1131
class UnsupportedEOLMarker(BadBundle):
2320
_fmt = "End of line marker was not \\n in bzr revision-bundle"
1132
"""End of line marker was not \\n in bzr revision-bundle"""
2322
1134
def __init__(self):
2323
# XXX: BadBundle's constructor assumes there's explanatory text,
2324
# but for this there is not
2325
BzrError.__init__(self)
2328
class IncompatibleBundleFormat(BzrError):
2330
_fmt = "Bundle format %(bundle_format)s is incompatible with %(other)s"
2332
def __init__(self, bundle_format, other):
2333
BzrError.__init__(self)
2334
self.bundle_format = bundle_format
2338
class BadInventoryFormat(BzrError):
2340
_fmt = "Root class for inventory serialization errors"
2343
class UnexpectedInventoryFormat(BadInventoryFormat):
2345
_fmt = "The inventory was not in the expected format:\n %(msg)s"
2347
def __init__(self, msg):
2348
BadInventoryFormat.__init__(self, msg=msg)
2351
class RootNotRich(BzrError):
2353
_fmt = """This operation requires rich root data storage"""
2356
class NoSmartMedium(InternalBzrError):
2358
_fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
2360
def __init__(self, transport):
2361
self.transport = transport
2364
class UnknownSSH(BzrError):
2366
_fmt = "Unrecognised value for BZR_SSH environment variable: %(vendor)s"
1135
BzrNewError.__init__(self)
1138
class UnknownSSH(BzrNewError):
1139
"""Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
2368
1141
def __init__(self, vendor):
2369
BzrError.__init__(self)
1142
BzrNewError.__init__(self)
2370
1143
self.vendor = vendor
2373
class SSHVendorNotFound(BzrError):
2375
_fmt = ("Don't know how to handle SSH connections."
2376
" Please set BZR_SSH environment variable.")
2379
class GhostRevisionsHaveNoRevno(BzrError):
2380
"""When searching for revnos, if we encounter a ghost, we are stuck"""
2382
_fmt = ("Could not determine revno for {%(revision_id)s} because"
2383
" its ancestry shows a ghost at {%(ghost_revision_id)s}")
2385
def __init__(self, revision_id, ghost_revision_id):
2386
self.revision_id = revision_id
2387
self.ghost_revision_id = ghost_revision_id
2390
class GhostRevisionUnusableHere(BzrError):
2392
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1146
class GhostRevisionUnusableHere(BzrNewError):
1147
"""Ghost revision {%(revision_id)s} cannot be used here."""
2394
1149
def __init__(self, revision_id):
2395
BzrError.__init__(self)
1150
BzrNewError.__init__(self)
2396
1151
self.revision_id = revision_id
2399
class IllegalUseOfScopeReplacer(InternalBzrError):
2401
_fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2402
" %(msg)s%(extra)s")
2404
def __init__(self, name, msg, extra=None):
2405
BzrError.__init__(self)
2409
self.extra = ': ' + str(extra)
2414
class InvalidImportLine(InternalBzrError):
2416
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
2418
def __init__(self, text, msg):
2419
BzrError.__init__(self)
2424
class ImportNameCollision(InternalBzrError):
2426
_fmt = ("Tried to import an object to the same name as"
2427
" an existing object. %(name)s")
2429
def __init__(self, name):
2430
BzrError.__init__(self)
2434
class NotAMergeDirective(BzrError):
2435
"""File starting with %(firstline)r is not a merge directive"""
2436
def __init__(self, firstline):
2437
BzrError.__init__(self, firstline=firstline)
2440
class NoMergeSource(BzrError):
2441
"""Raise if no merge source was specified for a merge directive"""
2443
_fmt = "A merge directive must provide either a bundle or a public"\
2447
class IllegalMergeDirectivePayload(BzrError):
2448
"""A merge directive contained something other than a patch or bundle"""
2450
_fmt = "Bad merge directive payload %(start)r"
2452
def __init__(self, start):
2457
class PatchVerificationFailed(BzrError):
2458
"""A patch from a merge directive could not be verified"""
2460
_fmt = "Preview patch does not match requested changes."
2463
class PatchMissing(BzrError):
2464
"""Raise a patch type was specified but no patch supplied"""
2466
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2468
def __init__(self, patch_type):
2469
BzrError.__init__(self)
2470
self.patch_type = patch_type
2473
class TargetNotBranch(BzrError):
2474
"""A merge directive's target branch is required, but isn't a branch"""
2476
_fmt = ("Your branch does not have all of the revisions required in "
2477
"order to merge this merge directive and the target "
2478
"location specified in the merge directive is not a branch: "
2481
def __init__(self, location):
2482
BzrError.__init__(self)
2483
self.location = location
2486
class UnsupportedInventoryKind(BzrError):
2488
_fmt = """Unsupported entry kind %(kind)s"""
2490
def __init__(self, kind):
2494
class BadSubsumeSource(BzrError):
2496
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2498
def __init__(self, tree, other_tree, reason):
2500
self.other_tree = other_tree
2501
self.reason = reason
2504
class SubsumeTargetNeedsUpgrade(BzrError):
2506
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2508
def __init__(self, other_tree):
2509
self.other_tree = other_tree
2512
class BadReferenceTarget(InternalBzrError):
2514
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2517
def __init__(self, tree, other_tree, reason):
2519
self.other_tree = other_tree
2520
self.reason = reason
2523
class NoSuchTag(BzrError):
2525
_fmt = "No such tag: %(tag_name)s"
2527
def __init__(self, tag_name):
2528
self.tag_name = tag_name
2531
class TagsNotSupported(BzrError):
2533
_fmt = ("Tags not supported by %(branch)s;"
2534
" you may be able to use bzr upgrade.")
2536
def __init__(self, branch):
2537
self.branch = branch
2540
class TagAlreadyExists(BzrError):
2542
_fmt = "Tag %(tag_name)s already exists."
2544
def __init__(self, tag_name):
2545
self.tag_name = tag_name
2548
class MalformedBugIdentifier(BzrError):
2550
_fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2551
'See "bzr help bugs" for more information on this feature.')
2553
def __init__(self, bug_id, reason):
2554
self.bug_id = bug_id
2555
self.reason = reason
2558
class InvalidBugTrackerURL(BzrError):
2560
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2561
"contain {id}: %(url)s")
2563
def __init__(self, abbreviation, url):
2564
self.abbreviation = abbreviation
2568
class UnknownBugTrackerAbbreviation(BzrError):
2570
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2573
def __init__(self, abbreviation, branch):
2574
self.abbreviation = abbreviation
2575
self.branch = branch
2578
class InvalidLineInBugsProperty(BzrError):
2580
_fmt = ("Invalid line in bugs property: '%(line)s'")
2582
def __init__(self, line):
2586
class InvalidBugStatus(BzrError):
2588
_fmt = ("Invalid bug status: '%(status)s'")
2590
def __init__(self, status):
2591
self.status = status
2594
class UnexpectedSmartServerResponse(BzrError):
2596
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2598
def __init__(self, response_tuple):
2599
self.response_tuple = response_tuple
2602
class ErrorFromSmartServer(BzrError):
2603
"""An error was received from a smart server.
2605
:seealso: UnknownErrorFromSmartServer
2608
_fmt = "Error received from smart server: %(error_tuple)r"
2610
internal_error = True
2612
def __init__(self, error_tuple):
2613
self.error_tuple = error_tuple
2615
self.error_verb = error_tuple[0]
2617
self.error_verb = None
2618
self.error_args = error_tuple[1:]
2621
class UnknownErrorFromSmartServer(BzrError):
2622
"""An ErrorFromSmartServer could not be translated into a typical bzrlib
2625
This is distinct from ErrorFromSmartServer so that it is possible to
2626
distinguish between the following two cases:
2627
- ErrorFromSmartServer was uncaught. This is logic error in the client
2628
and so should provoke a traceback to the user.
2629
- ErrorFromSmartServer was caught but its error_tuple could not be
2630
translated. This is probably because the server sent us garbage, and
2631
should not provoke a traceback.
2634
_fmt = "Server sent an unexpected error: %(error_tuple)r"
2636
internal_error = False
2638
def __init__(self, error_from_smart_server):
2641
:param error_from_smart_server: An ErrorFromSmartServer instance.
2643
self.error_from_smart_server = error_from_smart_server
2644
self.error_tuple = error_from_smart_server.error_tuple
2647
class ContainerError(BzrError):
2648
"""Base class of container errors."""
2651
class UnknownContainerFormatError(ContainerError):
2653
_fmt = "Unrecognised container format: %(container_format)r"
2655
def __init__(self, container_format):
2656
self.container_format = container_format
2659
class UnexpectedEndOfContainerError(ContainerError):
2661
_fmt = "Unexpected end of container stream"
2664
class UnknownRecordTypeError(ContainerError):
2666
_fmt = "Unknown record type: %(record_type)r"
2668
def __init__(self, record_type):
2669
self.record_type = record_type
2672
class InvalidRecordError(ContainerError):
2674
_fmt = "Invalid record: %(reason)s"
2676
def __init__(self, reason):
2677
self.reason = reason
2680
class ContainerHasExcessDataError(ContainerError):
2682
_fmt = "Container has data after end marker: %(excess)r"
2684
def __init__(self, excess):
2685
self.excess = excess
2688
class DuplicateRecordNameError(ContainerError):
2690
_fmt = "Container has multiple records with the same name: %(name)s"
2692
def __init__(self, name):
2696
class NoDestinationAddress(InternalBzrError):
2698
_fmt = "Message does not have a destination address."
2701
class RepositoryDataStreamError(BzrError):
2703
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2705
def __init__(self, reason):
2706
self.reason = reason
2709
class SMTPError(BzrError):
2711
_fmt = "SMTP error: %(error)s"
2713
def __init__(self, error):
2717
class NoMessageSupplied(BzrError):
2719
_fmt = "No message supplied."
2722
class NoMailAddressSpecified(BzrError):
2724
_fmt = "No mail-to address (--mail-to) or output (-o) specified."
2727
class UnknownMailClient(BzrError):
2729
_fmt = "Unknown mail client: %(mail_client)s"
2731
def __init__(self, mail_client):
2732
BzrError.__init__(self, mail_client=mail_client)
2735
class MailClientNotFound(BzrError):
2737
_fmt = "Unable to find mail client with the following names:"\
2738
" %(mail_command_list_string)s"
2740
def __init__(self, mail_command_list):
2741
mail_command_list_string = ', '.join(mail_command_list)
2742
BzrError.__init__(self, mail_command_list=mail_command_list,
2743
mail_command_list_string=mail_command_list_string)
2745
class SMTPConnectionRefused(SMTPError):
2747
_fmt = "SMTP connection to %(host)s refused"
2749
def __init__(self, error, host):
2754
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2756
_fmt = "Please specify smtp_server. No server at default %(host)s."
2759
class BzrDirError(BzrError):
2761
def __init__(self, bzrdir):
2762
import bzrlib.urlutils as urlutils
2763
display_url = urlutils.unescape_for_display(bzrdir.user_url,
2765
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2768
class UnsyncedBranches(BzrDirError):
2770
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2771
" bzr help sync-for-reconfigure.")
2773
def __init__(self, bzrdir, target_branch):
2774
BzrDirError.__init__(self, bzrdir)
2775
import bzrlib.urlutils as urlutils
2776
self.target_url = urlutils.unescape_for_display(target_branch.base,
2780
class AlreadyBranch(BzrDirError):
2782
_fmt = "'%(display_url)s' is already a branch."
2785
class AlreadyTree(BzrDirError):
2787
_fmt = "'%(display_url)s' is already a tree."
2790
class AlreadyCheckout(BzrDirError):
2792
_fmt = "'%(display_url)s' is already a checkout."
2795
class AlreadyLightweightCheckout(BzrDirError):
2797
_fmt = "'%(display_url)s' is already a lightweight checkout."
2800
class AlreadyUsingShared(BzrDirError):
2802
_fmt = "'%(display_url)s' is already using a shared repository."
2805
class AlreadyStandalone(BzrDirError):
2807
_fmt = "'%(display_url)s' is already standalone."
2810
class AlreadyWithTrees(BzrDirError):
2812
_fmt = ("Shared repository '%(display_url)s' already creates "
2816
class AlreadyWithNoTrees(BzrDirError):
2818
_fmt = ("Shared repository '%(display_url)s' already doesn't create "
2822
class ReconfigurationNotSupported(BzrDirError):
2824
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2827
class NoBindLocation(BzrDirError):
2829
_fmt = "No location could be found to bind to at %(display_url)s."
2832
class UncommittedChanges(BzrError):
2834
_fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2835
' (See bzr status).%(more)s')
2837
def __init__(self, tree, more=None):
2842
import bzrlib.urlutils as urlutils
2843
display_url = urlutils.unescape_for_display(
2844
tree.user_url, 'ascii')
2845
BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2848
class ShelvedChanges(UncommittedChanges):
2850
_fmt = ('Working tree "%(display_url)s" has shelved changes'
2851
' (See bzr shelve --list).%(more)s')
2854
class MissingTemplateVariable(BzrError):
2856
_fmt = 'Variable {%(name)s} is not available.'
2858
def __init__(self, name):
2862
class NoTemplate(BzrError):
2864
_fmt = 'No template specified.'
2867
class UnableCreateSymlink(BzrError):
2869
_fmt = 'Unable to create symlink %(path_str)son this platform'
2871
def __init__(self, path=None):
2875
path_str = repr(str(path))
2876
except UnicodeEncodeError:
2877
path_str = repr(path)
2879
self.path_str = path_str
2882
class UnsupportedTimezoneFormat(BzrError):
2884
_fmt = ('Unsupported timezone format "%(timezone)s", '
2885
'options are "utc", "original", "local".')
2887
def __init__(self, timezone):
2888
self.timezone = timezone
2891
class CommandAvailableInPlugin(StandardError):
2893
internal_error = False
2895
def __init__(self, cmd_name, plugin_metadata, provider):
2897
self.plugin_metadata = plugin_metadata
2898
self.cmd_name = cmd_name
2899
self.provider = provider
2903
_fmt = ('"%s" is not a standard bzr command. \n'
2904
'However, the following official plugin provides this command: %s\n'
2905
'You can install it by going to: %s'
2906
% (self.cmd_name, self.plugin_metadata['name'],
2907
self.plugin_metadata['url']))
2912
class NoPluginAvailable(BzrError):
2916
class UnableEncodePath(BzrError):
2918
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2919
'user encoding %(user_encoding)s')
2921
def __init__(self, path, kind):
2922
from bzrlib.osutils import get_user_encoding
2925
self.user_encoding = osutils.get_user_encoding()
2928
class NoSuchAlias(BzrError):
2930
_fmt = ('The alias "%(alias_name)s" does not exist.')
2932
def __init__(self, alias_name):
2933
BzrError.__init__(self, alias_name=alias_name)
2936
class DirectoryLookupFailure(BzrError):
2937
"""Base type for lookup errors."""
2942
class InvalidLocationAlias(DirectoryLookupFailure):
2944
_fmt = '"%(alias_name)s" is not a valid location alias.'
2946
def __init__(self, alias_name):
2947
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2950
class UnsetLocationAlias(DirectoryLookupFailure):
2952
_fmt = 'No %(alias_name)s location assigned.'
2954
def __init__(self, alias_name):
2955
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2958
class CannotBindAddress(BzrError):
2960
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2962
def __init__(self, host, port, orig_error):
2963
# nb: in python2.4 socket.error doesn't have a useful repr
2964
BzrError.__init__(self, host=host, port=port,
2965
orig_error=repr(orig_error.args))
2968
class UnknownRules(BzrError):
2970
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
2972
def __init__(self, unknowns):
2973
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2976
class HookFailed(BzrError):
2977
"""Raised when a pre_change_branch_tip hook function fails anything other
2978
than TipChangeRejected.
2980
Note that this exception is no longer raised, and the import is only left
2981
to be nice to code which might catch it in a plugin.
2984
_fmt = ("Hook '%(hook_name)s' during %(hook_stage)s failed:\n"
2985
"%(traceback_text)s%(exc_value)s")
2987
def __init__(self, hook_stage, hook_name, exc_info, warn=True):
2989
symbol_versioning.warn("BzrError HookFailed has been deprecated "
2990
"as of bzrlib 2.1.", DeprecationWarning, stacklevel=2)
2992
self.hook_stage = hook_stage
2993
self.hook_name = hook_name
2994
self.exc_info = exc_info
2995
self.exc_type = exc_info[0]
2996
self.exc_value = exc_info[1]
2997
self.exc_tb = exc_info[2]
2998
self.traceback_text = ''.join(traceback.format_tb(self.exc_tb))
3001
class TipChangeRejected(BzrError):
3002
"""A pre_change_branch_tip hook function may raise this to cleanly and
3003
explicitly abort a change to a branch tip.
3006
_fmt = u"Tip change rejected: %(msg)s"
3008
def __init__(self, msg):
3012
class ShelfCorrupt(BzrError):
3014
_fmt = "Shelf corrupt."
3017
class NoSuchShelfId(BzrError):
3019
_fmt = 'No changes are shelved with id "%(shelf_id)d".'
3021
def __init__(self, shelf_id):
3022
BzrError.__init__(self, shelf_id=shelf_id)
3025
class InvalidShelfId(BzrError):
3027
_fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
3029
def __init__(self, invalid_id):
3030
BzrError.__init__(self, invalid_id=invalid_id)
3033
class JailBreak(BzrError):
3035
_fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
3037
def __init__(self, url):
3038
BzrError.__init__(self, url=url)
3041
class UserAbort(BzrError):
3043
_fmt = 'The user aborted the operation.'
3046
class MustHaveWorkingTree(BzrError):
3048
_fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
3050
def __init__(self, format, url):
3051
BzrError.__init__(self, format=format, url=url)
3054
class NoSuchView(BzrError):
3055
"""A view does not exist.
3058
_fmt = u"No such view: %(view_name)s."
3060
def __init__(self, view_name):
3061
self.view_name = view_name
3064
class ViewsNotSupported(BzrError):
3065
"""Views are not supported by a tree format.
3068
_fmt = ("Views are not supported by %(tree)s;"
3069
" use 'bzr upgrade' to change your tree to a later format.")
3071
def __init__(self, tree):
3075
class FileOutsideView(BzrError):
3077
_fmt = ('Specified file "%(file_name)s" is outside the current view: '
3080
def __init__(self, file_name, view_files):
3081
self.file_name = file_name
3082
self.view_str = ", ".join(view_files)
3085
class UnresumableWriteGroup(BzrError):
3087
_fmt = ("Repository %(repository)s cannot resume write group "
3088
"%(write_groups)r: %(reason)s")
3090
internal_error = True
3092
def __init__(self, repository, write_groups, reason):
3093
self.repository = repository
3094
self.write_groups = write_groups
3095
self.reason = reason
3098
class UnsuspendableWriteGroup(BzrError):
3100
_fmt = ("Repository %(repository)s cannot suspend a write group.")
3102
internal_error = True
3104
def __init__(self, repository):
3105
self.repository = repository
3108
class LossyPushToSameVCS(BzrError):
3110
_fmt = ("Lossy push not possible between %(source_branch)r and "
3111
"%(target_branch)r that are in the same VCS.")
3113
internal_error = True
3115
def __init__(self, source_branch, target_branch):
3116
self.source_branch = source_branch
3117
self.target_branch = target_branch
3120
class NoRoundtrippingSupport(BzrError):
3122
_fmt = ("Roundtripping is not supported between %(source_branch)r and "
3123
"%(target_branch)r.")
3125
internal_error = True
3127
def __init__(self, source_branch, target_branch):
3128
self.source_branch = source_branch
3129
self.target_branch = target_branch
3132
class FileTimestampUnavailable(BzrError):
3134
_fmt = "The filestamp for %(path)s is not available."
3136
internal_error = True
3138
def __init__(self, path):
3142
class NoColocatedBranchSupport(BzrError):
3144
_fmt = ("%(bzrdir)r does not support co-located branches.")
3146
def __init__(self, bzrdir):
3147
self.bzrdir = bzrdir
3150
class NoWhoami(BzrError):
3152
_fmt = ('Unable to determine your name.\n'
3153
"Please, set your name with the 'whoami' command.\n"
3154
'E.g. bzr whoami "Your Name <name@example.com>"')
3157
class InvalidPattern(BzrError):
3159
_fmt = ('Invalid pattern(s) found. %(msg)s')
3161
def __init__(self, msg):
3165
class RecursiveBind(BzrError):
3167
_fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
3168
'Please use `bzr unbind` to fix.')
3170
def __init__(self, branch_url):
3171
self.branch_url = branch_url