/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

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    # readable explanation
133
133
 
134
134
    def __init__(self, *args, **kwds):
135
 
        # XXX: Use the underlying BzrError to always generate the args attribute
136
 
        # if it doesn't exist.  We can't use super here, because exceptions are
137
 
        # old-style classes in python2.4 (but new in 2.5).  --bmc, 20060426
 
135
        # XXX: Use the underlying BzrError to always generate the args
 
136
        # attribute if it doesn't exist.  We can't use super here, because
 
137
        # exceptions are old-style classes in python2.4 (but new in 2.5).
 
138
        # --bmc, 20060426
138
139
        symbol_versioning.warn('BzrNewError was deprecated in bzr 0.13; '
139
 
             'please convert %s to use BzrError instead' 
 
140
             'please convert %s to use BzrError instead'
140
141
             % self.__class__.__name__,
141
142
             DeprecationWarning,
142
143
             stacklevel=2)
223
224
 
224
225
class InventoryModified(BzrError):
225
226
 
226
 
    _fmt = ("The current inventory for the tree %(tree)r has been modified, "
227
 
            "so a clean inventory cannot be read without data loss.")
 
227
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
 
228
            " so a clean inventory cannot be read without data loss.")
228
229
 
229
230
    internal_error = True
230
231
 
342
343
    """Used when renaming and both source and dest exist."""
343
344
 
344
345
    _fmt = ("Could not rename %(source)s => %(dest)s because both files exist."
345
 
         "%(extra)s")
 
346
            "%(extra)s")
346
347
 
347
348
    def __init__(self, source, dest, extra=None):
348
349
        BzrError.__init__(self)
425
426
 
426
427
class ShortReadvError(PathError):
427
428
 
428
 
    _fmt = "readv() read %(actual)s bytes rather than %(length)s bytes at %(offset)s for %(path)s%(extra)s"
 
429
    _fmt = ("readv() read %(actual)s bytes rather than %(length)s bytes"
 
430
            " at %(offset)s for %(path)s%(extra)s")
429
431
 
430
432
    internal_error = True
431
433
 
482
484
 
483
485
class AtomicFileAlreadyClosed(PathError):
484
486
 
485
 
    _fmt = "'%(function)s' called on an AtomicFile after it was closed: %(path)s"
 
487
    _fmt = ("'%(function)s' called on an AtomicFile after it was closed:"
 
488
            " %(path)s")
486
489
 
487
490
    def __init__(self, path, function):
488
491
        PathError.__init__(self, path=path, extra=None)
491
494
 
492
495
class InaccessibleParent(PathError):
493
496
 
494
 
    _fmt = "Parent not accessible given base %(base)s and relative path %(path)s"
 
497
    _fmt = ("Parent not accessible given base %(base)s and"
 
498
            " relative path %(path)s")
495
499
 
496
500
    def __init__(self, path, base):
497
501
        PathError.__init__(self, path)
686
690
 
687
691
class OutSideTransaction(BzrError):
688
692
 
689
 
    _fmt = "A transaction related operation was attempted after the transaction finished."
 
693
    _fmt = ("A transaction related operation was attempted after"
 
694
            " the transaction finished.")
690
695
 
691
696
 
692
697
class ObjectNotLocked(LockError):
730
735
 
731
736
class LockBroken(LockError):
732
737
 
733
 
    _fmt = "Lock was broken while still open: %(lock)s - check storage consistency!"
 
738
    _fmt = ("Lock was broken while still open: %(lock)s"
 
739
            " - check storage consistency!")
734
740
 
735
741
    internal_error = False
736
742
 
740
746
 
741
747
class LockBreakMismatch(LockError):
742
748
 
743
 
    _fmt = "Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)r, wanted to break %(target)r"
 
749
    _fmt = ("Lock was released and re-acquired before being broken:"
 
750
            " %(lock)s: held by %(holder)r, wanted to break %(target)r")
744
751
 
745
752
    internal_error = False
746
753
 
796
803
 
797
804
class NotLeftParentDescendant(BzrError):
798
805
 
799
 
    _fmt = "Revision %(old_revision)s is not the left parent of"\
800
 
        " %(new_revision)s, but branch %(branch_location)s expects this"
 
