/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 Martins 0.15rc2 release branch.

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
 
469
471
       self.path = urlutils.unescape_for_display(path, 'ascii')
470
472
 
471
473
 
 
474
class NoSubmitBranch(PathError):
 
475
 
 
476
    _fmt = 'No submit branch available for branch "%(path)s"'
 
477
 
 
478
    def __init__(self, branch):
 
479
       import bzrlib.urlutils as urlutils
 
480
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
 
481
 
 
482
 
472
483
class AlreadyBranchError(PathError):
473
484
 
474
485
    _fmt = "Already a branch: %(path)s."
482
493
 
483
494
class AtomicFileAlreadyClosed(PathError):
484
495
 
485
 
    _fmt = "'%(function)s' called on an AtomicFile after it was closed: %(path)s"
 
496
    _fmt = ("'%(function)s' called on an AtomicFile after it was closed:"
 
497
            " %(path)s")
486
498
 
487
499
    def __init__(self, path, function):
488
500
        PathError.__init__(self, path=path, extra=None)
491
503
 
492
504
class InaccessibleParent(PathError):
493
505
 
494
 
    _fmt = "Parent not accessible given base %(base)s and relative path %(path)s"
 
506
    _fmt = ("Parent not accessible given base %(base)s and"
 
507
            " relative path %(path)s")
495
508
 
496
509
    def __init__(self, path, base):
497
510
        PathError.__init__(self, path)
634
647
 
635
648
class LockError(BzrError):
636
649
 
637
 
    _fmt = "Lock error: %(message)s"
 
650
    _fmt = "Lock error: %(msg)s"
638
651
 
639
652
    internal_error = True
640
653
 
644
657
    #
645
658
    # New code should prefer to raise specific subclasses
646
659
    def __init__(self, message):
647
 
        self.message = message
 
660
        # Python 2.5 uses a slot for StandardError.message,
 
661
        # so use a different variable name
 
662
        # so it is exposed in self.__dict__
 
663
        self.msg = message
648
664
 
649
665
 
650
666
class LockActive(LockError):
686
702
 
687
703
class OutSideTransaction(BzrError):
688
704
 
689
 
    _fmt = "A transaction related operation was attempted after the transaction finished."
 
705
    _fmt = ("A transaction related operation was attempted after"
 
706
            " the transaction finished.")
690
707
 
691
708
 
692
709
class ObjectNotLocked(LockError):
730
747
 
731
748
class LockBroken(LockError):
732
749
 
733
 
    _fmt = "Lock was broken while still open: %(lock)s - check storage consistency!"
 
750
    _fmt = ("Lock was broken while still open: %(lock)s"
 
751
            " - check storage consistency!")
734
752
 
735
753
    internal_error = False
736
754
 
740
758
 
741
759
class LockBreakMismatch(LockError):
742
760
 
743
 
    _fmt = "Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)r, wanted to break %(target)r"
 
761
    _fmt = ("Lock was released and re-acquired before being broken:"
 
762
            " %(lock)s: held by %(holder)r, wanted to break %(target)r")
744
763
 
745
764
    internal_error = False
746
765
 
796
815
 
797
816
class NotLeftParentDescendant(BzrError):
798
817
 
799
 
    _fmt = "Revision %(old_revision)s is not the left parent of"\
800
 
        " %(new_revision)s, but branch %(branch_location)s expects this"
 
818
    _fmt = ("Revision %(old_revision)s is not the left parent of"
 
819
            " %(new_revision)s, but branch %(branch_location)s expects this")
801
820
 
802
821
    internal_error = True
803
822
 
828
847
 
829
848
class InvalidRevisionSpec(BzrError):
830
849
 
831
 
    _fmt = "Requested revision: %(spec)r does not exist in branch: %(branch)s%(extra)s"
 
850
    _fmt = ("Requested revision: %(spec)r does not exist in branch:"
 
851
            " %(branch)s%(extra)s")
832
852
 
833
853
    def __init__(self, spec, branch, extra=None):
