/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: 2006-03-03 02:09:49 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303020949-0ddc6f33d0a43943
Smoke test for RevisionStore factories creating revision stores.

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
 
class ObjectNotLocked(LockError):
327
 
    """%(obj)r is not locked"""
328
 
    # this can indicate that any particular object is not locked; see also
329
 
    # LockNotHeld which means that a particular *lock* object is not held by
330
 
    # the caller -- perhaps they should be unified.
331
 
    def __init__(self, obj):
332
 
        self.obj = obj
 
303
class BranchNotLocked(LockError):
 
304
    """Branch %(branch)r is not locked"""
 
305
    def __init__(self, branch):
 
306
        # XXX: sometimes called with a LockableFiles instance not a Branch
 
307
        self.branch = branch
333
308
 
334
309
 
335
310
class ReadOnlyObjectDirtiedError(ReadOnlyError):
371
346
        self.lock = lock
372
347
 
373
348
 
 
349
class BranchNotLocked(LockError):
 
350
    """Branch %(branch)r not locked"""
 
351
    def __init__(self, branch):
 
352
        self.branch = branch
 
353
 
 
354
 
374
355
class PointlessCommit(BzrNewError):
375
356
    """No changes to commit"""
376
357
 
387
368
        self.format = format
388
369
 
389
370
 
390
 
 
391
371
class StrictCommitFailed(Exception):
392
372
    """Commit refused because there are unknowns in the tree."""
393
373
 
394
 
 
395
374
class NoSuchRevision(BzrError):
396
375
    def __init__(self, branch, revision):
397
376
        self.branch = branch
409
388
 
410
389
 
411
390
class DivergedBranches(BzrError):
412
 
 
413
391
    def __init__(self, branch1, branch2):
414
392
        BzrError.__init__(self, "These branches have diverged.  Try merge.")
415
393
        self.branch1 = branch1
437
415
        BzrError.__init__(self, msg)
438
416
 
439
417
 
440
 
 
441
418
class NotAncestor(BzrError):
442
419
    def __init__(self, rev_id, not_ancestor_id):
443
420
        msg = "Revision %s is not an ancestor of %s" % (not_ancestor_id, 
456
433
 
457
434
class AmbiguousBase(BzrError):
458
435
    def __init__(self, bases):
459
 
        warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
460
 
                DeprecationWarning)
461
436
        msg = "The correct base is unclear, becase %s are all equally close" %\
462
437
            ", ".join(bases)
463
438
        BzrError.__init__(self, msg)
475
450
        BzrError.__init__(self, "Store %s is not listable" % store)
476
451
 
477
452
 
478
 
 
479
453
class UnlistableBranch(BzrError):
480
454
    def __init__(self, br):
481
455
        BzrError.__init__(self, "Stores for branch %s are not listable" % br)
482
456
 
483
457
 
484
 
class BoundBranchOutOfDate(BzrNewError):
485
 
    """Bound branch %(branch)s is out of date with master branch %(master)s."""
486
 
    def __init__(self, branch, master):
487
 
        BzrNewError.__init__(self)
488
 
        self.branch = branch
489
 
        self.master = master
490
 
 
491
 
        
492
 
class CommitToDoubleBoundBranch(BzrNewError):
493
 
    """Cannot commit to branch %(branch)s. It is bound to %(master)s, which is bound to %(remote)s."""
494
 
    def __init__(self, branch, master, remote):
495
 
        BzrNewError.__init__(self)
496
 
        self.branch = branch
497
 
        self.master = master
498
 
        self.remote = remote
499
 
 
500
 
 
501
 
class OverwriteBoundBranch(BzrNewError):
502
 
    """Cannot pull --overwrite to a branch which is bound %(branch)s"""
503
 
    def __init__(self, branch):
504
 
        BzrNewError.__init__(self)
505
 
        self.branch = branch
506
 
 
507
 
 
508
 
class BoundBranchConnectionFailure(BzrNewError):
509
 
    """Unable to connect to target of bound branch %(branch)s => %(target)s: %(error)s"""
510
 
    def __init__(self, branch, target, error):
511
 
        BzrNewError.__init__(self)
512
 
        self.branch = branch
513
 
        self.target = target
514
 
        self.error = error
515
 
 
516
 
 
517
458
class WeaveError(BzrNewError):
518
459
    """Error in processing weave: %(message)s"""
519
460
 
724
665
        self.text_revision = text_revision
725
666
        self.file_id = file_id
726
667
 
727
 
 
728
668
class DuplicateKey(BzrNewError):
729
669
    """Key %(key)s is already present in map"""
730
670
 
731
 
 
732
671
class MalformedTransform(BzrNewError):
733
672
    """Tree transform is malformed %(conflicts)r"""
734
673
 
765
704
 
766
705
 
767
706
class DependencyNotPresent(BzrNewError):
768
 
    """Unable to import library "%(library)s": %(error)s"""
 
707
    """Unable to import library: %(library)s, %(error)s"""
769
708
 
770
709
    def __init__(self, library, error):
771
710
        BzrNewError.__init__(self, library=library, error=error)
816
755
    def __init__(self, tree):
817
756
        BzrNewError.__init__(self)
818
757
        self.tree = tree
819
 
 
820
 
 
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
 
class CorruptRepository(BzrNewError):
830
 
    """An error has been detected in the repository %(repo_path)s.
831
 
Please run bzr reconcile on this repository."""
832
 
 
833
 
    def __init__(self, repo):
834
 
        BzrNewError.__init__(self)
835
 
        self.repo_path = repo.bzrdir.root_transport.base
836
 
 
837
 
 
838
 
class UpgradeRequired(BzrNewError):
839
 
    """To use this feature you must upgrade your branch at %(path)s."""
840
 
 
841
 
    def __init__(self, path):
842
 
        BzrNewError.__init__(self)
843
 
        self.path = path
844
 
 
845
 
 
846
 
class LocalRequiresBoundBranch(BzrNewError):
847
 
    """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__