806
    _fmt = ("Revision %(old_revision)s is not the left parent of"
 
807
            " %(new_revision)s, but branch %(branch_location)s expects this")
801
808
 
802
809
    internal_error = True
803
810
 
828
835
 
829
836
class InvalidRevisionSpec(BzrError):
830
837
 
831
 
    _fmt = "Requested revision: %(spec)r does not exist in branch: %(branch)s%(extra)s"
 
838
    _fmt = ("Requested revision: %(spec)r does not exist in branch:"
 
839
            " %(branch)s%(extra)s")
832
840
 
833
841
    def __init__(self, spec, branch, extra=None):
834
842
        BzrError.__init__(self, branch=branch, spec=spec)
845
853
 
846
854
class AppendRevisionsOnlyViolation(BzrError):
847
855
 
848
 
    _fmt = 'Operation denied because it would change the main history, '\
849
 
           'which is not permitted by the append_revisions_only setting on'\
850
 
           ' branch "%(location)s".'
 
856
    _fmt = ('Operation denied because it would change the main history,'
 
857
           ' which is not permitted by the append_revisions_only setting on'
 
858
           ' branch "%(location)s".')
851
859
 
852
860
    def __init__(self, location):
853
861
       import bzrlib.urlutils as urlutils
856
864
 
857
865
 
858
866
class DivergedBranches(BzrError):
859
 
    
860
 
    _fmt = "These branches have diverged.  Use the merge command to reconcile them."""
 
867
 
 
868
    _fmt = ("These branches have diverged."
 
869
            " Use the merge command to reconcile them.")
861
870
 
862
871
    internal_error = False
863
872
 
878
887
 
879
888
class UnrelatedBranches(BzrError):
880
889
 
881
 
    _fmt = "Branches have no common ancestor, and no merge base revision was specified."
 
890
    _fmt = ("Branches have no common ancestor, and"
 
891
            " no merge base revision was specified.")
882
892
 
883
893
    internal_error = False
884
894
 
894
904
 
895
905
class NoCommonRoot(BzrError):
896
906
 
897
 
    _fmt = "Revisions are not derived from the same root: " \
898
 
           "%(revision_a)s %(revision_b)s."
 
907
    _fmt = ("Revisions are not derived from the same root: "
 
908
           "%(revision_a)s %(revision_b)s.")
899
909
 
900
910
    def __init__(self, revision_a, revision_b):
901
911
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
924
934
    def __init__(self, bases):
925
935
        warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
926
936
                DeprecationWarning)
927
 
        msg = "The correct base is unclear, because %s are all equally close" %\
928
 
            ", ".join(bases)
 
937
        msg = ("The correct base is unclear, because %s are all equally close"
 
938
                % ", ".join(bases))
929
939
        BzrError.__init__(self, msg)
930
940
        self.bases = bases
931
941
 
953
963
 
954
964
class BoundBranchOutOfDate(BzrError):
955
965
 
956
 
    _fmt = "Bound branch %(branch)s is out of date with master branch %(master)s."
 
966
    _fmt = ("Bound branch %(branch)s is out of date"
 
967
            " with master branch %(master)s.")
957
968
 
958
969
    def __init__(self, branch, master):
959
970
        BzrError.__init__(self)
963
974
        
964
975
class CommitToDoubleBoundBranch(BzrError):
965
976
 
966
 
    _fmt = "Cannot commit to branch %(branch)s. It is bound to %(master)s, which is bound to %(remote)s."
 
977
    _fmt = ("Cannot commit to branch %(branch)s."
 
978
            " It is bound to %(master)s, which is bound to %(remote)s.")
967
979
 
968
980
    def __init__(self, branch, master, remote):
969
981
        BzrError.__init__(self)
983
995
 
984
996
class BoundBranchConnectionFailure(BzrError):
985
997
 
986
 
    _fmt = "Unable to connect to target of bound branch %(branch)s => %(target)s: %(error)s"
 
998
    _fmt = ("Unable to connect to target of bound branch %(branch)s"
 
999
            " => %(target)s: %(error)s")
987
1000
 
988
1001
    def __init__(self, branch, target, error):
989
1002
        BzrError.__init__(self)
1043
1056
 
1044
1057
class WeaveTextDiffers(WeaveError):
1045
1058
 
1046
 
    _fmt = "Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"
 
