/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: Alexander Belchenko
  • Date: 2007-03-13 02:16:17 UTC
  • mfrom: (2346 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2356.
  • Revision ID: bialix@ukr.net-20070313021617-azd5lv30b23gyu48
merge 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
 
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)
686
699
 
687
700
class OutSideTransaction(BzrError):
688
701
 
689
 
    _fmt = "A transaction related operation was attempted after the transaction finished."
 
702
    _fmt = ("A transaction related operation was attempted after"
 
703
            " the transaction finished.")
690
704
 
691
705
 
692
706
class ObjectNotLocked(LockError):
730
744
 
731
745
class LockBroken(LockError):
732
746
 
733
 
    _fmt = "Lock was broken while still open: %(lock)s - check storage consistency!"
 
747
    _fmt = ("Lock was broken while still open: %(lock)s"
 
748
            " - check storage consistency!")
734
749
 
735
750
    internal_error = False
736
751
 
740
755
 
741
756
class LockBreakMismatch(LockError):
742
757
 
743
 
    _fmt = "Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)r, wanted to break %(target)r"
 
758
    _fmt = ("Lock was released and re-acquired before being broken:"
 
759
            " %(lock)s: held by %(holder)r, wanted to break %(target)r")
744
760
 
745
761
    internal_error = False
746
762
 
796
812
 
797
813
class NotLeftParentDescendant(BzrError):
798
814
 
799
 
    _fmt = "Revision %(old_revision)s is not the left parent of"\
800
 
        " %(new_revision)s, but branch %(branch_location)s expects this"
 
815
    _fmt = ("Revision %(old_revision)s is not the left parent of"
 
816
            " %(new_revision)s, but branch %(branch_location)s expects this")
801
817
 
802
818
    internal_error = True
803
819
 
828
844
 
829
845
class InvalidRevisionSpec(BzrError):
830
846
 
831
 
    _fmt = "Requested revision: %(spec)r does not exist in branch: %(branch)s%(extra)s"
 
847
    _fmt = ("Requested revision: %(spec)r does not exist in branch:"
 
848
            " %(branch)s%(extra)s")
832
849
 
833
850
    def __init__(self, spec, branch, extra=None):
834
851
        BzrError.__init__(self, branch=branch, spec=spec)
845
862
 
846
863
class AppendRevisionsOnlyViolation(BzrError):
847
864
 
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".'
 
865
    _fmt = ('Operation denied because it would change the main history,'
 
866
           ' which is not permitted by the append_revisions_only setting on'
 
867
           ' branch "%(location)s".')
851
868
 
852
869
    def __init__(self, location):
853
870
       import bzrlib.urlutils as urlutils
856
873
 
857
874
 
858
875
class DivergedBranches(BzrError):
859
 
    
860
 
    _fmt = "These branches have diverged.  Use the merge command to reconcile them."""
 
876
 
 
877
    _fmt = ("These branches have diverged."
 
878
            " Use the merge command to reconcile them.")
861
879
 
862
880
    internal_error = False
863
881
 
878
896
 
879
897
class UnrelatedBranches(BzrError):
880
898
 
881
 
    _fmt = "Branches have no common ancestor, and no merge base revision was specified."
 
899
    _fmt = ("Branches have no common ancestor, and"
 
900
            " no merge base revision was specified.")
882
901
 
883
902
    internal_error = False
884
903
 
894
913
 
895
914
class NoCommonRoot(BzrError):
896
915
 
897
 
    _fmt = "Revisions are not derived from the same root: " \
898
 
           "%(revision_a)s %(revision_b)s."
 
916
    _fmt = ("Revisions are not derived from the same root: "
 
917
           "%(revision_a)s %(revision_b)s.")
899
918
 
900
919
    def __init__(self, revision_a, revision_b):
901
920
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
924
943
    def __init__(self, bases):
925
944
        warn("BzrError AmbiguousBase has been deprecated as of bzrlib 0.8.",
926
945
                DeprecationWarning)
927
 
        msg = "The correct base is unclear, because %s are all equally close" %\
928
 
            ", ".join(bases)
 
946
        msg = ("The correct base is unclear, because %s are all equally close"
 
947
                % ", ".join(bases))
929
948
        BzrError.__init__(self, msg)
930
949
        self.bases = bases
931
950
 
953
972
 
954
973
class BoundBranchOutOfDate(BzrError):
955
974
 
956
 
    _fmt = "Bound branch %(branch)s is out of date with master branch %(master)s."
 
975
    _fmt = ("Bound branch %(branch)s is out of date"
 
976
            " with master branch %(master)s.")
957
977
 
958
978
    def __init__(self, branch, master):
959
979
        BzrError.__init__(self)
963
983
        
964
984
class CommitToDoubleBoundBranch(BzrError):
965
985
 
966
 
    _fmt = "Cannot commit to branch %(branch)s. It is bound to %(master)s, which is bound to %(remote)s."
 
