~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
552
552
    _fmt = "%(context_info)s%(path)s is already versioned"
553
553
 
554
554
    def __init__(self, path, context_info=None):
555
 
        """Construct a new NotVersionedError.
 
555
        """Construct a new AlreadyVersionedError.
556
556
 
557
557
        :param path: This is the path which is versioned,
558
558
        which should be in a user friendly form.
621
621
 
622
622
class BadFileKindError(BzrError):
623
623
 
624
 
    _fmt = "Cannot operate on %(filename)s of unsupported kind %(kind)s"
 
624
    _fmt = 'Cannot operate on "%(filename)s" of unsupported kind "%(kind)s"'
 
625
 
 
626
    def __init__(self, filename, kind):
 
627
        BzrError.__init__(self, filename=filename, kind=kind)
625
628
 
626
629
 
627
630
class ForbiddenControlFileError(BzrError):
644
647
        self.message = message
645
648
 
646
649
 
 
650
class LockActive(LockError):
 
651
 
 
652
    _fmt = "The lock for '%(lock_description)s' is in use and cannot be broken."
 
653
 
 
654
    internal_error = False
 
655
 
 
656
    def __init__(self, lock_description):
 
657
        self.lock_description = lock_description
 
658
 
 
659
 
647
660
class CommitNotPossible(LockError):
648
661
 
649
662
    _fmt = "A commit was attempted but we do not have a write lock open."
664
677
 
665
678
    _fmt = "A write attempt was made in a read only transaction on %(obj)s"
666
679
 
 
680
    # TODO: There should also be an error indicating that you need a write
 
681
    # lock and don't have any lock at all... mbp 20070226
 
682
 
667
683
    def __init__(self, obj):
668
684
        self.obj = obj
669
685
 
799
815
        BzrError.__init__(self, spec=spec)
800
816
 
801
817
 
 
818
class NoSuchRevisionInTree(NoSuchRevision):
 
819
    """When using Tree.revision_tree, and the revision is not accessible."""
 
820
    
 
821
    _fmt = "The revision id %(revision_id)s is not present in the tree %(tree)s."
 
822
 
 
823
    def __init__(self, tree, revision_id):
 
824
        BzrError.__init__(self)
 
825
        self.tree = tree
 
826
        self.revision_id = revision_id
 
827
 
 
828
 
802
829
class InvalidRevisionSpec(BzrError):
803
830
 
804
831
    _fmt = "Requested revision: %(spec)r does not exist in branch: %(branch)s%(extra)s"
1356
1383
        self.file_id = file_id
1357
1384
 
1358
1385
 
 
1386
class DuplicateFileId(BzrError):
 
1387
 
 
1388
    _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s"
 
1389
 
 
1390
    def __init__(self, file_id, entry):
 
1391
        BzrError.__init__(self)
 
1392
        self.file_id = file_id
 
1393
        self.entry = entry
 
1394
 
 
1395
 
1359
1396
class DuplicateKey(BzrError):
1360
1397
 
1361
1398
    _fmt = "Key %(key)s is already present in map"
1722
1759
        BadInventoryFormat.__init__(self, msg=msg)
1723
1760
 
1724
1761
 
 
1762
class RootNotRich(BzrError):
 
1763
 
 
1764
    _fmt = """This operation requires rich root data storage"""
 
1765
 
 
1766
 
1725
1767
class NoSmartMedium(BzrError):
1726
1768
 
1727
1769
    _fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
 
1770
 
1728
1771
    internal_error = True
1729
1772
 
1730
1773
    def __init__(self, transport):
1813
1856
        self.patch_type = patch_type
1814
1857
 
1815
1858
 
 
1859
class UnsupportedInventoryKind(BzrError):
 
1860
    
 
1861
    _fmt = """Unsupported entry kind %(kind)s"""
 
1862
 
 
1863
    def __init__(self, kind):
 
1864
        self.kind = kind
 
1865
 
 
1866
 
 
1867
class BadSubsumeSource(BzrError):
 
1868
 
 
1869
    _fmt = """Can't subsume %(other_tree)s into %(tree)s.  %(reason)s"""
 
1870
 
 
1871
    def __init__(self, tree, other_tree, reason):
 
1872
        self.tree = tree
 
1873
        self.other_tree = other_tree
 
1874
        self.reason = reason
 
1875
 
 
1876
 
 
1877
class SubsumeTargetNeedsUpgrade(BzrError):
 
1878
    
 
1879
    _fmt = """Subsume target %(other_tree)s needs to be upgraded."""
 
1880
 
 
1881
    def __init__(self, other_tree):
 
1882
        self.other_tree = other_tree
 
1883
 
 
1884
 
 
1885
class BadReferenceTarget(BzrError):
 
1886
 
 
1887
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s.  %(reason)s"
 
1888
 
 
1889
    internal_error = True
 
1890
 
 
1891
    def __init__(self, tree, other_tree, reason):
 
1892
        self.tree = tree
 
1893
        self.other_tree = other_tree
 
1894
        self.reason = reason
 
1895
 
 
1896
 
1816
1897
class NoSuchTag(BzrError):
1817
1898
 
1818
1899
    _fmt = "No such tag: %(tag_name)s"