127
127
def __str__(self):
129
# __str__() should always return a 'str' object
130
# never a 'unicode' object.
131
s = self.__doc__ % self.__dict__
132
if isinstance(s, unicode):
133
return s.encode('utf8')
135
except (TypeError, NameError, ValueError, KeyError), e:
136
return 'Unprintable exception %s(%r): %s' \
137
% (self.__class__.__name__,
138
self.__dict__, str(e))
129
return self.__doc__ % self.__dict__
130
except (NameError, ValueError, KeyError), e:
131
return 'Unprintable exception %s: %s' \
132
% (self.__class__.__name__, str(e))
141
135
class BzrCheckError(BzrNewError):
325
304
(use bzr checkout if you wish to build a working tree): %(path)s"""
328
class AtomicFileAlreadyClosed(PathError):
329
"""'%(function)s' called on an AtomicFile after it was closed: %(path)s"""
331
def __init__(self, path, function):
332
PathError.__init__(self, path=path, extra=None)
333
self.function = function
336
class InaccessibleParent(PathError):
337
"""Parent not accessible given base %(base)s and relative path %(path)s"""
339
def __init__(self, path, base):
340
PathError.__init__(self, path)
344
307
class NoRepositoryPresent(BzrNewError):
345
308
"""No repository present: %(path)r"""
346
309
def __init__(self, bzrdir):
525
489
is_user_error = False
527
491
def __init__(self, branch, revision):
528
BzrNewError.__init__(self, branch=branch, revision=revision)
531
class NoSuchRevisionSpec(BzrNewError):
532
"""No namespace registered for string: %(spec)r"""
534
def __init__(self, spec):
535
BzrNewError.__init__(self, spec=spec)
538
class InvalidRevisionSpec(BzrNewError):
539
"""Requested revision: '%(spec)s' does not exist in branch:
540
%(branch)s%(extra)s"""
542
def __init__(self, spec, branch, extra=None):
543
BzrNewError.__init__(self, branch=branch, spec=spec)
545
self.extra = '\n' + str(extra)
493
self.revision = revision
550
496
class HistoryMissing(BzrError):
613
559
self.bases = bases
616
class NoCommits(BzrNewError):
617
"""Branch %(branch)s has no commits."""
562
class NoCommits(BzrError):
619
563
def __init__(self, branch):
620
BzrNewError.__init__(self, branch=branch)
564
msg = "Branch %s has no commits." % branch
565
BzrError.__init__(self, msg)
623
568
class UnlistableStore(BzrError):
998
930
self.format = format
1001
class BadConversionTarget(BzrNewError):
1002
"""Cannot convert to format %(format)s. %(problem)s"""
1004
def __init__(self, problem, format):
1005
BzrNewError.__init__(self)
1006
self.problem = problem
1007
self.format = format
1010
933
class NoDiff(BzrNewError):
1011
934
"""Diff is not installed on this machine: %(msg)s"""
1013
936
def __init__(self, msg):
1014
BzrNewError.__init__(self, msg=msg)
937
super(NoDiff, self).__init__(msg=msg)
1017
940
class NoDiff3(BzrNewError):
1122
1045
"""Not a bzr revision-bundle: %(text)r"""
1124
1047
def __init__(self, text):
1125
BzrNewError.__init__(self)
1129
class BadBundle(BzrNewError):
1130
"""Bad bzr revision-bundle: %(text)r"""
1132
def __init__(self, text):
1133
BzrNewError.__init__(self)
1137
class MalformedHeader(BadBundle):
1138
"""Malformed bzr revision-bundle header: %(text)r"""
1140
def __init__(self, text):
1141
BzrNewError.__init__(self)
1145
class MalformedPatches(BadBundle):
1146
"""Malformed patches in bzr revision-bundle: %(text)r"""
1148
def __init__(self, text):
1149
BzrNewError.__init__(self)
1153
class MalformedFooter(BadBundle):
1154
"""Malformed footer in bzr revision-bundle: %(text)r"""
1156
def __init__(self, text):
1157
BzrNewError.__init__(self)
1161
class UnsupportedEOLMarker(BadBundle):
1162
"""End of line marker was not \\n in bzr revision-bundle"""
1165
BzrNewError.__init__(self)
1168
class BadInventoryFormat(BzrNewError):
1169
"""Root class for inventory serialization errors"""
1172
class UnexpectedInventoryFormat(BadInventoryFormat):
1173
"""The inventory was not in the expected format:\n %(msg)s"""
1175
def __init__(self, msg):
1176
BadInventoryFormat.__init__(self, msg=msg)
1179
class NoSmartServer(NotBranchError):
1180
"""No smart server available at %(url)s"""
1182
def __init__(self, url):
1186
class UnknownSSH(BzrNewError):
1187
"""Unrecognised value for BZR_SSH environment variable: %(vendor)s"""
1189
def __init__(self, vendor):
1190
BzrNewError.__init__(self)
1191
self.vendor = vendor
1194
class GhostRevisionUnusableHere(BzrNewError):
1195
"""Ghost revision {%(revision_id)s} cannot be used here."""
1197
def __init__(self, revision_id):
1198
BzrNewError.__init__(self)
1199
self.revision_id = revision_id
1202
class IllegalUseOfScopeReplacer(BzrNewError):
1203
"""ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"""
1205
is_user_error = False
1207
def __init__(self, name, msg, extra=None):
1208
BzrNewError.__init__(self)
1212
self.extra = ': ' + str(extra)
1217
class InvalidImportLine(BzrNewError):
1218
"""Not a valid import statement: %(msg)\n%(text)s"""
1220
is_user_error = False
1222
def __init__(self, text, msg):
1223
BzrNewError.__init__(self)
1228
class ImportNameCollision(BzrNewError):
1229
"""Tried to import an object to the same name as an existing object. %(name)s"""
1231
is_user_error = False
1233
def __init__(self, name):
1234
BzrNewError.__init__(self)
1051
class BadBundle(Exception): pass
1054
class MalformedHeader(BadBundle): pass
1057
class MalformedPatches(BadBundle): pass
1060
class MalformedFooter(BadBundle): pass