824
1666
class InvalidHttpRange(InvalidHttpResponse):
825
"""Invalid http range "%(range)s" for %(path)s: %(msg)s"""
1668
_fmt = "Invalid http range %(range)r for %(path)s: %(msg)s"
827
1670
def __init__(self, path, range, msg):
828
1671
self.range = range
829
1672
InvalidHttpResponse.__init__(self, path, msg)
832
1675
class InvalidHttpContentType(InvalidHttpResponse):
833
"""Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s"""
1677
_fmt = 'Invalid http Content-type "%(ctype)s" for %(path)s: %(msg)s'
835
1679
def __init__(self, path, ctype, msg):
836
1680
self.ctype = ctype
837
1681
InvalidHttpResponse.__init__(self, path, msg)
1684
class RedirectRequested(TransportError):
1686
_fmt = '%(source)s is%(permanently)s redirected to %(target)s'
1688
def __init__(self, source, target, is_permanent=False):
1689
self.source = source
1690
self.target = target
1692
self.permanently = ' permanently'
1694
self.permanently = ''
1695
TransportError.__init__(self)
1698
class TooManyRedirections(TransportError):
1700
_fmt = "Too many redirections"
840
1703
class ConflictsInTree(BzrError):
842
BzrError.__init__(self, "Working tree has conflicts.")
1705
_fmt = "Working tree has conflicts."
845
1708
class ParseConfigError(BzrError):
846
1710
def __init__(self, errors, filename):
847
1711
if filename is None:
849
1713
message = "Error(s) parsing config file %s:\n%s" % \
850
(filename, ('\n'.join(e.message for e in errors)))
1714
(filename, ('\n'.join(e.msg for e in errors)))
851
1715
BzrError.__init__(self, message)
1718
class NoEmailInUsername(BzrError):
1720
_fmt = "%(username)r does not seem to contain a reasonable email address"
1722
def __init__(self, username):
1723
BzrError.__init__(self)
1724
self.username = username
854
1727
class SigningFailed(BzrError):
1729
_fmt = 'Failed to gpg sign data with command "%(command_line)s"'
855
1731
def __init__(self, command_line):
856
BzrError.__init__(self, "Failed to gpg sign data with command '%s'"
1732
BzrError.__init__(self, command_line=command_line)
860
1735
class WorkingTreeNotRevision(BzrError):
1737
_fmt = ("The working tree for %(basedir)s has changed since"
1738
" the last commit, but weave merge requires that it be"
861
1741
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"""
1742
BzrError.__init__(self, basedir=tree.basedir)
1745
class CantReprocessAndShowBase(BzrError):
1747
_fmt = ("Can't reprocess and show base, because reprocessing obscures "
1748
"the relationship of conflicting lines to the base")
1751
class GraphCycleError(BzrError):
1753
_fmt = "Cycle in graph %(graph)r"
874
1755
def __init__(self, graph):
875
BzrNewError.__init__(self)
1756
BzrError.__init__(self)
876
1757
self.graph = graph
879
class NotConflicted(BzrNewError):
880
"""File %(filename)s is not conflicted."""
1760
class WritingCompleted(InternalBzrError):
1762
_fmt = ("The MediumRequest '%(request)s' has already had finish_writing "
1763
"called upon it - accept bytes may not be called anymore.")
1765
def __init__(self, request):
1766
self.request = request
1769
class WritingNotComplete(InternalBzrError):
1771
_fmt = ("The MediumRequest '%(request)s' has not has finish_writing "
1772
"called upon it - until the write phase is complete no "
1773
"data may be read.")
1775
def __init__(self, request):
1776
self.request = request
1779
class NotConflicted(BzrError):
1781
_fmt = "File %(filename)s is not conflicted."
882
1783
def __init__(self, filename):
883
BzrNewError.__init__(self)
1784
BzrError.__init__(self)
884
1785
self.filename = filename
1788
class MediumNotConnected(InternalBzrError):
1790
_fmt = """The medium '%(medium)s' is not connected."""
1792
def __init__(self, medium):
1793
self.medium = medium
887
1796
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"""
1798
_fmt = "A decorating function has requested its original command be used."
1801
class NoBundleFound(BzrError):
1803
_fmt = 'No bundle was found in "%(filename)s".'
896
1805
def __init__(self, filename):
897
BzrNewError.__init__(self)
1806
BzrError.__init__(self)
898
1807
self.filename = filename
901
class BundleNotSupported(BzrNewError):
902
"""Unable to handle bundle version %(version)s: %(msg)s"""
1810
class BundleNotSupported(BzrError):
1812
_fmt = "Unable to handle bundle version %(version)s: %(msg)s"
903
1814
def __init__(self, version, msg):
904
BzrNewError.__init__(self)
1815
BzrError.__init__(self)
905
1816
self.version = version
909
class MissingText(BzrNewError):
910
"""Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"""
1820
class MissingText(BzrError):
1822
_fmt = ("Branch %(base)s is missing revision"
1823
" %(text_revision)s of %(file_id)s")
912
1825
def __init__(self, branch, text_revision, file_id):
913
BzrNewError.__init__(self)
1826
BzrError.__init__(self)
914
1827
self.branch = branch
915
1828
self.base = branch.base
916
1829
self.text_revision = text_revision
917
1830
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.
1833
class DuplicateFileId(BzrError):
1835
_fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
1837
def __init__(self, file_id, entry):
1838
BzrError.__init__(self)
1839
self.file_id = file_id
1843
class DuplicateKey(BzrError):
1845
_fmt = "Key %(key)s is already present in map"
1848
class DuplicateHelpPrefix(BzrError):
1850
_fmt = "The prefix %(prefix)s is in the help search path twice."
1852
def __init__(self, prefix):
1853
self.prefix = prefix
1856
class MalformedTransform(BzrError):
1858
_fmt = "Tree transform is malformed %(conflicts)r"
1861
class NoFinalPath(BzrError):
1863
_fmt = ("No final name for trans_id %(trans_id)r\n"
1864
"file-id: %(file_id)r\n"
1865
"root trans-id: %(root_trans_id)r\n")
1867
def __init__(self, trans_id, transform):
1868
self.trans_id = trans_id
1869
self.file_id = transform.final_file_id(trans_id)
1870
self.root_trans_id = transform.root
1873
class BzrBadParameter(InternalBzrError):
1875
_fmt = "Bad parameter: %(param)r"
1877
# This exception should never be thrown, but it is a base class for all
1878
# parameter-to-function errors.
934
1880
def __init__(self, param):
935
BzrNewError.__init__(self)
1881
BzrError.__init__(self)
936
1882
self.param = param
939
1885
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"""
1887
_fmt = "Parameter %(param)s is neither unicode nor utf8."
1890
class ReusingTransform(BzrError):
1892
_fmt = "Attempt to reuse a transform that has already been applied."
1895
class CantMoveRoot(BzrError):
1897
_fmt = "Moving the root directory is not supported at this time"
1900
class BzrMoveFailedError(BzrError):
1902
_fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1904
def __init__(self, from_path='', to_path='', extra=None):
1905
from bzrlib.osutils import splitpath
1906
BzrError.__init__(self)
1908
self.extra = ': ' + str(extra)
1912
has_from = len(from_path) > 0
1913
has_to = len(to_path) > 0
1915
self.from_path = splitpath(from_path)[-1]
1920
self.to_path = splitpath(to_path)[-1]
1925
if has_from and has_to:
1926
self.operator = " =>"
1928
self.from_path = "from " + from_path
1930
self.operator = "to"
1932
self.operator = "file"
1935
class BzrRenameFailedError(BzrMoveFailedError):
1937
_fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
1939
def __init__(self, from_path, to_path, extra=None):
1940
BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1942
class BzrRemoveChangedFilesError(BzrError):
1943
"""Used when user is trying to remove changed files."""
1945
_fmt = ("Can't safely remove modified or unknown files:\n"
1946
"%(changes_as_text)s"
1947
"Use --keep to not delete them, or --force to delete them regardless.")
1949
def __init__(self, tree_delta):
1950
BzrError.__init__(self)
1951
self.changes_as_text = tree_delta.get_changes_as_text()
1952
#self.paths_as_string = '\n'.join(changed_files)
1953
#self.paths_as_string = '\n'.join([quotefn(p) for p in changed_files])
951
1956
class BzrBadParameterNotString(BzrBadParameter):
952
"""Parameter %(param)s is not a string or unicode string."""
1958
_fmt = "Parameter %(param)s is not a string or unicode string."
955
1961
class BzrBadParameterMissing(BzrBadParameter):
956
"""Parameter $(param)s is required but not present."""
1963
_fmt = "Parameter $(param)s is required but not present."
959
1966
class BzrBadParameterUnicode(BzrBadParameter):
960
"""Parameter %(param)s is unicode but only byte-strings are permitted."""
1968
_fmt = ("Parameter %(param)s is unicode but"
1969
" only byte-strings are permitted.")
963
1972
class BzrBadParameterContainsNewline(BzrBadParameter):
964
"""Parameter %(param)s contains a newline."""
967
class DependencyNotPresent(BzrNewError):
968
"""Unable to import library "%(library)s": %(error)s"""
1974
_fmt = "Parameter %(param)s contains a newline."
1977
class DependencyNotPresent(BzrError):
1979
_fmt = 'Unable to import library "%(library)s": %(error)s'
970
1981
def __init__(self, library, error):
971
BzrNewError.__init__(self, library=library, error=error)
1982
BzrError.__init__(self, library=library, error=error)
974
1985
class ParamikoNotPresent(DependencyNotPresent):
975
"""Unable to import paramiko (required for sftp support): %(error)s"""
1987
_fmt = "Unable to import paramiko (required for sftp support): %(error)s"
977
1989
def __init__(self, error):
978
1990
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."""
1993
class PointlessMerge(BzrError):
1995
_fmt = "Nothing to merge."
1998
class UninitializableFormat(BzrError):
2000
_fmt = "Format %(format)s cannot be initialised by this version of bzr."
988
2002
def __init__(self, format):
989
BzrNewError.__init__(self)
2003
BzrError.__init__(self)
990
2004
self.format = format
993
class BadConversionTarget(BzrNewError):
994
"""Cannot convert to format %(format)s. %(problem)s"""
2007
class BadConversionTarget(BzrError):
2009
_fmt = "Cannot convert to format %(format)s. %(problem)s"
996
2011
def __init__(self, problem, format):
997
BzrNewError.__init__(self)
2012
BzrError.__init__(self)
998
2013
self.problem = problem
999
2014
self.format = format
1002
class NoDiff(BzrNewError):
1003
"""Diff is not installed on this machine: %(msg)s"""
2017
class NoDiffFound(BzrError):
2019
_fmt = 'Could not find an appropriate Differ for file "%(path)s"'
2021
def __init__(self, path):
2022
BzrError.__init__(self, path)
2025
class ExecutableMissing(BzrError):
2027
_fmt = "%(exe_name)s could not be found on this machine"
2029
def __init__(self, exe_name):
2030
BzrError.__init__(self, exe_name=exe_name)
2033
class NoDiff(BzrError):
2035
_fmt = "Diff is not installed on this machine: %(msg)s"
1005
2037
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)
2038
BzrError.__init__(self, msg=msg)
2041
class NoDiff3(BzrError):
2043
_fmt = "Diff3 is not installed on this machine."
2046
class ExistingContent(BzrError):
2047
# Added in bzrlib 0.92, used by VersionedFile.add_lines.
2049
_fmt = "The content being inserted is already present."
2052
class ExistingLimbo(BzrError):
2054
_fmt = """This tree contains left-over files from a failed operation.
2055
Please examine %(limbo_dir)s to see if it contains any files you wish to
2056
keep, and delete it when you are done."""
2058
def __init__(self, limbo_dir):
2059
BzrError.__init__(self)
2060
self.limbo_dir = limbo_dir
2063
class ExistingPendingDeletion(BzrError):
2065
_fmt = """This tree contains left-over files from a failed operation.
2066
Please examine %(pending_deletion)s to see if it contains any files you
2067
wish to keep, and delete it when you are done."""
2069
def __init__(self, pending_deletion):
2070
BzrError.__init__(self, pending_deletion=pending_deletion)
2073
class ImmortalLimbo(BzrError):
2075
_fmt = """Unable to delete transform temporary directory %(limbo_dir)s.
2076
Please examine %(limbo_dir)s to see if it contains any files you wish to
2077
keep, and delete it when you are done."""
2079
def __init__(self, limbo_dir):
2080
BzrError.__init__(self)
2081
self.limbo_dir = limbo_dir
2084
class ImmortalPendingDeletion(BzrError):
2086
_fmt = ("Unable to delete transform temporary directory "
2087
"%(pending_deletion)s. Please examine %(pending_deletion)s to see if it "
2088
"contains any files you wish to keep, and delete it when you are done.")
2090
def __init__(self, pending_deletion):
2091
BzrError.__init__(self, pending_deletion=pending_deletion)
2094
class OutOfDateTree(BzrError):
2096
_fmt = "Working tree is out of date, please run 'bzr update'.%(more)s"
2098
def __init__(self, tree, more=None):
2103
BzrError.__init__(self)
1038
2104
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."""
2108
class PublicBranchOutOfDate(BzrError):
2110
_fmt = 'Public branch "%(public_location)s" lacks revision '\
2113
def __init__(self, public_location, revstring):
2114
import bzrlib.urlutils as urlutils
2115
public_location = urlutils.unescape_for_display(public_location,
2117
BzrError.__init__(self, public_location=public_location,
2118
revstring=revstring)
2121
class MergeModifiedFormatError(BzrError):
2123
_fmt = "Error in merge modified format"
2126
class ConflictFormatError(BzrError):
2128
_fmt = "Format error in conflict listings"
2131
class CorruptDirstate(BzrError):
2133
_fmt = ("Inconsistency in dirstate file %(dirstate_path)s.\n"
2134
"Error: %(description)s")
2136
def __init__(self, dirstate_path, description):
2137
BzrError.__init__(self)
2138
self.dirstate_path = dirstate_path
2139
self.description = description
2142
class CorruptRepository(BzrError):
2144
_fmt = ("An error has been detected in the repository %(repo_path)s.\n"
2145
"Please run bzr reconcile on this repository.")
1053
2147
def __init__(self, repo):
1054
BzrNewError.__init__(self)
2148
BzrError.__init__(self)
1055
2149
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."""
2152
class InconsistentDelta(BzrError):
2153
"""Used when we get a delta that is not valid."""
2155
_fmt = ("An inconsistent delta was supplied involving %(path)r,"
2156
" %(file_id)r\nreason: %(reason)s")
2158
def __init__(self, path, file_id, reason):
2159
BzrError.__init__(self)
2161
self.file_id = file_id
2162
self.reason = reason
2165
class InconsistentDeltaDelta(InconsistentDelta):
2166
"""Used when we get a delta that is not valid."""
2168
_fmt = ("An inconsistent delta was supplied: %(delta)r"
2169
"\nreason: %(reason)s")
2171
def __init__(self, delta, reason):
2172
BzrError.__init__(self)
2174
self.reason = reason
2177
class UpgradeRequired(BzrError):
2179
_fmt = "To use this feature you must upgrade your branch at %(path)s."
1061
2181
def __init__(self, path):
1062
BzrNewError.__init__(self)
2182
BzrError.__init__(self)
1063
2183
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."""
2186
class RepositoryUpgradeRequired(UpgradeRequired):
2188
_fmt = "To use this feature you must upgrade your repository at %(path)s."
2191
class RichRootUpgradeRequired(UpgradeRequired):
2193
_fmt = ("To use this feature you must upgrade your branch at %(path)s to"
2194
" a format which supports rich roots.")
2197
class LocalRequiresBoundBranch(BzrError):
2199
_fmt = "Cannot perform local-only commits on unbound branches."
2202
class UnsupportedOperation(BzrError):
2204
_fmt = ("The method %(mname)s is not supported on"
2205
" objects of type %(tname)s.")
1084
2207
def __init__(self, method, method_self):
1085
2208
self.method = method
1086
2209
self.mname = method.__name__
1087
2210
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"""
2213
class CannotSetRevisionId(UnsupportedOperation):
2214
"""Raised when a commit is attempting to set a revision id but cant."""
2217
class NonAsciiRevisionId(UnsupportedOperation):
2218
"""Raised when a commit is attempting to set a non-ascii revision id
2223
class BinaryFile(BzrError):
2225
_fmt = "File is binary but should be text."
2228
class IllegalPath(BzrError):
2230
_fmt = "The path %(path)s is not permitted on this platform"
1097
2232
def __init__(self, path):
1098
BzrNewError.__init__(self)
2233
BzrError.__init__(self)
1099
2234
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
2237
class TestamentMismatch(BzrError):
2239
_fmt = """Testament did not match expected value.
2240
For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1107
2243
def __init__(self, revision_id, expected, measured):
1108
2244
self.revision_id = revision_id
1109
2245
self.expected = expected
1110
2246
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)
2249
class NotABundle(BzrError):
2251
_fmt = "Not a bzr revision-bundle: %(text)r"
2253
def __init__(self, text):
2254
BzrError.__init__(self)
2258
class BadBundle(BzrError):
2260
_fmt = "Bad bzr revision-bundle: %(text)r"
2262
def __init__(self, text):
2263
BzrError.__init__(self)
2267
class MalformedHeader(BadBundle):
2269
_fmt = "Malformed bzr revision-bundle header: %(text)r"
2272
class MalformedPatches(BadBundle):
2274
_fmt = "Malformed patches in bzr revision-bundle: %(text)r"
2277
class MalformedFooter(BadBundle):
2279
_fmt = "Malformed footer in bzr revision-bundle: %(text)r"
1153
2282
class UnsupportedEOLMarker(BadBundle):
1154
"""End of line marker was not \\n in bzr revision-bundle"""
2284
_fmt = "End of line marker was not \\n in bzr revision-bundle"
1156
2286
def __init__(self):
1157
BzrNewError.__init__(self)
1160
class BadInventoryFormat(BzrNewError):
1161
"""Root class for inventory serialization errors"""
2287
# XXX: BadBundle's constructor assumes there's explanatory text,
2288
# but for this there is not
2289
BzrError.__init__(self)
2292
class IncompatibleBundleFormat(BzrError):
2294
_fmt = "Bundle format %(bundle_format)s is incompatible with %(other)s"
2296
def __init__(self, bundle_format, other):
2297
BzrError.__init__(self)
2298
self.bundle_format = bundle_format
2302
class BadInventoryFormat(BzrError):
2304
_fmt = "Root class for inventory serialization errors"
1164
2307
class UnexpectedInventoryFormat(BadInventoryFormat):
1165
"""The inventory was not in the expected format:\n %(msg)s"""
2309
_fmt = "The inventory was not in the expected format:\n %(msg)s"
1167
2311
def __init__(self, msg):
1168
2312
BadInventoryFormat.__init__(self, msg=msg)
1171
class UnknownSSH(BzrNewError):
1172
"""Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
2315
class RootNotRich(BzrError):
2317
_fmt = """This operation requires rich root data storage"""
2320
class NoSmartMedium(InternalBzrError):
2322
_fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
2324
def __init__(self, transport):
2325
self.transport = transport
2328
class UnknownSSH(BzrError):
2330
_fmt = "Unrecognised value for BZR_SSH environment variable: %(vendor)s"
1174
2332
def __init__(self, vendor):
1175
BzrNewError.__init__(self)
2333
BzrError.__init__(self)
1176
2334
self.vendor = vendor
1179
class GhostRevisionUnusableHere(BzrNewError):
1180
"""Ghost revision {%(revision_id)s} cannot be used here."""
2337
class SSHVendorNotFound(BzrError):
2339
_fmt = ("Don't know how to handle SSH connections."
2340
" Please set BZR_SSH environment variable.")
2343
class GhostRevisionsHaveNoRevno(BzrError):
2344
"""When searching for revnos, if we encounter a ghost, we are stuck"""
2346
_fmt = ("Could not determine revno for {%(revision_id)s} because"
2347
" its ancestry shows a ghost at {%(ghost_revision_id)s}")
2349
def __init__(self, revision_id, ghost_revision_id):
2350
self.revision_id = revision_id
2351
self.ghost_revision_id = ghost_revision_id
2354
class GhostRevisionUnusableHere(BzrError):
2356
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1182
2358
def __init__(self, revision_id):
1183
BzrNewError.__init__(self)
2359
BzrError.__init__(self)
1184
2360
self.revision_id = revision_id
2363
class IllegalUseOfScopeReplacer(InternalBzrError):
2365
_fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
2366
" %(msg)s%(extra)s")
2368
def __init__(self, name, msg, extra=None):
2369
BzrError.__init__(self)
2373
self.extra = ': ' + str(extra)
2378
class InvalidImportLine(InternalBzrError):
2380
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
2382
def __init__(self, text, msg):
2383
BzrError.__init__(self)
2388
class ImportNameCollision(InternalBzrError):
2390
_fmt = ("Tried to import an object to the same name as"
2391
" an existing object. %(name)s")
2393
def __init__(self, name):
2394
BzrError.__init__(self)
2398
class NotAMergeDirective(BzrError):
2399
"""File starting with %(firstline)r is not a merge directive"""
2400
def __init__(self, firstline):
2401
BzrError.__init__(self, firstline=firstline)
2404
class NoMergeSource(BzrError):
2405
"""Raise if no merge source was specified for a merge directive"""
2407
_fmt = "A merge directive must provide either a bundle or a public"\
2411
class IllegalMergeDirectivePayload(BzrError):
2412
"""A merge directive contained something other than a patch or bundle"""
2414
_fmt = "Bad merge directive payload %(start)r"
2416
def __init__(self, start):
2421
class PatchVerificationFailed(BzrError):
2422
"""A patch from a merge directive could not be verified"""
2424
_fmt = "Preview patch does not match requested changes."
2427
class PatchMissing(BzrError):
2428
"""Raise a patch type was specified but no patch supplied"""
2430
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2432
def __init__(self, patch_type):
2433
BzrError.__init__(self)
2434
self.patch_type = patch_type
2437
class TargetNotBranch(BzrError):
2438
"""A merge directive's target branch is required, but isn't a branch"""
2440
_fmt = ("Your branch does not have all of the revisions required in "
2441
"order to merge this merge directive and the target "
2442
"location specified in the merge directive is not a branch: "
2445
def __init__(self, location):
2446
BzrError.__init__(self)
2447
self.location = location
2450
class UnsupportedInventoryKind(BzrError):
2452
_fmt = """Unsupported entry kind %(kind)s"""
2454
def __init__(self, kind):
2458
class BadSubsumeSource(BzrError):
2460
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2462
def __init__(self, tree, other_tree, reason):
2464
self.other_tree = other_tree
2465
self.reason = reason
2468
class SubsumeTargetNeedsUpgrade(BzrError):
2470
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2472
def __init__(self, other_tree):
2473
self.other_tree = other_tree
2476
class BadReferenceTarget(InternalBzrError):
2478
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2481
def __init__(self, tree, other_tree, reason):
2483
self.other_tree = other_tree
2484
self.reason = reason
2487
class NoSuchTag(BzrError):
2489
_fmt = "No such tag: %(tag_name)s"
2491
def __init__(self, tag_name):
2492
self.tag_name = tag_name
2495
class TagsNotSupported(BzrError):
2497
_fmt = ("Tags not supported by %(branch)s;"
2498
" you may be able to use bzr upgrade.")
2500
def __init__(self, branch):
2501
self.branch = branch
2504
class TagAlreadyExists(BzrError):
2506
_fmt = "Tag %(tag_name)s already exists."
2508
def __init__(self, tag_name):
2509
self.tag_name = tag_name
2512
class MalformedBugIdentifier(BzrError):
2514
_fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2515
'See "bzr help bugs" for more information on this feature.')
2517
def __init__(self, bug_id, reason):
2518
self.bug_id = bug_id
2519
self.reason = reason
2522
class InvalidBugTrackerURL(BzrError):
2524
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2525
"contain {id}: %(url)s")
2527
def __init__(self, abbreviation, url):
2528
self.abbreviation = abbreviation
2532
class UnknownBugTrackerAbbreviation(BzrError):
2534
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2537
def __init__(self, abbreviation, branch):
2538
self.abbreviation = abbreviation
2539
self.branch = branch
2542
class InvalidLineInBugsProperty(BzrError):
2544
_fmt = ("Invalid line in bugs property: '%(line)s'")
2546
def __init__(self, line):
2550
class InvalidBugStatus(BzrError):
2552
_fmt = ("Invalid bug status: '%(status)s'")
2554
def __init__(self, status):
2555
self.status = status
2558
class UnexpectedSmartServerResponse(BzrError):
2560
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2562
def __init__(self, response_tuple):
2563
self.response_tuple = response_tuple
2566
class ErrorFromSmartServer(BzrError):
2567
"""An error was received from a smart server.
2569
:seealso: UnknownErrorFromSmartServer
2572
_fmt = "Error received from smart server: %(error_tuple)r"
2574
internal_error = True
2576
def __init__(self, error_tuple):
2577
self.error_tuple = error_tuple
2579
self.error_verb = error_tuple[0]
2581
self.error_verb = None
2582
self.error_args = error_tuple[1:]
2585
class UnknownErrorFromSmartServer(BzrError):
2586
"""An ErrorFromSmartServer could not be translated into a typical bzrlib
2589
This is distinct from ErrorFromSmartServer so that it is possible to
2590
distinguish between the following two cases:
2591
- ErrorFromSmartServer was uncaught. This is logic error in the client
2592
and so should provoke a traceback to the user.
2593
- ErrorFromSmartServer was caught but its error_tuple could not be
2594
translated. This is probably because the server sent us garbage, and
2595
should not provoke a traceback.
2598
_fmt = "Server sent an unexpected error: %(error_tuple)r"
2600
internal_error = False
2602
def __init__(self, error_from_smart_server):
2605
:param error_from_smart_server: An ErrorFromSmartServer instance.
2607
self.error_from_smart_server = error_from_smart_server
2608
self.error_tuple = error_from_smart_server.error_tuple
2611
class ContainerError(BzrError):
2612
"""Base class of container errors."""
2615
class UnknownContainerFormatError(ContainerError):
2617
_fmt = "Unrecognised container format: %(container_format)r"
2619
def __init__(self, container_format):
2620
self.container_format = container_format
2623
class UnexpectedEndOfContainerError(ContainerError):
2625
_fmt = "Unexpected end of container stream"
2628
class UnknownRecordTypeError(ContainerError):
2630
_fmt = "Unknown record type: %(record_type)r"
2632
def __init__(self, record_type):
2633
self.record_type = record_type
2636
class InvalidRecordError(ContainerError):
2638
_fmt = "Invalid record: %(reason)s"
2640
def __init__(self, reason):
2641
self.reason = reason
2644
class ContainerHasExcessDataError(ContainerError):
2646
_fmt = "Container has data after end marker: %(excess)r"
2648
def __init__(self, excess):
2649
self.excess = excess
2652
class DuplicateRecordNameError(ContainerError):
2654
_fmt = "Container has multiple records with the same name: %(name)s"
2656
def __init__(self, name):
2660
class NoDestinationAddress(InternalBzrError):
2662
_fmt = "Message does not have a destination address."
2665
class RepositoryDataStreamError(BzrError):
2667
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2669
def __init__(self, reason):
2670
self.reason = reason
2673
class SMTPError(BzrError):
2675
_fmt = "SMTP error: %(error)s"
2677
def __init__(self, error):
2681
class NoMessageSupplied(BzrError):
2683
_fmt = "No message supplied."
2686
class NoMailAddressSpecified(BzrError):
2688
_fmt = "No mail-to address (--mail-to) or output (-o) specified."
2691
class UnknownMailClient(BzrError):
2693
_fmt = "Unknown mail client: %(mail_client)s"
2695
def __init__(self, mail_client):
2696
BzrError.__init__(self, mail_client=mail_client)
2699
class MailClientNotFound(BzrError):
2701
_fmt = "Unable to find mail client with the following names:"\
2702
" %(mail_command_list_string)s"
2704
def __init__(self, mail_command_list):
2705
mail_command_list_string = ', '.join(mail_command_list)
2706
BzrError.__init__(self, mail_command_list=mail_command_list,
2707
mail_command_list_string=mail_command_list_string)
2709
class SMTPConnectionRefused(SMTPError):
2711
_fmt = "SMTP connection to %(host)s refused"
2713
def __init__(self, error, host):
2718
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2720
_fmt = "Please specify smtp_server. No server at default %(host)s."
2723
class BzrDirError(BzrError):
2725
def __init__(self, bzrdir):
2726
import bzrlib.urlutils as urlutils
2727
display_url = urlutils.unescape_for_display(bzrdir.root_transport.base,
2729
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2732
class UnsyncedBranches(BzrDirError):
2734
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2735
" bzr help sync-for-reconfigure.")
2737
def __init__(self, bzrdir, target_branch):
2738
BzrDirError.__init__(self, bzrdir)
2739
import bzrlib.urlutils as urlutils
2740
self.target_url = urlutils.unescape_for_display(target_branch.base,
2744
class AlreadyBranch(BzrDirError):
2746
_fmt = "'%(display_url)s' is already a branch."
2749
class AlreadyTree(BzrDirError):
2751
_fmt = "'%(display_url)s' is already a tree."
2754
class AlreadyCheckout(BzrDirError):
2756
_fmt = "'%(display_url)s' is already a checkout."
2759
class AlreadyLightweightCheckout(BzrDirError):
2761
_fmt = "'%(display_url)s' is already a lightweight checkout."
2764
class AlreadyUsingShared(BzrDirError):
2766
_fmt = "'%(display_url)s' is already using a shared repository."
2769
class AlreadyStandalone(BzrDirError):
2771
_fmt = "'%(display_url)s' is already standalone."
2774
class AlreadyWithTrees(BzrDirError):
2776
_fmt = ("Shared repository '%(display_url)s' already creates "
2780
class AlreadyWithNoTrees(BzrDirError):
2782
_fmt = ("Shared repository '%(display_url)s' already doesn't create "
2786
class ReconfigurationNotSupported(BzrDirError):
2788
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2791
class NoBindLocation(BzrDirError):
2793
_fmt = "No location could be found to bind to at %(display_url)s."
2796
class UncommittedChanges(BzrError):
2798
_fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2799
' (See bzr status).%(more)s')
2801
def __init__(self, tree, more=None):
2806
import bzrlib.urlutils as urlutils
2807
display_url = urlutils.unescape_for_display(
2808
tree.bzrdir.root_transport.base, 'ascii')
2809
BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2812
class MissingTemplateVariable(BzrError):
2814
_fmt = 'Variable {%(name)s} is not available.'
2816
def __init__(self, name):
2820
class NoTemplate(BzrError):
2822
_fmt = 'No template specified.'
2825
class UnableCreateSymlink(BzrError):
2827
_fmt = 'Unable to create symlink %(path_str)son this platform'
2829
def __init__(self, path=None):
2833
path_str = repr(str(path))
2834
except UnicodeEncodeError:
2835
path_str = repr(path)
2837
self.path_str = path_str
2840
class UnsupportedTimezoneFormat(BzrError):
2842
_fmt = ('Unsupported timezone format "%(timezone)s", '
2843
'options are "utc", "original", "local".')
2845
def __init__(self, timezone):
2846
self.timezone = timezone
2849
class CommandAvailableInPlugin(StandardError):
2851
internal_error = False
2853
def __init__(self, cmd_name, plugin_metadata, provider):
2855
self.plugin_metadata = plugin_metadata
2856
self.cmd_name = cmd_name
2857
self.provider = provider
2861
_fmt = ('"%s" is not a standard bzr command. \n'
2862
'However, the following official plugin provides this command: %s\n'
2863
'You can install it by going to: %s'
2864
% (self.cmd_name, self.plugin_metadata['name'],
2865
self.plugin_metadata['url']))
2870
class NoPluginAvailable(BzrError):
2874
class UnableEncodePath(BzrError):
2876
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2877
'user encoding %(user_encoding)s')
2879
def __init__(self, path, kind):
2880
from bzrlib.osutils import get_user_encoding
2883
self.user_encoding = osutils.get_user_encoding()
2886
class NoSuchAlias(BzrError):
2888
_fmt = ('The alias "%(alias_name)s" does not exist.')
2890
def __init__(self, alias_name):
2891
BzrError.__init__(self, alias_name=alias_name)
2894
class DirectoryLookupFailure(BzrError):
2895
"""Base type for lookup errors."""
2900
class InvalidLocationAlias(DirectoryLookupFailure):
2902
_fmt = '"%(alias_name)s" is not a valid location alias.'
2904
def __init__(self, alias_name):
2905
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2908
class UnsetLocationAlias(DirectoryLookupFailure):
2910
_fmt = 'No %(alias_name)s location assigned.'
2912
def __init__(self, alias_name):
2913
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2916
class CannotBindAddress(BzrError):
2918
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2920
def __init__(self, host, port, orig_error):
2921
BzrError.__init__(self, host=host, port=port,
2922
orig_error=orig_error[1])
2925
class UnknownRules(BzrError):
2927
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
2929
def __init__(self, unknowns):
2930
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2933
class HookFailed(BzrError):
2934
"""Raised when a pre_change_branch_tip hook function fails anything other
2935
than TipChangeRejected.
2938
_fmt = ("Hook '%(hook_name)s' during %(hook_stage)s failed:\n"
2939
"%(traceback_text)s%(exc_value)s")
2941
def __init__(self, hook_stage, hook_name, exc_info):
2943
self.hook_stage = hook_stage
2944
self.hook_name = hook_name
2945
self.exc_info = exc_info
2946
self.exc_type = exc_info[0]
2947
self.exc_value = exc_info[1]
2948
self.exc_tb = exc_info[2]
2949
self.traceback_text = ''.join(traceback.format_tb(self.exc_tb))
2952
class TipChangeRejected(BzrError):
2953
"""A pre_change_branch_tip hook function may raise this to cleanly and
2954
explicitly abort a change to a branch tip.
2957
_fmt = u"Tip change rejected: %(msg)s"
2959
def __init__(self, msg):
2963
class ShelfCorrupt(BzrError):
2965
_fmt = "Shelf corrupt."
2968
class NoSuchShelfId(BzrError):
2970
_fmt = 'No changes are shelved with id "%(shelf_id)d".'
2972
def __init__(self, shelf_id):
2973
BzrError.__init__(self, shelf_id=shelf_id)
2976
class InvalidShelfId(BzrError):
2978
_fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
2980
def __init__(self, invalid_id):
2981
BzrError.__init__(self, invalid_id=invalid_id)
2984
class JailBreak(BzrError):
2986
_fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
2988
def __init__(self, url):
2989
BzrError.__init__(self, url=url)
2992
class UserAbort(BzrError):
2994
_fmt = 'The user aborted the operation.'
2997
class MustHaveWorkingTree(BzrError):
2999
_fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
3001
def __init__(self, format, url):
3002
BzrError.__init__(self, format=format, url=url)
3005
class NoSuchView(BzrError):
3006
"""A view does not exist.
3009
_fmt = u"No such view: %(view_name)s."
3011
def __init__(self, view_name):
3012
self.view_name = view_name
3015
class ViewsNotSupported(BzrError):
3016
"""Views are not supported by a tree format.
3019
_fmt = ("Views are not supported by %(tree)s;"
3020
" use 'bzr upgrade' to change your tree to a later format.")
3022
def __init__(self, tree):
3026
class FileOutsideView(BzrError):
3028
_fmt = ('Specified file "%(file_name)s" is outside the current view: '
3031
def __init__(self, file_name, view_files):
3032
self.file_name = file_name
3033
self.view_str = ", ".join(view_files)
3036
class UnresumableWriteGroup(BzrError):
3038
_fmt = ("Repository %(repository)s cannot resume write group "
3039
"%(write_groups)r: %(reason)s")
3041
internal_error = True
3043
def __init__(self, repository, write_groups, reason):
3044
self.repository = repository
3045
self.write_groups = write_groups
3046
self.reason = reason
3049
class UnsuspendableWriteGroup(BzrError):
3051
_fmt = ("Repository %(repository)s cannot suspend a write group.")
3053
internal_error = True
3055
def __init__(self, repository):
3056
self.repository = repository
3059
class LossyPushToSameVCS(BzrError):
3061
_fmt = ("Lossy push not possible between %(source_branch)r and "
3062
"%(target_branch)r that are in the same VCS.")
3064
internal_error = True
3066
def __init__(self, source_branch, target_branch):
3067
self.source_branch = source_branch
3068
self.target_branch = target_branch