834
854
        BzrError.__init__(self, branch=branch, spec=spec)
845
865
 
846
866
class AppendRevisionsOnlyViolation(BzrError):
847
867
 
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".'
 
868
    _fmt = ('Operation denied because it would change the main history,'
 
869
           ' which is not permitted by the append_revisions_only setting on'
 
870
           ' branch "%(location)s".')
851
871
 
852
872
    def __init__(self, location):
853
873
       import bzrlib.urlutils as urlutils
856
876
 
857
877
 
858
878
class DivergedBranches(BzrError):
859
 
    
860
 
    _fmt = "These branches have diverged.  Use the merge command to reconcile them."""
 
879
 
 
880
    _fmt = ("These branches have diverged."
 
881
            " Use the merge command to reconcile them.")
861
882
 
862
883
    internal_error = False
863
884
 
878
899
 
879
900
class UnrelatedBranches(BzrError):
880
901
 
881
 
    _fmt = "Branches have no common ancestor, and no merge base revision was specified."
 
902
    _fmt = ("Branches have no common ancestor, and"
 
903
            " no merge base revision was specified.")
882
904
 
883
905
    internal_error = False
884
906
 
894
916
 
895
917
class NoCommonRoot(BzrError):
896
918
 
897
 
    _fmt = "Revisions are not derived from the same root: " \
898
 
           "%(revision_a)s %(revision_b)s."
 
919
    _fmt = ("Revisions are not derived from the same root: "
 
920
           "%(revision_a)s %(revision_b)s.")
899
921
 
900
922
    def __init__(self, revision_a, revision_b):
901
923
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
924
946
    def __init__(self, bases):
925
947
        warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
926
948
                DeprecationWarning)
927
 
        msg = "The correct base is unclear, because %s are all equally close" %\
928
 
            ", ".join(bases)
 
949
        msg = ("The correct base is unclear, because %s are all equally close"
 
950
                % ", ".join(bases))
929
951
        BzrError.__init__(self, msg)
930
952
        self.bases = bases
931
953
 
953
975
 
954
976
class BoundBranchOutOfDate(BzrError):
955
977
 
956
 
    _fmt = "Bound branch %(branch)s is out of date with master branch %(master)s."
 
978
    _fmt = ("Bound branch %(branch)s is out of date"
 
979
            " with master branch %(master)s.")
957
980
 
958
981
    def __init__(self, branch, master):
959
982
        BzrError.__init__(self)
963
986
        
964
987
class CommitToDoubleBoundBranch(BzrError):
965
988
 
966
 
    _fmt = "Cannot commit to branch %(branch)s. It is bound to %(master)s, which is bound to %(remote)s."
 
989
    _fmt = ("Cannot commit to branch %(branch)s."
 
990
            " It is bound to %(master)s, which is bound to %(remote)s.")
967
991
 
968
992
    def __init__(self, branch, master, remote):
969
993
        BzrError.__init__(self)
983
1007
 
984
1008
class BoundBranchConnectionFailure(BzrError):
985
1009
 
986
 
    _fmt = "Unable to connect to target of bound branch %(branch)s => %(target)s: %(error)s"
 
1010
    _fmt = ("Unable to connect to target of bound branch %(branch)s"
 
1011
            " => %(target)s: %(error)s")
987
1012
 
988
1013
    def __init__(self, branch, target, error):
989
1014
        BzrError.__init__(self)
1043
1068
 
1044
1069
class WeaveTextDiffers(WeaveError):
1045
1070
 
1046
 
    _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")
1047
1073
 
1048
1074
    def __init__(self, revision_id, weave_a, weave_b):
1049
1075
        WeaveError.__init__(self)
1054
1080
 
1055
1081
class WeaveTextDiffers(WeaveError):
1056
1082
 
1057
 
    _fmt = "Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"
 
1083
    _fmt = ("Weaves differ on text content. Revision:"
 
1084
            " {%(revision_id)s}, %(weave_a)s, %(weave_b)s")
1058
1085
 
