1694
815
class InvalidHttpRange(InvalidHttpResponse):
1696
_fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
816
"""Invalid http range "%(range)s" for %(path)s: %(msg)s"""
1698
818
def __init__(self, path, range, msg):
1699
819
self.range = range
1700
820
InvalidHttpResponse.__init__(self, path, msg)
1703
823
class InvalidHttpContentType(InvalidHttpResponse):
1705
_fmt = 'Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s'
824
"""Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s"""
1707
826
def __init__(self, path, ctype, msg):
1708
827
self.ctype = ctype
1709
828
InvalidHttpResponse.__init__(self, path, msg)
1712
class RedirectRequested(TransportError):
1714
_fmt = '%(source)s is%(permanently)s redirected to %(target)s'
1716
def __init__(self, source, target, is_permanent=False):
1717
self.source = source
1718
self.target = target
1720
self.permanently = ' permanently'
1722
self.permanently = ''
1723
TransportError.__init__(self)
1726
class TooManyRedirections(TransportError):
1728
_fmt = "Too many redirections"
1731
831
class ConflictsInTree(BzrError):
1733
_fmt = "Working tree has conflicts."
833
BzrError.__init__(self, "Working tree has conflicts.")
1736
836
class ParseConfigError(BzrError):
1738
837
def __init__(self, errors, filename):
1739
838
if filename is None:
1741
840
message = "Error(s) parsing config file %s:\n%s" % \
1742
(filename, ('\n'.join(e.msg for e in errors)))
841
(filename, ('\n'.join(e.message for e in errors)))
1743
842
BzrError.__init__(self, message)
1746
class NoEmailInUsername(BzrError):
1748
_fmt = "%(username)r does not seem to contain a reasonable email address"
1750
def __init__(self, username):
1751
BzrError.__init__(self)
1752
self.username = username
1755
845
class SigningFailed(BzrError):
1757
_fmt = 'Failed to gpg sign data with command "%(command_line)s"'
1759
846
def __init__(self, command_line):
1760
BzrError.__init__(self, command_line=command_line)
847
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
1763
851
class WorkingTreeNotRevision(BzrError):
1765
_fmt = ("The working tree for %(basedir)s has changed since"
1766
" the last commit, but weave merge requires that it be"
1769
852
def __init__(self, tree):
1770
BzrError.__init__(self, basedir=tree.basedir)
1773
class CantReprocessAndShowBase(BzrError):
1775
_fmt = ("Can't reprocess and show base, because reprocessing obscures "
1776
"the relationship of conflicting lines to the base")
1779
class GraphCycleError(BzrError):
1781
_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"""
1783
865
def __init__(self, graph):
1784
BzrError.__init__(self)
866
BzrNewError.__init__(self)
1785
867
self.graph = graph
1788
class WritingCompleted(InternalBzrError):
1790
_fmt = ("The MediumRequest '%(request)s' has already had finish_writing "
1791
"called upon it - accept bytes may not be called anymore.")
1793
def __init__(self, request):
1794
self.request = request
1797
class WritingNotComplete(InternalBzrError):
1799
_fmt = ("The MediumRequest '%(request)s' has not has finish_writing "
1800
"called upon it - until the write phase is complete no "
1801
"data may be read.")
1803
def __init__(self, request):
1804
self.request = request
1807
class NotConflicted(BzrError):
1809
_fmt = "File %(filename)s is not conflicted."
870
class NotConflicted(BzrNewError):
871
"""File %(filename)s is not conflicted."""
1811
873
def __init__(self, filename):
1812
BzrError.__init__(self)
874
BzrNewError.__init__(self)
1813
875
self.filename = filename
1816
class MediumNotConnected(InternalBzrError):
1818
_fmt = """The medium '%(medium)s' is not connected."""
1820
def __init__(self, medium):
1821
self.medium = medium
1824
878
class MustUseDecorated(Exception):
1826
_fmt = "A decorating function has requested its original command be used."
1829
class NoBundleFound(BzrError):
1831
_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"""
1833
887
def __init__(self, filename):
1834
BzrError.__init__(self)
888
BzrNewError.__init__(self)
1835
889
self.filename = filename
1838
class BundleNotSupported(BzrError):
1840
_fmt = "Unable to handle bundle version %(version)s: %(msg)s"
892
class BundleNotSupported(BzrNewError):
893
"""Unable to handle bundle version %(version)s: %(msg)s"""
1842
894
def __init__(self, version, msg):
1843
BzrError.__init__(self)
895
BzrNewError.__init__(self)
1844
896
self.version = version
1848
class MissingText(BzrError):
1850
_fmt = ("Branch %(base)s is missing revision"
1851
" %(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"""
1853
903
def __init__(self, branch, text_revision, file_id):
1854
BzrError.__init__(self)
904
BzrNewError.__init__(self)
1855
905
self.branch = branch
1856
906
self.base = branch.base
1857
907
self.text_revision = text_revision
1858
908
self.file_id = file_id
1861
class DuplicateFileId(BzrError):
1863
_fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1865
def __init__(self, file_id, entry):
1866
BzrError.__init__(self)
1867
self.file_id = file_id
1871
class DuplicateKey(BzrError):
1873
_fmt = "Key %(key)s is already present in map"
1876
class DuplicateHelpPrefix(BzrError):
1878
_fmt = "The prefix %(prefix)s is in the help search path twice."
1880
def __init__(self, prefix):
1881
self.prefix = prefix
1884
class MalformedTransform(BzrError):
1886
_fmt = "Tree transform is malformed %(conflicts)r"
1889
class NoFinalPath(BzrError):
1891
_fmt = ("No final name for trans_id %(trans_id)r\n"
1892
"file-id: %(file_id)r\n"
1893
"root trans-id: %(root_trans_id)r\n")
1895
def __init__(self, trans_id, transform):
1896
self.trans_id = trans_id
1897
self.file_id = transform.final_file_id(trans_id)
1898
self.root_trans_id = transform.root
1901
class BzrBadParameter(InternalBzrError):
1903
_fmt = "Bad parameter: %(param)r"
1905
# This exception should never be thrown, but it is a base class for all
1906
# 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.
1908
925
def __init__(self, param):
1909
BzrError.__init__(self)
926
BzrNewError.__init__(self)
1910
927
self.param = param
1913
930
class BzrBadParameterNotUnicode(BzrBadParameter):
1915
_fmt = "Parameter %(param)s is neither unicode nor utf8."
1918
class ReusingTransform(BzrError):
1920
_fmt = "Attempt to reuse a transform that has already been applied."
1923
class CantMoveRoot(BzrError):
1925
_fmt = "Moving the root directory is not supported at this time"
1928
class TransformRenameFailed(BzrError):
1930
_fmt = "Failed to rename %(from_path)s to %(to_path)s: %(why)s"
1932
def __init__(self, from_path, to_path, why, errno):
1933
self.from_path = from_path
1934
self.to_path = to_path
1939
class BzrMoveFailedError(BzrError):
1941
_fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1943
def __init__(self, from_path='', to_path='', extra=None):
1944
from bzrlib.osutils import splitpath
1945
BzrError.__init__(self)
1947
self.extra = ': ' + str(extra)
1951
has_from = len(from_path) > 0
1952
has_to = len(to_path) > 0
1954
self.from_path = splitpath(from_path)[-1]
1959
self.to_path = splitpath(to_path)[-1]
1964
if has_from and has_to:
1965
self.operator = " =>"
1967
self.from_path = "from " + from_path
1969
self.operator = "to"
1971
self.operator = "file"
1974
class BzrRenameFailedError(BzrMoveFailedError):
1976
_fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
1978
def __init__(self, from_path, to_path, extra=None):
1979
BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1981
class BzrRemoveChangedFilesError(BzrError):
1982
"""Used when user is trying to remove changed files."""
1984
_fmt = ("Can't safely remove modified or unknown files:\n"
1985
"%(changes_as_text)s"
1986
"Use --keep to not delete them, or --force to delete them regardless.")
1988
def __init__(self, tree_delta):
1989
BzrError.__init__(self)
1990
self.changes_as_text = tree_delta.get_changes_as_text()
1991
#self.paths_as_string = '\n'.join(changed_files)
1992
#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"""
1995
942
class BzrBadParameterNotString(BzrBadParameter):
1997
_fmt = "Parameter %(param)s is not a string or unicode string."
943
"""Parameter %(param)s is not a string or unicode string."""
2000
946
class BzrBadParameterMissing(BzrBadParameter):
2002
_fmt = "Parameter $(param)s is required but not present."
947
"""Parameter $(param)s is required but not present."""
2005
950
class BzrBadParameterUnicode(BzrBadParameter):
2007
_fmt = ("Parameter %(param)s is unicode but"
2008
" only byte-strings are permitted.")
951
"""Parameter %(param)s is unicode but only byte-strings are permitted."""
2011
954
class BzrBadParameterContainsNewline(BzrBadParameter):
2013
_fmt = "Parameter %(param)s contains a newline."
2016
class DependencyNotPresent(BzrError):
2018
_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"""
2020
961
def __init__(self, library, error):
2021
BzrError.__init__(self, library=library, error=error)
962
BzrNewError.__init__(self, library=library, error=error)
2024
965
class ParamikoNotPresent(DependencyNotPresent):
2026
_fmt = "Unable to import paramiko (required for sftp support): %(error)s"
966
"""Unable to import paramiko (required for sftp support): %(error)s"""
2028
968
def __init__(self, error):
2029
969
DependencyNotPresent.__init__(self, 'paramiko', error)
2032
class PointlessMerge(BzrError):
2034
_fmt = "Nothing to merge."
2037
class UninitializableFormat(BzrError):
2039
_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."""
2041
975
def __init__(self, format):
2042
BzrError.__init__(self)
2043
self.format = format
2046
class BadConversionTarget(BzrError):
2048
_fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
2051
def __init__(self, problem, format, from_format=None):
2052
BzrError.__init__(self)
2053
self.problem = problem
2054
self.format = format
2055
self.from_format = from_format or '(unspecified)'
2058
class NoDiffFound(BzrError):
2060
_fmt = 'Could not find an appropriate Differ for file "%(path)s"'
2062
def __init__(self, path):
2063
BzrError.__init__(self, path)
2066
class ExecutableMissing(BzrError):
2068
_fmt = "%(exe_name)s could not be found on this machine"
2070
def __init__(self, exe_name):
2071
BzrError.__init__(self, exe_name=exe_name)
2074
class NoDiff(BzrError):
2076
_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"""
2078
983
def __init__(self, msg):
2079
BzrError.__init__(self, msg=msg)
2082
class NoDiff3(BzrError):
2084
_fmt = "Diff3 is not installed on this machine."
2087
class ExistingContent(BzrError):
2088
# Added in bzrlib 0.92, used by VersionedFile.add_lines.
2090
_fmt = "The content being inserted is already present."
2093
class ExistingLimbo(BzrError):
2095
_fmt = """This tree contains left-over files from a failed operation.
2096
Please examine %(limbo_dir)s to see if it contains any files you wish to
2097
keep, and delete it when you are done."""
2099
def __init__(self, limbo_dir):
2100
BzrError.__init__(self)
2101
self.limbo_dir = limbo_dir
2104
class ExistingPendingDeletion(BzrError):
2106
_fmt = """This tree contains left-over files from a failed operation.
2107
Please examine %(pending_deletion)s to see if it contains any files you
2108
wish to keep, and delete it when you are done."""
2110
def __init__(self, pending_deletion):
2111
BzrError.__init__(self, pending_deletion=pending_deletion)
2114
class ImmortalLimbo(BzrError):
2116
_fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
2117
Please examine %(limbo_dir)s to see if it contains any files you wish to
2118
keep, and delete it when you are done."""
2120
def __init__(self, limbo_dir):
2121
BzrError.__init__(self)
2122
self.limbo_dir = limbo_dir
2125
class ImmortalPendingDeletion(BzrError):
2127
_fmt = ("Unable to delete transform temporary directory "
2128
"%(pending_deletion)s. Please examine %(pending_deletion)s to see if it "
2129
"contains any files you wish to keep, and delete it when you are done.")
2131
def __init__(self, pending_deletion):
2132
BzrError.__init__(self, pending_deletion=pending_deletion)
2135
class OutOfDateTree(BzrError):
2137
_fmt = "Working tree is out of date, please run 'bzr update'.%(more)s"
2139
def __init__(self, tree, more=None):
2144
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)
2145
1016
self.tree = tree
2149
class PublicBranchOutOfDate(BzrError):
2151
_fmt = 'Public branch "%(public_location)s" lacks revision '\
2154
def __init__(self, public_location, revstring):
2155
import bzrlib.urlutils as urlutils
2156
public_location = urlutils.unescape_for_display(public_location,
2158
BzrError.__init__(self, public_location=public_location,
2159
revstring=revstring)
2162
class MergeModifiedFormatError(BzrError):
2164
_fmt = "Error in merge modified format"
2167
class ConflictFormatError(BzrError):
2169
_fmt = "Format error in conflict listings"
2172
class CorruptDirstate(BzrError):
2174
_fmt = ("Inconsistency in dirstate file %(dirstate_path)s.\n"
2175
"Error: %(description)s")
2177
def __init__(self, dirstate_path, description):
2178
BzrError.__init__(self)
2179
self.dirstate_path = dirstate_path
2180
self.description = description
2183
class CorruptRepository(BzrError):
2185
_fmt = ("An error has been detected in the repository %(repo_path)s.\n"
2186
"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."""
2188
1031
def __init__(self, repo):
2189
BzrError.__init__(self)
2190
self.repo_path = repo.user_url
2193
class InconsistentDelta(BzrError):
2194
"""Used when we get a delta that is not valid."""
2196
_fmt = ("An inconsistent delta was supplied involving %(path)r,"
2197
" %(file_id)r\nreason: %(reason)s")
2199
def __init__(self, path, file_id, reason):
2200
BzrError.__init__(self)
2202
self.file_id = file_id
2203
self.reason = reason
2206
class InconsistentDeltaDelta(InconsistentDelta):
2207
"""Used when we get a delta that is not valid."""
2209
_fmt = ("An inconsistent delta was supplied: %(delta)r"
2210
"\nreason: %(reason)s")
2212
def __init__(self, delta, reason):
2213
BzrError.__init__(self)
2215
self.reason = reason
2218
class UpgradeRequired(BzrError):
2220
_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."""
2222
1039
def __init__(self, path):
2223
BzrError.__init__(self)
1040
BzrNewError.__init__(self)
2224
1041
self.path = path
2227
class RepositoryUpgradeRequired(UpgradeRequired):
2229
_fmt = "To use this feature you must upgrade your repository at %(path)s."
2232
class RichRootUpgradeRequired(UpgradeRequired):
2234
_fmt = ("To use this feature you must upgrade your branch at %(path)s to"
2235
" a format which supports rich roots.")
2238
class LocalRequiresBoundBranch(BzrError):
2240
_fmt = "Cannot perform local-only commits on unbound branches."
2243
class UnsupportedOperation(BzrError):
2245
_fmt = ("The method %(mname)s is not supported on"
2246
" 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."""
2248
1062
def __init__(self, method, method_self):
2249
1063
self.method = method
2250
1064
self.mname = method.__name__
2251
1065
self.tname = type(method_self).__name__
2254
class CannotSetRevisionId(UnsupportedOperation):
2255
"""Raised when a commit is attempting to set a revision id but cant."""
2258
class NonAsciiRevisionId(UnsupportedOperation):
2259
"""Raised when a commit is attempting to set a non-ascii revision id
2264
class BinaryFile(BzrError):
2266
_fmt = "File is binary but should be text."
2269
class IllegalPath(BzrError):
2271
_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"""
2273
1075
def __init__(self, path):
2274
BzrError.__init__(self)
1076
BzrNewError.__init__(self)
2275
1077
self.path = path
2278
class TestamentMismatch(BzrError):
2280
_fmt = """Testament did not match expected value.
2281
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
2284
1085
def __init__(self, revision_id, expected, measured):
2285
1086
self.revision_id = revision_id
2286
1087
self.expected = expected
2287
1088
self.measured = measured
2290
class NotABundle(BzrError):
2292
_fmt = "Not a bzr revision-bundle: %(text)r"
2294
def __init__(self, text):
2295
BzrError.__init__(self)
2299
class BadBundle(BzrError):
2301
_fmt = "Bad bzr revision-bundle: %(text)r"
2303
def __init__(self, text):
2304
BzrError.__init__(self)
2308
class MalformedHeader(BadBundle):
2310
_fmt = "Malformed bzr revision-bundle header: %(text)r"
2313
class MalformedPatches(BadBundle):
2315
_fmt = "Malformed patches in bzr revision-bundle: %(text)r"
2318
class MalformedFooter(BadBundle):
2320
_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)
2323
1131
class UnsupportedEOLMarker(BadBundle):
2325
_fmt = "End of line marker was not \\n in bzr revision-bundle"
1132
"""End of line marker was not \\n in bzr revision-bundle"""
2327
1134
def __init__(self):
2328
# XXX: BadBundle's constructor assumes there's explanatory text,
2329
# but for this there is not
2330
BzrError.__init__(self)
2333
class IncompatibleBundleFormat(BzrError):
2335
_fmt = "Bundle format %(bundle_format)s is incompatible with %(other)s"
2337
def __init__(self, bundle_format, other):
2338
BzrError.__init__(self)
2339
self.bundle_format = bundle_format
2343
class BadInventoryFormat(BzrError):
2345
_fmt = "Root class for inventory serialization errors"
2348
class UnexpectedInventoryFormat(BadInventoryFormat):
2350
_fmt = "The inventory was not in the expected format:\n %(msg)s"
2352
def __init__(self, msg):
2353
BadInventoryFormat.__init__(self, msg=msg)
2356
class RootNotRich(BzrError):
2358
_fmt = """This operation requires rich root data storage"""
2361
class NoSmartMedium(InternalBzrError):
2363
_fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
2365
def __init__(self, transport):
2366
self.transport = transport
2369
class UnknownSSH(BzrError):
2371
_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"""
2373
1141
def __init__(self, vendor):
2374
BzrError.__init__(self)
1142
BzrNewError.__init__(self)
2375
1143
self.vendor = vendor
2378
class SSHVendorNotFound(BzrError):
2380
_fmt = ("Don't know how to handle SSH connections."
2381
" Please set BZR_SSH environment variable.")
2384
class GhostRevisionsHaveNoRevno(BzrError):
2385
"""When searching for revnos, if we encounter a ghost, we are stuck"""
2387
_fmt = ("Could not determine revno for {%(revision_id)s} because"
2388
" its ancestry shows a ghost at {%(ghost_revision_id)s}")
2390
def __init__(self, revision_id, ghost_revision_id):
2391
self.revision_id = revision_id
2392
self.ghost_revision_id = ghost_revision_id
2395
class GhostRevisionUnusableHere(BzrError):
2397
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1146
class GhostRevisionUnusableHere(BzrNewError):
1147
"""Ghost revision {%(revision_id)s} cannot be used here."""
2399
1149
def __init__(self, revision_id):
2400
BzrError.__init__(self)
1150
BzrNewError.__init__(self)
2401
1151
self.revision_id = revision_id
2404
class IllegalUseOfScopeReplacer(InternalBzrError):
2406
_fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2407
" %(msg)s%(extra)s")
2409
def __init__(self, name, msg, extra=None):
2410
BzrError.__init__(self)
2414
self.extra = ': ' + str(extra)
2419
class InvalidImportLine(InternalBzrError):
2421
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
2423
def __init__(self, text, msg):
2424
BzrError.__init__(self)
2429
class ImportNameCollision(InternalBzrError):
2431
_fmt = ("Tried to import an object to the same name as"
2432
" an existing object. %(name)s")
2434
def __init__(self, name):
2435
BzrError.__init__(self)
2439
class NotAMergeDirective(BzrError):
2440
"""File starting with %(firstline)r is not a merge directive"""
2441
def __init__(self, firstline):
2442
BzrError.__init__(self, firstline=firstline)
2445
class NoMergeSource(BzrError):
2446
"""Raise if no merge source was specified for a merge directive"""
2448
_fmt = "A merge directive must provide either a bundle or a public"\
2452
class IllegalMergeDirectivePayload(BzrError):
2453
"""A merge directive contained something other than a patch or bundle"""
2455
_fmt = "Bad merge directive payload %(start)r"
2457
def __init__(self, start):
2462
class PatchVerificationFailed(BzrError):
2463
"""A patch from a merge directive could not be verified"""
2465
_fmt = "Preview patch does not match requested changes."
2468
class PatchMissing(BzrError):
2469
"""Raise a patch type was specified but no patch supplied"""
2471
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2473
def __init__(self, patch_type):
2474
BzrError.__init__(self)
2475
self.patch_type = patch_type
2478
class TargetNotBranch(BzrError):
2479
"""A merge directive's target branch is required, but isn't a branch"""
2481
_fmt = ("Your branch does not have all of the revisions required in "
2482
"order to merge this merge directive and the target "
2483
"location specified in the merge directive is not a branch: "
2486
def __init__(self, location):
2487
BzrError.__init__(self)
2488
self.location = location
2491
class UnsupportedInventoryKind(BzrError):
2493
_fmt = """Unsupported entry kind %(kind)s"""
2495
def __init__(self, kind):
2499
class BadSubsumeSource(BzrError):
2501
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2503
def __init__(self, tree, other_tree, reason):
2505
self.other_tree = other_tree
2506
self.reason = reason
2509
class SubsumeTargetNeedsUpgrade(BzrError):
2511
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2513
def __init__(self, other_tree):
2514
self.other_tree = other_tree
2517
class BadReferenceTarget(InternalBzrError):
2519
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2522
def __init__(self, tree, other_tree, reason):
2524
self.other_tree = other_tree
2525
self.reason = reason
2528
class NoSuchTag(BzrError):
2530
_fmt = "No such tag: %(tag_name)s"
2532
def __init__(self, tag_name):
2533
self.tag_name = tag_name
2536
class TagsNotSupported(BzrError):
2538
_fmt = ("Tags not supported by %(branch)s;"
2539
" you may be able to use bzr upgrade.")
2541
def __init__(self, branch):
2542
self.branch = branch
2545
class TagAlreadyExists(BzrError):
2547
_fmt = "Tag %(tag_name)s already exists."
2549
def __init__(self, tag_name):
2550
self.tag_name = tag_name
2553
class MalformedBugIdentifier(BzrError):
2555
_fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2556
'See "bzr help bugs" for more information on this feature.')
2558
def __init__(self, bug_id, reason):
2559
self.bug_id = bug_id
2560
self.reason = reason
2563
class InvalidBugTrackerURL(BzrError):
2565
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2566
"contain {id}: %(url)s")
2568
def __init__(self, abbreviation, url):
2569
self.abbreviation = abbreviation
2573
class UnknownBugTrackerAbbreviation(BzrError):
2575
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2578
def __init__(self, abbreviation, branch):
2579
self.abbreviation = abbreviation
2580
self.branch = branch
2583
class InvalidLineInBugsProperty(BzrError):
2585
_fmt = ("Invalid line in bugs property: '%(line)s'")
2587
def __init__(self, line):
2591
class InvalidBugStatus(BzrError):
2593
_fmt = ("Invalid bug status: '%(status)s'")
2595
def __init__(self, status):
2596
self.status = status
2599
class UnexpectedSmartServerResponse(BzrError):
2601
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2603
def __init__(self, response_tuple):
2604
self.response_tuple = response_tuple
2607
class ErrorFromSmartServer(BzrError):
2608
"""An error was received from a smart server.
2610
:seealso: UnknownErrorFromSmartServer
2613
_fmt = "Error received from smart server: %(error_tuple)r"
2615
internal_error = True
2617
def __init__(self, error_tuple):
2618
self.error_tuple = error_tuple
2620
self.error_verb = error_tuple[0]
2622
self.error_verb = None
2623
self.error_args = error_tuple[1:]
2626
class UnknownErrorFromSmartServer(BzrError):
2627
"""An ErrorFromSmartServer could not be translated into a typical bzrlib
2630
This is distinct from ErrorFromSmartServer so that it is possible to
2631
distinguish between the following two cases:
2632
- ErrorFromSmartServer was uncaught. This is logic error in the client
2633
and so should provoke a traceback to the user.
2634
- ErrorFromSmartServer was caught but its error_tuple could not be
2635
translated. This is probably because the server sent us garbage, and
2636
should not provoke a traceback.
2639
_fmt = "Server sent an unexpected error: %(error_tuple)r"
2641
internal_error = False
2643
def __init__(self, error_from_smart_server):
2646
:param error_from_smart_server: An ErrorFromSmartServer instance.
2648
self.error_from_smart_server = error_from_smart_server
2649
self.error_tuple = error_from_smart_server.error_tuple
2652
class ContainerError(BzrError):
2653
"""Base class of container errors."""
2656
class UnknownContainerFormatError(ContainerError):
2658
_fmt = "Unrecognised container format: %(container_format)r"
2660
def __init__(self, container_format):
2661
self.container_format = container_format
2664
class UnexpectedEndOfContainerError(ContainerError):
2666
_fmt = "Unexpected end of container stream"
2669
class UnknownRecordTypeError(ContainerError):
2671
_fmt = "Unknown record type: %(record_type)r"
2673
def __init__(self, record_type):
2674
self.record_type = record_type
2677
class InvalidRecordError(ContainerError):
2679
_fmt = "Invalid record: %(reason)s"
2681
def __init__(self, reason):
2682
self.reason = reason
2685
class ContainerHasExcessDataError(ContainerError):
2687
_fmt = "Container has data after end marker: %(excess)r"
2689
def __init__(self, excess):
2690
self.excess = excess
2693
class DuplicateRecordNameError(ContainerError):
2695
_fmt = "Container has multiple records with the same name: %(name)s"
2697
def __init__(self, name):
2701
class NoDestinationAddress(InternalBzrError):
2703
_fmt = "Message does not have a destination address."
2706
class RepositoryDataStreamError(BzrError):
2708
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2710
def __init__(self, reason):
2711
self.reason = reason
2714
class SMTPError(BzrError):
2716
_fmt = "SMTP error: %(error)s"
2718
def __init__(self, error):
2722
class NoMessageSupplied(BzrError):
2724
_fmt = "No message supplied."
2727
class NoMailAddressSpecified(BzrError):
2729
_fmt = "No mail-to address (--mail-to) or output (-o) specified."
2732
class UnknownMailClient(BzrError):
2734
_fmt = "Unknown mail client: %(mail_client)s"
2736
def __init__(self, mail_client):
2737
BzrError.__init__(self, mail_client=mail_client)
2740
class MailClientNotFound(BzrError):
2742
_fmt = "Unable to find mail client with the following names:"\
2743
" %(mail_command_list_string)s"
2745
def __init__(self, mail_command_list):
2746
mail_command_list_string = ', '.join(mail_command_list)
2747
BzrError.__init__(self, mail_command_list=mail_command_list,
2748
mail_command_list_string=mail_command_list_string)
2750
class SMTPConnectionRefused(SMTPError):
2752
_fmt = "SMTP connection to %(host)s refused"
2754
def __init__(self, error, host):
2759
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2761
_fmt = "Please specify smtp_server. No server at default %(host)s."
2764
class BzrDirError(BzrError):
2766
def __init__(self, bzrdir):
2767
import bzrlib.urlutils as urlutils
2768
display_url = urlutils.unescape_for_display(bzrdir.user_url,
2770
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2773
class UnsyncedBranches(BzrDirError):
2775
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2776
" bzr help sync-for-reconfigure.")
2778
def __init__(self, bzrdir, target_branch):
2779
BzrDirError.__init__(self, bzrdir)
2780
import bzrlib.urlutils as urlutils
2781
self.target_url = urlutils.unescape_for_display(target_branch.base,
2785
class AlreadyBranch(BzrDirError):
2787
_fmt = "'%(display_url)s' is already a branch."
2790
class AlreadyTree(BzrDirError):
2792
_fmt = "'%(display_url)s' is already a tree."
2795
class AlreadyCheckout(BzrDirError):
2797
_fmt = "'%(display_url)s' is already a checkout."
2800
class AlreadyLightweightCheckout(BzrDirError):
2802
_fmt = "'%(display_url)s' is already a lightweight checkout."
2805
class AlreadyUsingShared(BzrDirError):
2807
_fmt = "'%(display_url)s' is already using a shared repository."
2810
class AlreadyStandalone(BzrDirError):
2812
_fmt = "'%(display_url)s' is already standalone."
2815
class AlreadyWithTrees(BzrDirError):
2817
_fmt = ("Shared repository '%(display_url)s' already creates "
2821
class AlreadyWithNoTrees(BzrDirError):
2823
_fmt = ("Shared repository '%(display_url)s' already doesn't create "
2827
class ReconfigurationNotSupported(BzrDirError):
2829
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2832
class NoBindLocation(BzrDirError):
2834
_fmt = "No location could be found to bind to at %(display_url)s."
2837
class UncommittedChanges(BzrError):
2839
_fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2840
' (See bzr status).%(more)s')
2842
def __init__(self, tree, more=None):
2847
import bzrlib.urlutils as urlutils
2848
display_url = urlutils.unescape_for_display(
2849
tree.user_url, 'ascii')
2850
BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2853
class MissingTemplateVariable(BzrError):
2855
_fmt = 'Variable {%(name)s} is not available.'
2857
def __init__(self, name):
2861
class NoTemplate(BzrError):
2863
_fmt = 'No template specified.'
2866
class UnableCreateSymlink(BzrError):
2868
_fmt = 'Unable to create symlink %(path_str)son this platform'
2870
def __init__(self, path=None):
2874
path_str = repr(str(path))
2875
except UnicodeEncodeError:
2876
path_str = repr(path)
2878
self.path_str = path_str
2881
class UnsupportedTimezoneFormat(BzrError):
2883
_fmt = ('Unsupported timezone format "%(timezone)s", '
2884
'options are "utc", "original", "local".')
2886
def __init__(self, timezone):
2887
self.timezone = timezone
2890
class CommandAvailableInPlugin(StandardError):
2892
internal_error = False
2894
def __init__(self, cmd_name, plugin_metadata, provider):
2896
self.plugin_metadata = plugin_metadata
2897
self.cmd_name = cmd_name
2898
self.provider = provider
2902
_fmt = ('"%s" is not a standard bzr command. \n'
2903
'However, the following official plugin provides this command: %s\n'
2904
'You can install it by going to: %s'
2905
% (self.cmd_name, self.plugin_metadata['name'],
2906
self.plugin_metadata['url']))
2911
class NoPluginAvailable(BzrError):
2915
class UnableEncodePath(BzrError):
2917
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2918
'user encoding %(user_encoding)s')
2920
def __init__(self, path, kind):
2921
from bzrlib.osutils import get_user_encoding
2924
self.user_encoding = osutils.get_user_encoding()
2927
class NoSuchAlias(BzrError):
2929
_fmt = ('The alias "%(alias_name)s" does not exist.')
2931
def __init__(self, alias_name):
2932
BzrError.__init__(self, alias_name=alias_name)
2935
class DirectoryLookupFailure(BzrError):
2936
"""Base type for lookup errors."""
2941
class InvalidLocationAlias(DirectoryLookupFailure):
2943
_fmt = '"%(alias_name)s" is not a valid location alias.'
2945
def __init__(self, alias_name):
2946
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2949
class UnsetLocationAlias(DirectoryLookupFailure):
2951
_fmt = 'No %(alias_name)s location assigned.'
2953
def __init__(self, alias_name):
2954
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2957
class CannotBindAddress(BzrError):
2959
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2961
def __init__(self, host, port, orig_error):
2962
# nb: in python2.4 socket.error doesn't have a useful repr
2963
BzrError.__init__(self, host=host, port=port,
2964
orig_error=repr(orig_error.args))
2967
class UnknownRules(BzrError):
2969
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
2971
def __init__(self, unknowns):
2972
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2975
class HookFailed(BzrError):
2976
"""Raised when a pre_change_branch_tip hook function fails anything other
2977
than TipChangeRejected.
2979
Note that this exception is no longer raised, and the import is only left
2980
to be nice to code which might catch it in a plugin.
2983
_fmt = ("Hook '%(hook_name)s' during %(hook_stage)s failed:\n"
2984
"%(traceback_text)s%(exc_value)s")
2986
def __init__(self, hook_stage, hook_name, exc_info, warn=True):
2988
symbol_versioning.warn("BzrError HookFailed has been deprecated "
2989
"as of bzrlib 2.1.", DeprecationWarning, stacklevel=2)
2991
self.hook_stage = hook_stage
2992
self.hook_name = hook_name
2993
self.exc_info = exc_info
2994
self.exc_type = exc_info[0]
2995
self.exc_value = exc_info[1]
2996
self.exc_tb = exc_info[2]
2997
self.traceback_text = ''.join(traceback.format_tb(self.exc_tb))
3000
class TipChangeRejected(BzrError):
3001
"""A pre_change_branch_tip hook function may raise this to cleanly and
3002
explicitly abort a change to a branch tip.
3005
_fmt = u"Tip change rejected: %(msg)s"
3007
def __init__(self, msg):
3011
class ShelfCorrupt(BzrError):
3013
_fmt = "Shelf corrupt."
3016
class NoSuchShelfId(BzrError):
3018
_fmt = 'No changes are shelved with id "%(shelf_id)d".'
3020
def __init__(self, shelf_id):
3021
BzrError.__init__(self, shelf_id=shelf_id)
3024
class InvalidShelfId(BzrError):
3026
_fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
3028
def __init__(self, invalid_id):
3029
BzrError.__init__(self, invalid_id=invalid_id)
3032
class JailBreak(BzrError):
3034
_fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
3036
def __init__(self, url):
3037
BzrError.__init__(self, url=url)
3040
class UserAbort(BzrError):
3042
_fmt = 'The user aborted the operation.'
3045
class MustHaveWorkingTree(BzrError):
3047
_fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
3049
def __init__(self, format, url):
3050
BzrError.__init__(self, format=format, url=url)
3053
class NoSuchView(BzrError):
3054
"""A view does not exist.
3057
_fmt = u"No such view: %(view_name)s."
3059
def __init__(self, view_name):
3060
self.view_name = view_name
3063
class ViewsNotSupported(BzrError):
3064
"""Views are not supported by a tree format.
3067
_fmt = ("Views are not supported by %(tree)s;"
3068
" use 'bzr upgrade' to change your tree to a later format.")
3070
def __init__(self, tree):
3074
class FileOutsideView(BzrError):
3076
_fmt = ('Specified file "%(file_name)s" is outside the current view: '
3079
def __init__(self, file_name, view_files):
3080
self.file_name = file_name
3081
self.view_str = ", ".join(view_files)
3084
class UnresumableWriteGroup(BzrError):
3086
_fmt = ("Repository %(repository)s cannot resume write group "
3087
"%(write_groups)r: %(reason)s")
3089
internal_error = True
3091
def __init__(self, repository, write_groups, reason):
3092
self.repository = repository
3093
self.write_groups = write_groups
3094
self.reason = reason
3097
class UnsuspendableWriteGroup(BzrError):
3099
_fmt = ("Repository %(repository)s cannot suspend a write group.")
3101
internal_error = True
3103
def __init__(self, repository):
3104
self.repository = repository
3107
class LossyPushToSameVCS(BzrError):
3109
_fmt = ("Lossy push not possible between %(source_branch)r and "
3110
"%(target_branch)r that are in the same VCS.")
3112
internal_error = True
3114
def __init__(self, source_branch, target_branch):
3115
self.source_branch = source_branch
3116
self.target_branch = target_branch
3119
class NoRoundtrippingSupport(BzrError):
3121
_fmt = ("Roundtripping is not supported between %(source_branch)r and "
3122
"%(target_branch)r.")
3124
internal_error = True
3126
def __init__(self, source_branch, target_branch):
3127
self.source_branch = source_branch
3128
self.target_branch = target_branch
3131
class FileTimestampUnavailable(BzrError):
3133
_fmt = "The filestamp for %(path)s is not available."
3135
internal_error = True
3137
def __init__(self, path):
3141
class NoColocatedBranchSupport(BzrError):
3143
_fmt = ("%(bzrdir)r does not support co-located branches.")
3145
def __init__(self, bzrdir):
3146
self.bzrdir = bzrdir
3148
class NoWhoami(BzrError):
3150
_fmt = ('Unable to determine your name.\n'
3151
"Please, set your name with the 'whoami' command.\n"
3152
'E.g. bzr whoami "Your Name <name@example.com>"')