1059
    _fmt = ("Weaves differ on text content. Revision:"
 
1060
            " {%(revision_id)s}, %(weave_a)s, %(weave_b)s")
1047
1061
 
1048
1062
    def __init__(self, revision_id, weave_a, weave_b):
1049
1063
        WeaveError.__init__(self)
1054
1068
 
1055
1069
class WeaveTextDiffers(WeaveError):
1056
1070
 
1057
 
    _fmt = "Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"
 
1071
    _fmt = ("Weaves differ on text content. Revision:"
 
1072
            " {%(revision_id)s}, %(weave_a)s, %(weave_b)s")
1058
1073
 
1059
1074
    def __init__(self, revision_id, weave_a, weave_b):
1060
1075
        WeaveError.__init__(self)
1157
1172
 
1158
1173
class TooManyConcurrentRequests(BzrError):
1159
1174
 
1160
 
    _fmt = ("The medium '%(medium)s' has reached its concurrent request limit. "
1161
 
            "Be sure to finish_writing and finish_reading on the "
1162
 
            "current request that is open.")
 
1175
    _fmt = ("The medium '%(medium)s' has reached its concurrent request limit."
 
1176
            " Be sure to finish_writing and finish_reading on the"
 
1177
            " current request that is open.")
1163
1178
 
1164
1179
    internal_error = True
1165
1180
 
1292
1307
 
1293
1308
class CantReprocessAndShowBase(BzrError):
1294
1309
 
1295
 
    _fmt = "Can't reprocess and show base, because reprocessing obscures " \
1296
 
           "the relationship of conflicting lines to the base"
 
1310
    _fmt = ("Can't reprocess and show base, because reprocessing obscures "
 
1311
           "the relationship of conflicting lines to the base")
1297
1312
 
1298
1313
 
1299
1314
class GraphCycleError(BzrError):
1348
1363
 
1349
1364
 
1350
1365
class MustUseDecorated(Exception):
1351
 
    
1352
 
    _fmt = """A decorating function has requested its original command be used."""
1353
 
    
 
1366
 
 
1367
    _fmt = "A decorating function has requested its original command be used."
 
1368
 
1354
1369
 
1355
1370
class NoBundleFound(BzrError):
1356
1371
 
1373
1388
 
1374
1389
class MissingText(BzrError):
1375
1390
 
1376
 
    _fmt = "Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"
 
1391
    _fmt = ("Branch %(base)s is missing revision"
 
1392
            " %(text_revision)s of %(file_id)s")
1377
1393
 
1378
1394
    def __init__(self, branch, text_revision, file_id):
1379
1395
        BzrError.__init__(self)
1496
1512
 
1497
1513
class BzrBadParameterUnicode(BzrBadParameter):
1498
1514
 
1499
 
    _fmt = "Parameter %(param)s is unicode but only byte-strings are permitted."
 
1515
    _fmt = ("Parameter %(param)s is unicode but"
 
1516
            " only byte-strings are permitted.")
1500
1517
 
1501
1518
 
1502
1519
class BzrBadParameterContainsNewline(BzrBadParameter):
1588
1605
        self.tree = tree
1589
1606
 
1590
1607
 
 
1608
class PublicBranchOutOfDate(BzrError):
 
1609
 
 
1610
    _fmt = 'Public branch "%(public_location)s" lacks revision '\
 
1611
        '"%(revstring)s".'
 
1612
 
 
1613
    def __init__(self, public_location, revstring):
 
1614
        import bzrlib.urlutils as urlutils
 
1615
        public_location = urlutils.unescape_for_display(public_location,
 
1616
                                                        'ascii')
 
1617
        BzrError.__init__(self, public_location=public_location,
 
1618
                          revstring=revstring)
 
1619
 
 
1620
 
1591
1621
class MergeModifiedFormatError(BzrError):
1592
1622
 
1593
1623
    _fmt = "Error in merge modified format"
1600
1630
 
1601
1631
class CorruptRepository(BzrError):
1602
1632
 
1603
 
    _fmt = """An error has been detected in the repository %(repo_path)s.
1604
 
Please run bzr reconcile on this repository."""
 
1633
    _fmt = ("An error has been detected in the repository %(repo_path)s.\n"
 
1634
            "Please run bzr reconcile on this repository.")
1605
1635
 
