71
83
class PointlessCommit(Exception):
72
84
"""Commit failed because nothing was changed."""
87
class NoSuchRevision(BzrError):
88
def __init__(self, branch, revision):
90
self.revision = revision
91
msg = "Branch %s has no revision %s" % (branch, revision)
92
BzrError.__init__(self, msg)
95
class DivergedBranches(BzrError):
96
def __init__(self, branch1, branch2):
97
BzrError.__init__(self, "These branches have diverged.")
98
self.branch1 = branch1
99
self.branch2 = branch2
101
class UnrelatedBranches(BzrCommandError):
103
msg = "Branches have no common ancestor, and no base revision"\
105
BzrCommandError.__init__(self, msg)
107
class NoCommonAncestor(BzrError):
108
def __init__(self, revision_a, revision_b):
109
msg = "Revisions have no common ancestor: %s %s." \
110
% (revision_a, revision_b)
111
BzrError.__init__(self, msg)
113
class NoCommonRoot(BzrError):
114
def __init__(self, revision_a, revision_b):
115
msg = "Revisions are not derived from the same root: %s %s." \
116
% (revision_a, revision_b)
117
BzrError.__init__(self, msg)
119
class NotAncestor(BzrError):
120
def __init__(self, rev_id, not_ancestor_id):
121
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
123
BzrError.__init__(self, msg)
125
self.not_ancestor_id = not_ancestor_id
128
class InstallFailed(BzrError):
129
def __init__(self, revisions):
130
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
131
BzrError.__init__(self, msg)
132
self.revisions = revisions
135
class AmbiguousBase(BzrError):
136
def __init__(self, bases):
137
msg = "The correct base is unclear, becase %s are all equally close" %\
139
BzrError.__init__(self, msg)
142
class NoCommits(BzrError):
143
def __init__(self, branch):
144
msg = "Branch %s has no commits." % branch
145
BzrError.__init__(self, msg)
147
class TransportError(BzrError):
148
"""All errors thrown by Transport implementations should derive
151
def __init__(self, msg=None, orig_error=None):
152
if msg is None and orig_error is not None:
153
msg = str(orig_error)
154
BzrError.__init__(self, msg)
156
self.orig_error = orig_error
158
# A set of semi-meaningful errors which can be thrown
159
class TransportNotPossible(TransportError):
160
"""This is for transports where a specific function is explicitly not
161
possible. Such as pushing files to an HTTP server.
165
class NonRelativePath(TransportError):
166
"""An absolute path was supplied, that could not be decoded into
171
class NoSuchFile(TransportError, IOError):
172
"""A get() was issued for a file that doesn't exist."""
173
def __init__(self, msg=None, orig_error=None):
175
TransportError.__init__(self, msg=msg, orig_error=orig_error)
176
IOError.__init__(self, errno.ENOENT, self.msg)
178
class FileExists(TransportError, OSError):
179
"""An operation was attempted, which would overwrite an entry,
180
but overwritting is not supported.
182
mkdir() can throw this, but put() just overwites existing files.
184
def __init__(self, msg=None, orig_error=None):
186
TransportError.__init__(self, msg=msg, orig_error=orig_error)
187
OSError.__init__(self, errno.EEXIST, self.msg)
189
class PermissionDenied(TransportError):
190
"""An operation cannot succeed because of a lack of permissions."""
193
class ConnectionReset(TransportError):
194
"""The connection has been closed."""