/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Robert Collins
  • Date: 2005-09-30 02:54:51 UTC
  • mfrom: (1395)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930025451-47b9e412202be44b
symlink and weaves, whaddya know

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python
2
1
# -*- coding: UTF-8 -*-
3
2
 
4
3
# This program is free software; you can redistribute it and/or modify
23
22
######################################################################
24
23
# exceptions 
25
24
class BzrError(StandardError):
26
 
    pass
 
25
    def __str__(self):
 
26
        if len(self.args) == 1:
 
27
            return self.args[0]
 
28
        elif len(self.args) == 2:
 
29
            # further explanation or suggestions
 
30
            return '\n  '.join([self.args[0]] + self.args[1])
 
31
        else:
 
32
            return `self.args`
 
33
 
27
34
 
28
35
class BzrCheckError(BzrError):
29
36
    pass
30
37
 
31
38
 
32
39
class InvalidRevisionNumber(BzrError):
33
 
    def __init__(self, revno):
34
 
        self.args = [revno]
35
 
        
36
40
    def __str__(self):
37
41
        return 'invalid revision number: %r' % self.args[0]
38
42
 
92
96
        BzrError.__init__(self, msg)
93
97
 
94
98
 
 
99
class HistoryMissing(BzrError):
 
100
    def __init__(self, branch, object_type, object_id):
 
101
        self.branch = branch
 
102
        BzrError.__init__(self,
 
103
                          '%s is missing %s {%s}'
 
104
                          % (branch, object_type, object_id))
 
105
 
 
106
 
 
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
 
112
 
 
113
 
 
114
class UnrelatedBranches(BzrCommandError):
 
115
    def __init__(self):
 
116
        msg = "Branches have no common ancestor, and no base revision"\
 
117
            " specified."
 
118
        BzrCommandError.__init__(self, msg)
 
119
 
 
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)
 
125
 
 
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)
 
131
 
 
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, 
 
135
                                                        rev_id)
 
136
        BzrError.__init__(self, msg)
 
137
        self.rev_id = rev_id
 
138
        self.not_ancestor_id = not_ancestor_id
 
139
 
 
140
 
 
141
class NotAncestor(BzrError):
 
142
    def __init__(self, rev_id, not_ancestor_id):
 
143
        self.rev_id = rev_id
 
144
        self.not_ancestor_id = not_ancestor_id
 
145
        msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id, 
 
146
                                                        rev_id)
 
147
        BzrError.__init__(self, msg)
 
148
 
 
149
 
 
150
class InstallFailed(BzrError):
 
151
    def __init__(self, revisions):
 
152
        msg = "Could not install revisions:\n%s" % " ,".join(revisions)
 
153
        BzrError.__init__(self, msg)
 
154
        self.revisions = revisions
 
155
 
 
156
 
 
157
class AmbiguousBase(BzrError):
 
158
    def __init__(self, bases):
 
159
        msg = "The correct base is unclear, becase %s are all equally close" %\
 
160
            ", ".join(bases)
 
161
        BzrError.__init__(self, msg)
 
162
        self.bases = bases
 
163
 
 
164
class NoCommits(BzrError):
 
165
    def __init__(self, branch):
 
166
        msg = "Branch %s has no commits." % branch
 
167
        BzrError.__init__(self, msg)
 
168
 
 
169
class UnlistableStore(BzrError):
 
170
    def __init__(self, store):
 
171
        BzrError.__init__(self, "Store %s is not listable" % store)
 
172
 
 
173
class UnlistableBranch(BzrError):
 
174
    def __init__(self, br):
 
175
        BzrError.__init__(self, "Stores for branch %s are not listable" % br)
 
176
 
 
177
 
 
178
from bzrlib.weave import WeaveError