/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: Michael Ellerman
  • Date: 2006-03-09 00:24:48 UTC
  • mto: (1610.1.8 bzr.mbp.integration)
  • mto: This revision was merged to the branch mainline in revision 1616.
  • Revision ID: michael@ellerman.id.au-20060309002448-70cce15e3d605130
Make the "ignore line" in the commit message editor the "right" width, so
that if you make your message that wide it won't wrap in bzr log output.
Just as a visual aid.

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
 
319
300
        self.obj = obj
320
301
 
321
302
 
322
 
class OutSideTransaction(BzrNewError):
323
 
    """A transaction related operation was attempted after the transaction finished."""
324
 
 
325
 
 
326
303
class ObjectNotLocked(LockError):
327
304
    """%(obj)r is not locked"""
328
305
    # this can indicate that any particular object is not locked; see also
409
386
 
410
387
 
411
388
class DivergedBranches(BzrError):
412
 
 
413
389
    def __init__(self, branch1, branch2):
414
390
        BzrError.__init__(self, "These branches have diverged.  Try merge.")
415
391
        self.branch1 = branch1
456
432
 
457
433
class AmbiguousBase(BzrError):
458
434
    def __init__(self, bases):
459
 
        warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
460
 
                DeprecationWarning)
461
435
        msg = "The correct base is unclear, becase %s are all equally close" %\
462
436
            ", ".join(bases)
463
437
        BzrError.__init__(self, msg)
516
490
 
517
491
class WeaveError(BzrNewError):
518
492
    """Error in processing weave: %(message)s"""
519
 
 
520
493
    def __init__(self, message=None):
521
494
        BzrNewError.__init__(self)
522
495
        self.message = message
525
498
class WeaveRevisionAlreadyPresent(WeaveError):
526
499
    """Revision {%(revision_id)s} already present in %(weave)s"""
527
500
    def __init__(self, revision_id, weave):
528
 
 
529
501
        WeaveError.__init__(self)
530
502
        self.revision_id = revision_id
531
503
        self.weave = weave
533
505
 
534
506
class WeaveRevisionNotPresent(WeaveError):
535
507
    """Revision {%(revision_id)s} not present in %(weave)s"""
536
 
 
537
508
    def __init__(self, revision_id, weave):
538
509
        WeaveError.__init__(self)
539
510
        self.revision_id = revision_id
542
513
 
543
514
class WeaveFormatError(WeaveError):
544
515
    """Weave invariant violated: %(what)s"""
545
 
 
546
516
    def __init__(self, what):
547
517
        WeaveError.__init__(self)
548
518
        self.what = what
576
546
        self.weave_b = weave_b
577
547
 
578
548
 
579
 
class VersionedFileError(BzrNewError):
580
 
    """Versioned file error."""
581
 
 
582
 
 
583
 
class RevisionNotPresent(VersionedFileError):
584
 
    """Revision {%(revision_id)s} not present in %(file_id)s."""
585
 
 
586
 
    def __init__(self, revision_id, file_id):
587
 
        VersionedFileError.__init__(self)
588
 
        self.revision_id = revision_id
589
 
        self.file_id = file_id
590
 
 
591
 
 
592
 
class RevisionAlreadyPresent(VersionedFileError):
593
 
    """Revision {%(revision_id)s} already present in %(file_id)s."""
594
 
 
595
 
    def __init__(self, revision_id, file_id):
596
 
        VersionedFileError.__init__(self)
597
 
        self.revision_id = revision_id
598
 
        self.file_id = file_id
599
 
 
600
 
 
601
 
class KnitError(BzrNewError):
602
 
    """Knit error"""
603
 
 
604
 
 
605
 
class KnitHeaderError(KnitError):
606
 
    """Knit header error: %(badline)r unexpected"""
607
 
 
608
 
    def __init__(self, badline):
609
 
        KnitError.__init__(self)
610
 
        self.badline = badline
611
 
 
612
 
 
613
 
class KnitCorrupt(KnitError):
614
 
    """Knit %(filename)s corrupt: %(how)s"""
615
 
 
616
 
    def __init__(self, filename, how):
617
 
        KnitError.__init__(self)
618
 
        self.filename = filename
619
 
        self.how = how
620
 
 
621
 
 
622
549
class NoSuchExportFormat(BzrNewError):
623
550
    """Export format %(format)r not supported"""
624
551
    def __init__(self, format):
765
692
 
766
693
 
767
694
class DependencyNotPresent(BzrNewError):
768
 
    """Unable to import library "%(library)s": %(error)s"""
 
695
    """Unable to import library: %(library)s, %(error)s"""
769
696
 
770
697
    def __init__(self, library, error):
771
698
        BzrNewError.__init__(self, library=library, error=error)
818
745
        self.tree = tree
819
746
 
820
747
 
821
 
class MergeModifiedFormatError(BzrNewError):
822
 
    """Error in merge modified format"""
823
 
 
824
 
 
825
 
class ConflictFormatError(BzrNewError):
826
 
    """Format error in conflict listings"""
827
 
 
828
 
 
829
748
class CorruptRepository(BzrNewError):
830
749
    """An error has been detected in the repository %(repo_path)s.
831
750
Please run bzr reconcile on this repository."""
845
764
 
846
765
class LocalRequiresBoundBranch(BzrNewError):
847
766
    """Cannot perform local-only commits on unbound branches."""
848
 
 
849
 
 
850
 
class MissingProgressBarFinish(BzrNewError):
851
 
    """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__