/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: Martin Pool
  • Date: 2006-03-20 22:32:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1621.
  • Revision ID: mbp@sourcefrog.net-20060320223241-95ba66352fd77026
Cleanup and document some check code

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
fullstop.
54
54
"""
55
55
 
56
 
from warnings import warn
57
 
 
58
56
# based on Scott James Remnant's hct error classes
59
57
 
60
58
# TODO: is there any value in providing the .args field used by standard
174
172
 
175
173
class PathError(BzrNewError):
176
174
    """Generic path error: %(path)r%(extra)s)"""
177
 
 
178
175
    def __init__(self, path, extra=None):
179
176
        BzrNewError.__init__(self)
180
177
        self.path = path
196
193
    """Directory not empty: %(path)r%(extra)s"""
197
194
 
198
195
 
199
 
class ResourceBusy(PathError):
200
 
    """Device or resource busy: %(path)r%(extra)s"""
201
 
 
202
 
 
203
196
class PermissionDenied(PathError):
204
197
    """Permission denied: %(path)r%(extra)s"""
205
198
 
216
209
            self.extra = ''
217
210
 
218
211
 
219
 
class NotBranchError(PathError):
 
212
class NotBranchError(BzrNewError):
220
213
    """Not a branch: %(path)s"""
221
 
 
222
 
 
223
 
class AlreadyBranchError(PathError):
224
 
    """Already a branch: %(path)s. Use `bzr checkout` to build a working tree."""
 
214
    def __init__(self, path):
 
215
        BzrNewError.__init__(self)
 
216
        self.path = path
225
217
 
226
218
 
227
219
class NoRepositoryPresent(BzrNewError):
269
261
        self.path = path
270
262
 
271
263
 
272
 
class PathsNotVersionedError(BzrNewError):
273
 
    # used when reporting several paths are not versioned
274
 
    """Path(s) are not versioned: %(paths_as_string)s"""
275
 
 
276
 
    def __init__(self, paths):
277
 
        from bzrlib.osutils import quotefn
278
 
        BzrNewError.__init__(self)
279
 
        self.paths = paths
280
 
        self.paths_as_string = ' '.join([quotefn(p) for p in paths])
281
 
 
282
 
 
283
264
class BadFileKindError(BzrError):
284
265
    """Specified file is of a kind that cannot be added.
285
266
 
409
390
 
410
391
 
411
392
class DivergedBranches(BzrError):
412
 
 
413
393
    def __init__(self, branch1, branch2):
414
394
        BzrError.__init__(self, "These branches have diverged.  Try merge.")
415
395
        self.branch1 = branch1
456
436
 
457
437
class AmbiguousBase(BzrError):
458
438
    def __init__(self, bases):
459
 
        warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
460
 
                DeprecationWarning)
461
439
        msg = "The correct base is unclear, becase %s are all equally close" %\
462
440
            ", ".join(bases)
463
441
        BzrError.__init__(self, msg)
822
800
    """Error in merge modified format"""
823
801
 
824
802
 
825
 
class ConflictFormatError(BzrNewError):
826
 
    """Format error in conflict listings"""
827
 
 
828
 
 
829
803
class CorruptRepository(BzrNewError):
830
804
    """An error has been detected in the repository %(repo_path)s.
831
805
Please run bzr reconcile on this repository."""
849
823
 
850
824
class MissingProgressBarFinish(BzrNewError):
851
825
    """A nested progress bar was not 'finished' correctly."""
852
 
 
853
 
 
854
 
class UnsupportedOperation(BzrNewError):
855
 
    """The method %(mname)s is not supported on objects of type %(tname)s."""
856
 
    def __init__(self, method, method_self):
857
 
        self.method = method
858
 
        self.mname = method.__name__
859
 
        self.tname = type(method_self).__name__