1606
1636
    def __init__(self, repo):
1607
1637
        BzrError.__init__(self)
1629
1659
 
1630
1660
class InvalidProgressBarType(BzrError):
1631
1661
 
1632
 
    _fmt = """Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1633
 
Select one of: %(valid_types)s"""
 
1662
    _fmt = ("Environment variable BZR_PROGRESS_BAR='%(bar_type)s"
 
1663
            " is not a supported type Select one of: %(valid_types)s")
1634
1664
 
1635
1665
    def __init__(self, bar_type, valid_types):
1636
1666
        BzrError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1638
1668
 
1639
1669
class UnsupportedOperation(BzrError):
1640
1670
 
1641
 
    _fmt = "The method %(mname)s is not supported on objects of type %(tname)s."
 
1671
    _fmt = ("The method %(mname)s is not supported on"
 
1672
            " objects of type %(tname)s.")
1642
1673
 
1643
1674
    def __init__(self, method, method_self):
1644
1675
        self.method = method
1651
1682
 
1652
1683
 
1653
1684
class NonAsciiRevisionId(UnsupportedOperation):
1654
 
    """Raised when a commit is attempting to set a non-ascii revision id but cant."""
 
1685
    """Raised when a commit is attempting to set a non-ascii revision id
 
1686
       but cant.
 
1687
    """
1655
1688
 
1656
1689
 
1657
1690
class BinaryFile(BzrError):
1670
1703
 
1671
1704
class TestamentMismatch(BzrError):
1672
1705
 
1673
 
    _fmt = """Testament did not match expected value.  
1674
 
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured 
 
1706
    _fmt = """Testament did not match expected value.
 
1707
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1675
1708
       {%(measured)s}"""
1676
1709
 
1677
1710
    def __init__(self, revision_id, expected, measured):
1778
1811
        self.vendor = vendor
1779
1812
 
1780
1813
 
 
1814
class SSHVendorNotFound(BzrError):
 
1815
 
 
1816
    _fmt = ("Don't know how to handle SSH connections."
 
1817
            " Please set BZR_SSH environment variable.")
 
1818
 
 
1819
 
1781
1820
class GhostRevisionUnusableHere(BzrError):
1782
1821
 
1783
1822
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1789
1828
 
1790
1829
class IllegalUseOfScopeReplacer(BzrError):
1791
1830
 
1792
 
    _fmt = "ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"
 
1831
    _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
 
1832
            " %(msg)s%(extra)s")
1793
1833
 
1794
1834
    internal_error = True
1795
1835
 
1817
1857
 
1818
1858
class ImportNameCollision(BzrError):
1819
1859
 
1820
 
    _fmt = "Tried to import an object to the same name as an existing object. %(name)s"
 
1860
    _fmt = ("Tried to import an object to the same name as"
 
1861
            " an existing object. %(name)s")
1821
1862
 
1822
1863
    internal_error = True
1823
1864
 
1826
1867
        self.name = name
1827
1868
 
1828
1869
 
 
1870
class NoMergeSource(BzrError):
 
1871
    """Raise if no merge source was specified for a merge directive"""
 
1872
 
 
1873
    _fmt = "A merge directive must provide either a bundle or a public"\
 
1874
        " branch location."
 
1875
 
 
1876
 
 
1877
class PatchMissing(BzrError):
 
1878
    """Raise a patch type was specified but no patch supplied"""
 
1879
 
 
1880
    _fmt = "patch_type was %(patch_type)s, but no patch was supplied."
 
1881
 
 
1882
    def __init__(self, patch_type):
 
1883
        BzrError.__init__(self)
 
1884
        self.patch_type = patch_type
 
1885
 
 
1886
 
1829
1887
class UnsupportedInventoryKind(BzrError):
1830
1888
    
1831
1889
    _fmt = """Unsupported entry kind %(kind)s"""
1874
1932
 
1875
1933
class TagsNotSupported(BzrError):
1876
1934
 
1877
 
    _fmt = "Tags not supported by %(branch)s; you may be able to use bzr upgrade."
 
1935
    _fmt = ("Tags not supported by %(branch)s;"
 
1936
            " you may be able to use bzr upgrade.")
1878
1937
 
1879
1938
    def __init__(self, branch):
1880
1939
        self.branch = branch