92
124
BzrError.__init__(self, msg)
127
class HistoryMissing(BzrError):
128
def __init__(self, branch, object_type, object_id):
130
BzrError.__init__(self,
131
'%s is missing %s {%s}'
132
% (branch, object_type, object_id))
135
class DivergedBranches(BzrError):
136
def __init__(self, branch1, branch2):
137
BzrError.__init__(self, "These branches have diverged.")
138
self.branch1 = branch1
139
self.branch2 = branch2
142
class UnrelatedBranches(BzrCommandError):
144
msg = "Branches have no common ancestor, and no base revision"\
146
BzrCommandError.__init__(self, msg)
148
class NoCommonAncestor(BzrError):
149
def __init__(self, revision_a, revision_b):
150
msg = "Revisions have no common ancestor: %s %s." \
151
% (revision_a, revision_b)
152
BzrError.__init__(self, msg)
154
class NoCommonRoot(BzrError):
155
def __init__(self, revision_a, revision_b):
156
msg = "Revisions are not derived from the same root: %s %s." \
157
% (revision_a, revision_b)
158
BzrError.__init__(self, msg)
160
class NotAncestor(BzrError):
161
def __init__(self, rev_id, not_ancestor_id):
162
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
164
BzrError.__init__(self, msg)
166
self.not_ancestor_id = not_ancestor_id
169
class NotAncestor(BzrError):
170
def __init__(self, rev_id, not_ancestor_id):
172
self.not_ancestor_id = not_ancestor_id
173
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
175
BzrError.__init__(self, msg)
178
class InstallFailed(BzrError):
179
def __init__(self, revisions):
180
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
181
BzrError.__init__(self, msg)
182
self.revisions = revisions
185
class AmbiguousBase(BzrError):
186
def __init__(self, bases):
187
msg = "The correct base is unclear, becase %s are all equally close" %\
189
BzrError.__init__(self, msg)
192
class NoCommits(BzrError):
193
def __init__(self, branch):
194
msg = "Branch %s has no commits." % branch
195
BzrError.__init__(self, msg)
197
class UnlistableStore(BzrError):
198
def __init__(self, store):
199
BzrError.__init__(self, "Store %s is not listable" % store)
201
class UnlistableBranch(BzrError):
202
def __init__(self, br):
203
BzrError.__init__(self, "Stores for branch %s are not listable" % br)
206
from bzrlib.weave import WeaveError, WeaveParentMismatch
208
class TransportError(BzrError):
209
"""All errors thrown by Transport implementations should derive
212
def __init__(self, msg=None, orig_error=None):
213
if msg is None and orig_error is not None:
214
msg = str(orig_error)
215
BzrError.__init__(self, msg)
217
self.orig_error = orig_error
219
# A set of semi-meaningful errors which can be thrown
220
class TransportNotPossible(TransportError):
221
"""This is for transports where a specific function is explicitly not
222
possible. Such as pushing files to an HTTP server.
226
class NonRelativePath(TransportError):
227
"""An absolute path was supplied, that could not be decoded into
232
class NoSuchFile(TransportError, IOError):
233
"""A get() was issued for a file that doesn't exist."""
235
# XXX: Is multiple inheritance for exceptions really needed?
238
return 'no such file: ' + self.msg
240
def __init__(self, msg=None, orig_error=None):
242
TransportError.__init__(self, msg=msg, orig_error=orig_error)
243
IOError.__init__(self, errno.ENOENT, self.msg)
245
class FileExists(TransportError, OSError):
246
"""An operation was attempted, which would overwrite an entry,
247
but overwritting is not supported.
249
mkdir() can throw this, but put() just overwites existing files.
251
# XXX: Is multiple inheritance for exceptions really needed?
252
def __init__(self, msg=None, orig_error=None):
254
TransportError.__init__(self, msg=msg, orig_error=orig_error)
255
OSError.__init__(self, errno.EEXIST, self.msg)
257
class PermissionDenied(TransportError):
258
"""An operation cannot succeed because of a lack of permissions."""
261
class ConnectionReset(TransportError):
262
"""The connection has been closed."""
265
class ConflictsInTree(BzrError):
267
BzrError.__init__(self, "Working tree has conflicts.")