108
104
% (branch, object_type, object_id))
107
class DivergedBranches(BzrError):
108
def __init__(self, branch1, branch2):
109
BzrError.__init__(self, "These branches have diverged.")
110
self.branch1 = branch1
111
self.branch2 = branch2
111
114
class UnrelatedBranches(BzrCommandError):
112
115
def __init__(self):
113
116
msg = "Branches have no common ancestor, and no base revision"\
115
118
BzrCommandError.__init__(self, msg)
120
class NoCommonAncestor(BzrError):
121
def __init__(self, revision_a, revision_b):
122
msg = "Revisions have no common ancestor: %s %s." \
123
% (revision_a, revision_b)
124
BzrError.__init__(self, msg)
126
class NoCommonRoot(BzrError):
127
def __init__(self, revision_a, revision_b):
128
msg = "Revisions are not derived from the same root: %s %s." \
129
% (revision_a, revision_b)
130
BzrError.__init__(self, msg)
132
class NotAncestor(BzrError):
133
def __init__(self, rev_id, not_ancestor_id):
134
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
136
BzrError.__init__(self, msg)
138
self.not_ancestor_id = not_ancestor_id
118
141
class NotAncestor(BzrError):
119
142
def __init__(self, rev_id, not_ancestor_id):
127
150
class InstallFailed(BzrError):
128
151
def __init__(self, revisions):
152
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
153
BzrError.__init__(self, msg)
129
154
self.revisions = revisions
130
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
131
BzrError.__init__(self, msg)
134
157
class AmbiguousBase(BzrError):
138
161
BzrError.__init__(self, msg)
139
162
self.bases = bases
164
class NoCommits(BzrError):
165
def __init__(self, branch):
166
msg = "Branch %s has no commits." % branch
167
BzrError.__init__(self, msg)
169
class UnlistableStore(BzrError):
170
def __init__(self, store):
171
BzrError.__init__(self, "Store %s is not listable" % store)
173
class UnlistableBranch(BzrError):
174
def __init__(self, br):
175
BzrError.__init__(self, "Stores for branch %s are not listable" % br)
178
from bzrlib.weave import WeaveError
180
class TransportError(BzrError):
181
"""All errors thrown by Transport implementations should derive
184
def __init__(self, msg=None, orig_error=None):
185
if msg is None and orig_error is not None:
186
msg = str(orig_error)
187
BzrError.__init__(self, msg)
189
self.orig_error = orig_error
191
# A set of semi-meaningful errors which can be thrown
192
class TransportNotPossible(TransportError):
193
"""This is for transports where a specific function is explicitly not
194
possible. Such as pushing files to an HTTP server.
198
class NonRelativePath(TransportError):
199
"""An absolute path was supplied, that could not be decoded into
204
class NoSuchFile(TransportError, IOError):
205
"""A get() was issued for a file that doesn't exist."""
206
def __init__(self, msg=None, orig_error=None):
208
TransportError.__init__(self, msg=msg, orig_error=orig_error)
209
IOError.__init__(self, errno.ENOENT, self.msg)
211
class FileExists(TransportError, OSError):
212
"""An operation was attempted, which would overwrite an entry,
213
but overwritting is not supported.
215
mkdir() can throw this, but put() just overwites existing files.
217
def __init__(self, msg=None, orig_error=None):
219
TransportError.__init__(self, msg=msg, orig_error=orig_error)
220
OSError.__init__(self, errno.EEXIST, self.msg)
222
class PermissionDenied(TransportError):
223
"""An operation cannot succeed because of a lack of permissions."""
226
class ConnectionReset(TransportError):
227
"""The connection has been closed."""