23
23
######################################################################
25
25
class BzrError(StandardError):
27
if len(self.args) == 1:
29
elif len(self.args) == 2:
30
# further explanation or suggestions
31
return '\n '.join([self.args[0]] + self.args[1])
28
36
class BzrCheckError(BzrError):
40
class InvalidRevisionNumber(BzrError):
42
return 'invalid revision number: %r' % self.args[0]
45
class InvalidRevisionId(BzrError):
32
49
class BzrCommandError(BzrError):
33
50
# Error from malformed user command
71
88
class PointlessCommit(Exception):
72
89
"""Commit failed because nothing was changed."""
92
class NoSuchRevision(BzrError):
93
def __init__(self, branch, revision):
95
self.revision = revision
96
msg = "Branch %s has no revision %s" % (branch, revision)
97
BzrError.__init__(self, msg)
100
class HistoryMissing(BzrError):
101
def __init__(self, branch, object_type, object_id):
103
BzrError.__init__(self,
104
'%s is missing %s {%s}'
105
% (branch, object_type, object_id))
108
class UnrelatedBranches(BzrCommandError):
110
msg = "Branches have no common ancestor, and no base revision"\
112
BzrCommandError.__init__(self, msg)
115
class NotAncestor(BzrError):
116
def __init__(self, rev_id, not_ancestor_id):
118
self.not_ancestor_id = not_ancestor_id
119
msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id,
121
BzrError.__init__(self, msg)
124
class InstallFailed(BzrError):
125
def __init__(self, revisions):
126
self.revisions = revisions
127
msg = "Could not install revisions:\n%s" % " ,".join(revisions)
128
BzrError.__init__(self, msg)
131
class AmbiguousBase(BzrError):
132
def __init__(self, bases):
133
msg = "The correct base is unclear, becase %s are all equally close" %\
135
BzrError.__init__(self, msg)