/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 breezy/errors.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
124
124
        fmt = getattr(self, '_fmt', None)
125
125
        if fmt is not None:
126
126
            from breezy.i18n import gettext
127
 
            return gettext(fmt) # _fmt strings should be ascii
 
127
            return gettext(fmt)  # _fmt strings should be ascii
128
128
 
129
129
    def __eq__(self, other):
130
130
        if self.__class__ is not other.__class__:
222
222
class RootMissing(InternalBzrError):
223
223
 
224
224
    _fmt = ("The root entry of a tree must be the first entry supplied to "
225
 
        "the commit builder.")
 
225
            "the commit builder.")
226
226
 
227
227
 
228
228
class NoPublicBranch(BzrError):
398
398
class UnavailableRepresentation(InternalBzrError):
399
399
 
400
400
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
401
 
        "is encoded as '%(native)s'.")
 
401
            "is encoded as '%(native)s'.")
402
402
 
403
403
    def __init__(self, key, wanted, native):
404
404
        InternalBzrError.__init__(self)
428
428
class UnstackableRepositoryFormat(BzrError):
429
429
 
430
430
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
431
 
        "You will need to upgrade the repository to permit branch stacking.")
 
431
            "You will need to upgrade the repository to permit branch stacking.")
432
432
 
433
433
    def __init__(self, format, url):
434
434
        BzrError.__init__(self)
484
484
    _fmt = 'Not a branch: "%(path)s"%(detail)s.'
485
485
 
486
486
    def __init__(self, path, detail=None, controldir=None):
487
 
       from . import urlutils
488
 
       path = urlutils.unescape_for_display(path, 'ascii')
489
 
       if detail is not None:
490
 
           detail = ': ' + detail
491
 
       self.detail = detail
492
 
       self.controldir = controldir
493
 
       PathError.__init__(self, path=path)
 
487
        from . import urlutils
 
488
        path = urlutils.unescape_for_display(path, 'ascii')
 
489
        if detail is not None:
 
490
            detail = ': ' + detail
 
491
        self.detail = detail
 
492
        self.controldir = controldir
 
493
        PathError.__init__(self, path=path)
494
494
 
495
495
    def __repr__(self):
496
496
        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
498
498
    def _get_format_string(self):
499
499
        # GZ 2017-06-08: Not the best place to lazy fill detail in.
500
500
        if self.detail is None:
501
 
           self.detail = self._get_detail()
 
501
            self.detail = self._get_detail()
502
502
        return super(NotBranchError, self)._get_format_string()
503
503
 
504
504
    def _get_detail(self):
526
526
    _fmt = 'No submit branch available for branch "%(path)s"'
527
527
 
528
528
    def __init__(self, branch):
529
 
       from . import urlutils
530
 
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
 
529
        from . import urlutils
 
530
        self.path = urlutils.unescape_for_display(branch.base, 'ascii')
531
531
 
532
532
 
533
533
class AlreadyControlDirError(PathError):
573
573
class NoRepositoryPresent(BzrError):
574
574
 
575
575
    _fmt = 'No repository present: "%(path)s"'
 
576
 
576
577
    def __init__(self, controldir):
577
578
        BzrError.__init__(self)
578
579
        self.path = controldir.transport.clone('..').base
592
593
        self.format = format
593
594
 
594
595
 
 
596
class LineEndingError(BzrError):
 
597
 
 
598
    _fmt = ("Line ending corrupted for file: %(file)s; "
 
599
            "Maybe your files got corrupted in transport?")
 
600
 
 
601
    def __init__(self, file):
 
602
        self.file = file
 
603
 
 
604
 
595
605
class IncompatibleFormat(BzrError):
596
606
 
597
607
    _fmt = "Format %(format)s is not compatible with .bzr version %(controldir)s."
