23
22
######################################################################
25
24
class BzrError(StandardError):
26
if len(self.args) == 1:
28
elif len(self.args) == 2:
29
# further explanation or suggestions
30
return '\n '.join([self.args[0]] + self.args[1])
28
35
class BzrCheckError(BzrError):
32
39
class InvalidRevisionNumber(BzrError):
33
def __init__(self, revno):
37
41
return 'invalid revision number: %r' % self.args[0]
92
96
BzrError.__init__(self, msg)
99
class HistoryMissing(BzrError):
100
def __init__(self, branch, object_type, object_id):
102
BzrError.__init__(self,
103
'%s is missing %s {%s}'
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
95
114
class UnrelatedBranches(BzrCommandError):
96
115
def __init__(self):
97
116
msg = "Branches have no common ancestor, and no base revision"\
99
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)
102
132
class NotAncestor(BzrError):
103
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)
104
137
self.rev_id = rev_id
105
138
self.not_ancestor_id = not_ancestor_id
106
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
108
BzrError.__init__(self, msg)
111
141
class InstallFailed(BzrError):
112
142
def __init__(self, revisions):
143
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
144
BzrError.__init__(self, msg)
113
145
self.revisions = revisions
114
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
115
BzrError.__init__(self, msg)
118
148
class AmbiguousBase(BzrError):
122
152
BzrError.__init__(self, msg)
123
153
self.bases = bases
155
class NoCommits(BzrError):
156
def __init__(self, branch):
157
msg = "Branch %s has no commits." % branch
158
BzrError.__init__(self, msg)
160
class UnlistableStore(BzrError):
161
def __init__(self, store):
162
BzrError.__init__(self, "Store %s is not listable" % store)
164
class UnlistableBranch(BzrError):
165
def __init__(self, br):
166
BzrError.__init__(self, "Stores for branch %s are not listable" % br)
169
from bzrlib.weave import WeaveError