~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Robert Collins
  • Date: 2007-03-07 08:02:58 UTC
  • mfrom: (2255.2.239 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070307080258-fi172acyjga89fz5
(robertc) Merge dirstate and subtrees. (Robert Collins, Martin Pool, Aaaron Bentley, John A Meinel, James Westby)

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"
1709
1746
        BadInventoryFormat.__init__(self, msg=msg)
1710
1747
 
1711
1748
 
 
1749
class RootNotRich(BzrError):
 
1750
 
 
1751
    _fmt = """This operation requires rich root data storage"""
 
1752
 
 
1753
 
1712
1754
class NoSmartMedium(BzrError):
1713
1755
 
1714
1756
    _fmt = "The transport '%(transport)s' cannot tunnel the smart protocol."
 
1757
 
1715
1758
    internal_error = True
1716
1759
 
1717
1760
    def __init__(self, transport):
1783
1826
        self.name = name
1784
1827
 
1785
1828
 
 
1829
class UnsupportedInventoryKind(BzrError):
 
1830
    
 
1831
    _fmt = """Unsupported entry kind %(kind)s"""
 
1832
 
 
1833
    def __init__(self, kind):
 
1834
        self.kind = kind
 
1835
 
 
1836
 
 
1837
class BadSubsumeSource(BzrError):
 
1838
 
 
1839
    _fmt = """Can't subsume %(other_tree)s into %(tree)s.  %(reason)s"""
 
1840
 
 
1841
    def __init__(self, tree, other_tree, reason):
 
1842
        self.tree = tree
 
1843
        self.other_tree = other_tree
 
1844
        self.reason = reason
 
1845
 
 
1846
 
 
1847
class SubsumeTargetNeedsUpgrade(BzrError):
 
1848
    
 
1849
    _fmt = """Subsume target %(other_tree)s needs to be upgraded."""
 
1850
 
 
1851
    def __init__(self, other_tree):
 
1852
        self.other_tree = other_tree
 
1853
 
 
1854
 
 
1855
class BadReferenceTarget(BzrError):
 
1856
 
 
1857
    _fmt = "Can't add reference to %(other_tree)s into %(tree)s.  %(reason)s"
 
1858
 
 
1859
    internal_error = True
 
1860
 
 
1861
    def __init__(self, tree, other_tree, reason):
 
1862
        self.tree = tree
 
1863
        self.other_tree = other_tree
 
1864
        self.reason = reason
 
1865
 
 
1866
 
1786
1867
class NoSuchTag(BzrError):
1787
1868
 
1788
1869
    _fmt = "No such tag: %(tag_name)s"