623
633
    """
624
634
 
625
635
    _fmt = "%(target)s\n" \
626
 
            "is not compatible with\n" \
627
 
            "%(source)s\n" \
628
 
            "%(details)s"
 
636
        "is not compatible with\n" \
 
637
        "%(source)s\n" \
 
638
        "%(details)s"
629
639
 
630
640
    def __init__(self, source, target, details=None):
631
641
        if details is None:
976
986
class AppendRevisionsOnlyViolation(BzrError):
977
987
 
978
988
    _fmt = ('Operation denied because it would change the main history,'
979
 
           ' which is not permitted by the append_revisions_only setting on'
980
 
           ' branch "%(location)s".')
 
989
            ' which is not permitted by the append_revisions_only setting on'
 
990
            ' branch "%(location)s".')
981
991
 
982
992
    def __init__(self, location):
983
 
       import breezy.urlutils as urlutils
984
 
       location = urlutils.unescape_for_display(location, 'ascii')
985
 
       BzrError.__init__(self, location=location)
 
993
        import breezy.urlutils as urlutils
 
994
        location = urlutils.unescape_for_display(location, 'ascii')
 
995
        BzrError.__init__(self, location=location)
986
996
 
987
997
 
988
998
class DivergedBranches(BzrError):
1028
1038
class NoCommonRoot(BzrError):
1029
1039
 
1030
1040
    _fmt = ("Revisions are not derived from the same root: "
1031
 
           "%(revision_a)s %(revision_b)s.")
 
1041
            "%(revision_a)s %(revision_b)s.")
1032
1042
 
1033
1043
    def __init__(self, revision_a, revision_b):
1034
1044
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
1040
1050
 
1041
1051
    def __init__(self, rev_id, not_ancestor_id):
1042
1052
        BzrError.__init__(self, rev_id=rev_id,
1043
 
            not_ancestor_id=not_ancestor_id)
 
1053
                          not_ancestor_id=not_ancestor_id)
1044
1054
 
1045
1055
 
1046
1056
class NoCommits(BranchError):
1054
1064
        BzrError.__init__(self, "Store %s is not listable" % store)
1055
1065
 
1056
1066
 
1057
 
 
1058
1067
class UnlistableBranch(BzrError):
1059
1068
 
1060
1069
    def __init__(self, br):
1202
1211
        if orig_error is None:
1203
1212
            orig_error = ''
1204
1213
        if msg is None:
1205
 
            msg =  ''
 
1214
            msg = ''
1206
1215
        self.msg = msg
1207
1216
        self.orig_error = orig_error
1208
1217
        BzrError.__init__(self)
1253
1262
        self.exc_type, self.exc_value, self.exc_tb = exc_info
1254
1263
        self.exc_info = exc_info
1255
1264
        traceback_strings = traceback.format_exception(
1256
 
                self.exc_type, self.exc_value, self.exc_tb)
 
1265
            self.exc_type, self.exc_value, self.exc_tb)
1257
1266
        self.traceback_text = ''.join(traceback_strings)
1258
1267
 
1259
1268
 
1560
1569
class BzrMoveFailedError(BzrError):
1561
1570
 
1562
1571
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1563
 
        "%(_has_extra)s%(extra)s")
 
1572
            "%(_has_extra)s%(extra)s")
1564
1573
 
1565
1574
    def __init__(self, from_path='', to_path='', extra=None):
1566
1575
        from breezy.osutils import splitpath
1596
1605
class BzrRenameFailedError(BzrMoveFailedError):
1597
1606
 
1598
1607
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
1599
 
        "%(_has_extra)s%(extra)s")
 
1608
            "%(_has_extra)s%(extra)s")
1600
1609
 
1601
1610
    def __init__(self, from_path, to_path, extra=None):
1602
1611
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1648
1657
class BadConversionTarget(BzrError):
1649
1658
 
1650
1659
    _fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
1651
 
            "    %(problem)s"
 
1660
        "    %(problem)s"
1652
1661
 
1653
1662
    def __init__(self, problem, format, from_format=None):
1654
1663
        BzrError.__init__(self)
1699
1708
    keep, and delete it when you are done."""
1700
1709
 
1701
1710
    def __init__(self, limbo_dir):
1702
 
       BzrError.__init__(self)
1703
 
       self.limbo_dir = limbo_dir
 
1711
        BzrError.__init__(self)
 
1712
        self.limbo_dir = limbo_dir
1704
1713
 
1705
1714
 
1706
1715
class ExistingPendingDeletion(BzrError):
1710
1719
    wish to keep, and delete it when you are done."""
1711
1720
 
1712
1721
    def __init__(self, pending_deletion):
1713
 
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1722
        BzrError.__init__(self, pending_deletion=pending_deletion)
1714
1723
 
1715
1724
 
1716
1725
class ImmortalLimbo(BzrError):
1720
1729
    keep, and delete it when you are done."""
1721
1730
 
1722
1731
    def __init__(self, limbo_dir):
1723
 
       BzrError.__init__(self)
1724
 
       self.limbo_dir = limbo_dir
 
1732
        BzrError.__init__(self)
 
1733
        self.limbo_dir = limbo_dir
1725
1734
 
1726
1735
 
1727
1736
class ImmortalPendingDeletion(BzrError):
1728
1737
 
1729
1738
    _fmt = ("Unable to delete transform temporary directory "
1730
 
    "%(pending_deletion)s.  Please examine %(pending_deletion)s to see if it "
1731
 
    "contains any files you wish to keep, and delete it when you are done.")
 
1739
            "%(pending_deletion)s.  Please examine %(pending_deletion)s to see if it "
 
1740
            "contains any files you wish to keep, and delete it when you are done.")
1732
1741
 
1733
1742
    def __init__(self, pending_deletion):
1734
 
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1743
        BzrError.__init__(self, pending_deletion=pending_deletion)
1735
1744
 
1736
1745
 
1737
1746
class OutOfDateTree(BzrError):
1823
1832
class RichRootUpgradeRequired(UpgradeRequired):
1824
1833
 
1825
1834
    _fmt = ("To use this feature you must upgrade your branch at %(path)s to"
1826
 
           " a format which supports rich roots.")
 
1835
            " a format which supports rich roots.")
1827
1836
 
1828
1837
 
1829
1838
class LocalRequiresBoundBranch(BzrError):
2041
2050
 
2042
2051
class NotAMergeDirective(BzrError):
2043
2052
    """File starting with %(firstline)r is not a merge directive"""
 
2053
 
2044
2054
    def __init__(self, firstline):
2045
2055
        BzrError.__init__(self, firstline=firstline)
2046
2056
 
2320
2330
    def __init__(self, host, port, orig_error):
2321
2331
        # nb: in python2.4 socket.error doesn't have a useful repr
2322
2332
        BzrError.__init__(self, host=host, port=port,
2323
 
            orig_error=repr(orig_error.args))
 
2333
                          orig_error=repr(orig_error.args))
2324
2334
 
2325
2335
 
2326
2336
class TipChangeRejected(BzrError):
2405
2415
class RecursiveBind(BzrError):
2406
2416
 
2407
2417
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
2408
 
        'Please use `brz unbind` to fix.')
 
2418
            'Please use `brz unbind` to fix.')
2409
2419
 
2410
2420
    def __init__(self, branch_url):
2411
2421
        self.branch_url = branch_url