1059
1086
    def __init__(self, revision_id, weave_a, weave_b):
1060
1087
        WeaveError.__init__(self)
1157
1184
 
1158
1185
class TooManyConcurrentRequests(BzrError):
1159
1186
 
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.")
 
1187
    _fmt = ("The medium '%(medium)s' has reached its concurrent request limit."
 
1188
            " Be sure to finish_writing and finish_reading on the"
 
1189
            " current request that is open.")
1163
1190
 
1164
1191
    internal_error = True
1165
1192
 
1292
1319
 
1293
1320
class CantReprocessAndShowBase(BzrError):
1294
1321
 
1295
 
    _fmt = "Can't reprocess and show base, because reprocessing obscures " \
1296
 
           "the relationship of conflicting lines to the base"
 
1322
    _fmt = ("Can't reprocess and show base, because reprocessing obscures "
 
1323
           "the relationship of conflicting lines to the base")
1297
1324
 
1298
1325
 
1299
1326
class GraphCycleError(BzrError):
1348
1375
 
1349
1376
 
1350
1377
class MustUseDecorated(Exception):
1351
 
    
1352
 
    _fmt = """A decorating function has requested its original command be used."""
1353
 
    
 
1378
 
 
1379
    _fmt = "A decorating function has requested its original command be used."
 
1380
 
1354
1381
 
1355
1382
class NoBundleFound(BzrError):
1356
1383
 
1373
1400
 
1374
1401
class MissingText(BzrError):
1375
1402
 
1376
 
    _fmt = "Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"
 
1403
    _fmt = ("Branch %(base)s is missing revision"
 
1404
            " %(text_revision)s of %(file_id)s")
1377
1405
 
1378
1406
    def __init__(self, branch, text_revision, file_id):
1379
1407
        BzrError.__init__(self)
1496
1524
 
1497
1525
class BzrBadParameterUnicode(BzrBadParameter):
1498
1526
 
1499
 
    _fmt = "Parameter %(param)s is unicode but only byte-strings are permitted."
 
1527
    _fmt = ("Parameter %(param)s is unicode but"
 
1528
            " only byte-strings are permitted.")
1500
1529
 
1501
1530
 
1502
1531
class BzrBadParameterContainsNewline(BzrBadParameter):
1588
1617
        self.tree = tree
1589
1618
 
1590
1619
 
 
1620
class PublicBranchOutOfDate(BzrError):
 
1621
 
 
1622
    _fmt = 'Public branch "%(public_location)s" lacks revision '\
 
1623
        '"%(revstring)s".'
 
1624
 
 
1625
    def __init__(self, public_location, revstring):
 
1626
        import bzrlib.urlutils as urlutils
 
1627
        public_location = urlutils.unescape_for_display(public_location,
 
1628
                                                        'ascii')
 
1629
        BzrError.__init__(self, public_location=public_location,
 
1630
                          revstring=revstring)
 
1631
 
 
1632
 
1591
1633
class MergeModifiedFormatError(BzrError):
1592
1634
 
1593
1635
    _fmt = "Error in merge modified format"
1600
1642
 
1601
1643
class CorruptRepository(BzrError):
1602
1644
 
1603
 
    _fmt = """An error has been detected in the repository %(repo_path)s.
1604
 
Please run bzr reconcile on this repository."""
 
1645
    _fmt = ("An error has been detected in the repository %(repo_path)s.\n"
 
1646
            "Please run bzr reconcile on this repository.")
1605
1647
 
1606
1648
    def __init__(self, repo):
1607
1649
        BzrError.__init__(self)
1629
1671
 
1630
1672
class InvalidProgressBarType(BzrError):
1631
1673
 
1632
 
    _fmt = """Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1633
 
Select one of: %(valid_types)s"""
 
1674
    _fmt = ("Environment variable BZR_PROGRESS_BAR='%(bar_type)s"
 
1675
            " is not a supported type Select one of: %(valid_types)s")
1634
1676
 
1635
1677
    def __init__(self, bar_type, valid_types):
