92
99
BzrError.__init__(self, msg)
102
class HistoryMissing(BzrError):
103
def __init__(self, branch, object_type, object_id):
105
BzrError.__init__(self,
106
'%s is missing %s {%s}'
107
% (branch, object_type, object_id))
110
class DivergedBranches(BzrError):
111
def __init__(self, branch1, branch2):
112
BzrError.__init__(self, "These branches have diverged.")
113
self.branch1 = branch1
114
self.branch2 = branch2
117
class UnrelatedBranches(BzrCommandError):
119
msg = "Branches have no common ancestor, and no base revision"\
121
BzrCommandError.__init__(self, msg)
123
class NoCommonAncestor(BzrError):
124
def __init__(self, revision_a, revision_b):
125
msg = "Revisions have no common ancestor: %s %s." \
126
% (revision_a, revision_b)
127
BzrError.__init__(self, msg)
129
class NoCommonRoot(BzrError):
130
def __init__(self, revision_a, revision_b):
131
msg = "Revisions are not derived from the same root: %s %s." \
132
% (revision_a, revision_b)
133
BzrError.__init__(self, msg)
135
class NotAncestor(BzrError):
136
def __init__(self, rev_id, not_ancestor_id):
137
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
139
BzrError.__init__(self, msg)
141
self.not_ancestor_id = not_ancestor_id
144
class NotAncestor(BzrError):
145
def __init__(self, rev_id, not_ancestor_id):
147
self.not_ancestor_id = not_ancestor_id
148
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
150
BzrError.__init__(self, msg)
153
class InstallFailed(BzrError):
154
def __init__(self, revisions):
155
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
156
BzrError.__init__(self, msg)
157
self.revisions = revisions
160
class AmbiguousBase(BzrError):
161
def __init__(self, bases):
162
msg = "The correct base is unclear, becase %s are all equally close" %\
164
BzrError.__init__(self, msg)
167
class NoCommits(BzrError):
168
def __init__(self, branch):
169
msg = "Branch %s has no commits." % branch
170
BzrError.__init__(self, msg)
172
class UnlistableStore(BzrError):
173
def __init__(self, store):
174
BzrError.__init__(self, "Store %s is not listable" % store)
176
class UnlistableBranch(BzrError):
177
def __init__(self, br):
178
BzrError.__init__(self, "Stores for branch %s are not listable" % br)
181
from bzrlib.weave import WeaveError
183
class TransportError(BzrError):
184
"""All errors thrown by Transport implementations should derive
187
def __init__(self, msg=None, orig_error=None):
188
if msg is None and orig_error is not None:
189
msg = str(orig_error)
190
BzrError.__init__(self, msg)
192
self.orig_error = orig_error
194
# A set of semi-meaningful errors which can be thrown
195
class TransportNotPossible(TransportError):
196
"""This is for transports where a specific function is explicitly not
197
possible. Such as pushing files to an HTTP server.
201
class NonRelativePath(TransportError):
202
"""An absolute path was supplied, that could not be decoded into
207
class NoSuchFile(TransportError, IOError):
208
"""A get() was issued for a file that doesn't exist."""
213
def __init__(self, msg=None, orig_error=None):
215
TransportError.__init__(self, msg=msg, orig_error=orig_error)
216
IOError.__init__(self, errno.ENOENT, self.msg)
218
class FileExists(TransportError, OSError):
219
"""An operation was attempted, which would overwrite an entry,
220
but overwritting is not supported.
222
mkdir() can throw this, but put() just overwites existing files.
224
def __init__(self, msg=None, orig_error=None):
226
TransportError.__init__(self, msg=msg, orig_error=orig_error)
227
OSError.__init__(self, errno.EEXIST, self.msg)
229
class PermissionDenied(TransportError):
230
"""An operation cannot succeed because of a lack of permissions."""
233
class ConnectionReset(TransportError):
234
"""The connection has been closed."""