986
    _fmt = ("Cannot commit to branch %(branch)s."
 
987
            " It is bound to %(master)s, which is bound to %(remote)s.")
967
988
 
968
989
    def __init__(self, branch, master, remote):
969
990
        BzrError.__init__(self)
983
1004
 
984
1005
class BoundBranchConnectionFailure(BzrError):
985
1006
 
986
 
    _fmt = "Unable to connect to target of bound branch %(branch)s => %(target)s: %(error)s"
 
1007
    _fmt = ("Unable to connect to target of bound branch %(branch)s"
 
1008
            " => %(target)s: %(error)s")
987
1009
 
988
1010
    def __init__(self, branch, target, error):
989
1011
        BzrError.__init__(self)
1043
1065
 
1044
1066
class WeaveTextDiffers(WeaveError):
1045
1067
 
1046
 
    _fmt = "Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"
 
1068
    _fmt = ("Weaves differ on text content. Revision:"
 
1069
            " {%(revision_id)s}, %(weave_a)s, %(weave_b)s")
1047
1070
 
1048
1071
    def __init__(self, revision_id, weave_a, weave_b):
1049
1072
        WeaveError.__init__(self)
1054
1077
 
1055
1078
class WeaveTextDiffers(WeaveError):
1056
1079
 
1057
 
    _fmt = "Weaves differ on text content. Revision: {%(revision_id)s}, %(weave_a)s, %(weave_b)s"
 
1080
    _fmt = ("Weaves differ on text content. Revision:"
 
1081
            " {%(revision_id)s}, %(weave_a)s, %(weave_b)s")
1058
1082
 
1059
1083
    def __init__(self, revision_id, weave_a, weave_b):
1060
1084
        WeaveError.__init__(self)
1157
1181
 
1158
1182
class TooManyConcurrentRequests(BzrError):
1159
1183
 
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.")
 
1184
    _fmt = ("The medium '%(medium)s' has reached its concurrent request limit."
 
1185
            " Be sure to finish_writing and finish_reading on the"
 
1186
            " current request that is open.")
1163
1187
 
1164
1188
    internal_error = True
1165
1189
 
1292
1316
 
1293
1317
class CantReprocessAndShowBase(BzrError):
1294
1318
 
1295
 
    _fmt = "Can't reprocess and show base, because reprocessing obscures " \
1296
 
           "the relationship of conflicting lines to the base"
 
1319
    _fmt = ("Can't reprocess and show base, because reprocessing obscures "
 
1320
           "the relationship of conflicting lines to the base")
1297
1321
 
1298
1322
 
1299
1323
class GraphCycleError(BzrError):
1348
1372
 
1349
1373
 
1350
1374
class MustUseDecorated(Exception):
1351
 
    
1352
 
    _fmt = """A decorating function has requested its original command be used."""
1353
 
    
 
1375
 
 
1376
    _fmt = "A decorating function has requested its original command be used."
 
1377
 
1354
1378
 
1355
1379
class NoBundleFound(BzrError):
1356
1380
 
1373
1397
 
1374
1398
class MissingText(BzrError):
1375
1399
 
1376
 
    _fmt = "Branch %(base)s is missing revision %(text_revision)s of %(file_id)s"
 
1400
    _fmt = ("Branch %(base)s is missing revision"
 
1401
            " %(text_revision)s of %(file_id)s")
1377
1402
 
1378
1403
    def __init__(self, branch, text_revision, file_id):
1379
1404
        BzrError.__init__(self)
1496
1521
 
1497
1522
class BzrBadParameterUnicode(BzrBadParameter):
1498
1523
 
1499
 
    _fmt = "Parameter %(param)s is unicode but only byte-strings are permitted."
 
1524
    _fmt = ("Parameter %(param)s is unicode but"
 
1525
            " only byte-strings are permitted.")
1500
1526
 
1501
1527
 
1502
1528
class BzrBadParameterContainsNewline(BzrBadParameter):
1588
1614
        self.tree = tree
1589
1615
 
1590
1616
 
 
1617
class PublicBranchOutOfDate(BzrError):
 
1618
 
 
1619
    _fmt = 'Public branch "%(public_location)s" lacks revision '\
 
1620
        '"%(revstring)s".'
 
1621
 
 
1622
    def __init__(self, public_location, revstring):
 
1623
        import bzrlib.urlutils as urlutils
 
1624
        public_location = urlutils.unescape_for_display(public_location,
 
1625
                                                        'ascii')
 
1626
        BzrError.__init__(self, public_location=public_location,
 
1627
                          revstring=revstring)
 
1628
 
 
1629
 
1591
1630
class MergeModifiedFormatError(BzrError):
1592
1631
 
1593
1632
    _fmt = "Error in merge modified format"
1600
1639
 
1601
1640
class CorruptRepository(BzrError):
1602
1641
 
1603
 
    _fmt = """An error has been detected in the repository %(repo_path)s.
1604
 
Please run bzr reconcile on this repository."""
 