1636
1678
        BzrError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1638
1680
 
1639
1681
class UnsupportedOperation(BzrError):
1640
1682
 
1641
 
    _fmt = "The method %(mname)s is not supported on objects of type %(tname)s."
 
1683
    _fmt = ("The method %(mname)s is not supported on"
 
1684
            " objects of type %(tname)s.")
1642
1685
 
1643
1686
    def __init__(self, method, method_self):
1644
1687
        self.method = method
1651
1694
 
1652
1695
 
1653
1696
class NonAsciiRevisionId(UnsupportedOperation):
1654
 
    """Raised when a commit is attempting to set a non-ascii revision id but cant."""
 
1697
    """Raised when a commit is attempting to set a non-ascii revision id
 
1698
       but cant.
 
1699
    """
1655
1700
 
1656
1701
 
1657
1702
class BinaryFile(BzrError):
1670
1715
 
1671
1716
class TestamentMismatch(BzrError):
1672
1717
 
1673
 
    _fmt = """Testament did not match expected value.  
1674
 
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured 
 
1718
    _fmt = """Testament did not match expected value.
 
1719
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1675
1720
       {%(measured)s}"""
1676
1721
 
1677
1722
    def __init__(self, revision_id, expected, measured):
1778
1823
        self.vendor = vendor
1779
1824
 
1780
1825
 
 
1826
class SSHVendorNotFound(BzrError):
 
1827
 
 
1828
    _fmt = ("Don't know how to handle SSH connections."
 
1829
            " Please set BZR_SSH environment variable.")
 
1830
 
 
1831
 
1781
1832
class GhostRevisionUnusableHere(BzrError):
1782
1833
 
1783
1834
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1789
1840
 
1790
1841
class IllegalUseOfScopeReplacer(BzrError):
1791
1842
 
1792
 
    _fmt = "ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"
 
1843
    _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
 
1844
            " %(msg)s%(extra)s")
1793
1845
 
1794
1846
    internal_error = True
1795
1847
 
1817
1869
 
1818
1870
class ImportNameCollision(BzrError):
1819
1871
 
1820
 
    _fmt = "Tried to import an object to the same name as an existing object. %(name)s"
 
1872
    _fmt = ("Tried to import an object to the same name as"
 
1873
            " an existing object. %(name)s")
1821
1874
 
1822
1875
    internal_error = True
1823
1876
 
1826
1879
        self.name = name
1827
1880
 
1828
1881
 
 
1882
class NotAMergeDirective(BzrError):
 
1883
    """File starting with %(firstline)r is not a merge directive"""
 
1884
    def __init__(self, firstline):
 
1885
        BzrError.__init__(self, firstline=firstline)
 
1886
 
 
1887
 
 
1888
class NoMergeSource(BzrError):
 
1889
    """Raise if no merge source was specified for a merge directive"""
 
1890
 
 
1891
    _fmt = "A merge directive must provide either a bundle or a public"\
 
1892
        " branch location."
 
1893
 
 
1894
 
 
1895
class PatchMissing(BzrError):
 
1896
    """Raise a patch type was specified but no patch supplied"""
 
1897
 
 
1898
    _fmt = "patch_type was %(patch_type)s, but no patch was supplied."
 
1899
 
 
1900
    def __init__(self, patch_type):
 
1901
        BzrError.__init__(self)
 
1902
        self.patch_type = patch_type
 
1903
 
 
1904
 
1829
1905
class UnsupportedInventoryKind(BzrError):
1830
1906
    
1831
1907
    _fmt = """Unsupported entry kind %(kind)s"""
1874
1950
 
1875
1951
class TagsNotSupported(BzrError):
1876
1952
 
1877
 
    _fmt = "Tags not supported by %(branch)s; you may be able to use bzr upgrade."
 
1953
    _fmt = ("Tags not supported by %(branch)s;"
 
1954
            " you may be able to use bzr upgrade.")
1878
1955
 
1879
1956
    def __init__(self, branch):
1880
1957
        self.branch = branch