1642
    _fmt = ("An error has been detected in the repository %(repo_path)s.\n"
 
1643
            "Please run bzr reconcile on this repository.")
1605
1644
 
1606
1645
    def __init__(self, repo):
1607
1646
        BzrError.__init__(self)
1629
1668
 
1630
1669
class InvalidProgressBarType(BzrError):
1631
1670
 
1632
 
    _fmt = """Environment variable BZR_PROGRESS_BAR='%(bar_type)s is not a supported type
1633
 
Select one of: %(valid_types)s"""
 
1671
    _fmt = ("Environment variable BZR_PROGRESS_BAR='%(bar_type)s"
 
1672
            " is not a supported type Select one of: %(valid_types)s")
1634
1673
 
1635
1674
    def __init__(self, bar_type, valid_types):
1636
1675
        BzrError.__init__(self, bar_type=bar_type, valid_types=valid_types)
1638
1677
 
1639
1678
class UnsupportedOperation(BzrError):
1640
1679
 
1641
 
    _fmt = "The method %(mname)s is not supported on objects of type %(tname)s."
 
1680
    _fmt = ("The method %(mname)s is not supported on"
 
1681
            " objects of type %(tname)s.")
1642
1682
 
1643
1683
    def __init__(self, method, method_self):
1644
1684
        self.method = method
1651
1691
 
1652
1692
 
1653
1693
class NonAsciiRevisionId(UnsupportedOperation):
1654
 
    """Raised when a commit is attempting to set a non-ascii revision id but cant."""
 
1694
    """Raised when a commit is attempting to set a non-ascii revision id
 
1695
       but cant.
 
1696
    """
1655
1697
 
1656
1698
 
1657
1699
class BinaryFile(BzrError):
1670
1712
 
1671
1713
class TestamentMismatch(BzrError):
1672
1714
 
1673
 
    _fmt = """Testament did not match expected value.  
1674
 
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured 
 
1715
    _fmt = """Testament did not match expected value.
 
1716
       For revision_id {%(revision_id)s}, expected {%(expected)s}, measured
1675
1717
       {%(measured)s}"""
1676
1718
 
1677
1719
    def __init__(self, revision_id, expected, measured):
1778
1820
        self.vendor = vendor
1779
1821
 
1780
1822
 
 
1823
class SSHVendorNotFound(BzrError):
 
1824
 
 
1825
    _fmt = ("Don't know how to handle SSH connections."
 
1826
            " Please set BZR_SSH environment variable.")
 
1827
 
 
1828
 
1781
1829
class GhostRevisionUnusableHere(BzrError):
1782
1830
 
1783
1831
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
1789
1837
 
1790
1838
class IllegalUseOfScopeReplacer(BzrError):
1791
1839
 
1792
 
    _fmt = "ScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)s"
 
1840
    _fmt = ("ScopeReplacer object %(name)r was used incorrectly:"
 
1841
            " %(msg)s%(extra)s")
1793
1842
 
1794
1843
    internal_error = True
1795
1844
 
1817
1866
 
1818
1867
class ImportNameCollision(BzrError):
1819
1868
 
1820
 
    _fmt = "Tried to import an object to the same name as an existing object. %(name)s"
 
1869
    _fmt = ("Tried to import an object to the same name as"
 
1870
            " an existing object. %(name)s")
1821
1871
 
1822
1872
    internal_error = True
1823
1873
 
1826
1876
        self.name = name
1827
1877
 
1828
1878
 
 
1879
class NotAMergeDirective(BzrError):
 
1880
    """File starting with %(firstline)r is not a merge directive"""
 
1881
    def __init__(self, firstline):
 
1882
        BzrError.__init__(self, firstline=firstline)
 
1883
 
 
1884
 
 
1885
class NoMergeSource(BzrError):
 
1886
    """Raise if no merge source was specified for a merge directive"""
 
1887
 
 
1888
    _fmt = "A merge directive must provide either a bundle or a public"\
 
1889
        " branch location."
 
1890
 
 
1891
 
 
1892
class PatchMissing(BzrError):
 
1893
    """Raise a patch type was specified but no patch supplied"""
 
1894
 
 
1895
    _fmt = "patch_type was %(patch_type)s, but no patch was supplied."
 
1896
 
 
1897
    def __init__(self, patch_type):
 
1898
        BzrError.__init__(self)
 
1899
        self.patch_type = patch_type
 
1900
 
 
1901
 
1829
1902
class UnsupportedInventoryKind(BzrError):
1830
1903
    
1831
1904
    _fmt = """Unsupported entry kind %(kind)s"""
1874
1947
 
1875
1948
class TagsNotSupported(BzrError):
1876
1949
 
1877
 
    _fmt = "Tags not supported by %(branch)s; you may be able to use bzr upgrade."
 
1950
    _fmt = ("Tags not supported by %(branch)s;"
 
1951
            " you may be able to use bzr upgrade.")
1878
1952
 
1879
1953
    def __init__(self, branch):
1880
1954
        self.branch = branch