/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-06-02 02:35:46 UTC
  • mfrom: (7309 work)
  • mto: This revision was merged to the branch mainline in revision 7319.
  • Revision ID: jelmer@jelmer.uk-20190602023546-lqco868tnv26d8ow
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
632
633
    """
633
634
 
634
635
    _fmt = "%(target)s\n" \
635
 
            "is not compatible with\n" \
636
 
            "%(source)s\n" \
637
 
            "%(details)s"
 
636
        "is not compatible with\n" \
 
637
        "%(source)s\n" \
 
638
        "%(details)s"
638
639
 
639
640
    def __init__(self, source, target, details=None):
640
641
        if details is None:
985
986
class AppendRevisionsOnlyViolation(BzrError):
986
987
 
987
988
    _fmt = ('Operation denied because it would change the main history,'
988
 
           ' which is not permitted by the append_revisions_only setting on'
989
 
           ' branch "%(location)s".')
 
989
            ' which is not permitted by the append_revisions_only setting on'
 
990
            ' branch "%(location)s".')
990
991
 
991
992
    def __init__(self, location):
992
 
       import breezy.urlutils as urlutils
993
 
       location = urlutils.unescape_for_display(location, 'ascii')
994
 
       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)
995
996
 
996
997
 
997
998
class DivergedBranches(BzrError):
1037
1038
class NoCommonRoot(BzrError):
1038
1039
 
1039
1040
    _fmt = ("Revisions are not derived from the same root: "
1040
 
           "%(revision_a)s %(revision_b)s.")
 
1041
            "%(revision_a)s %(revision_b)s.")
1041
1042
 
1042
1043
    def __init__(self, revision_a, revision_b):
1043
1044
        BzrError.__init__(self, revision_a=revision_a, revision_b=revision_b)
1049
1050
 
1050
1051
    def __init__(self, rev_id, not_ancestor_id):
1051
1052
        BzrError.__init__(self, rev_id=rev_id,
1052
 
            not_ancestor_id=not_ancestor_id)
 
1053
                          not_ancestor_id=not_ancestor_id)
1053
1054
 
1054
1055
 
1055
1056
class NoCommits(BranchError):
1063
1064
        BzrError.__init__(self, "Store %s is not listable" % store)
1064
1065
 
1065
1066
 
1066
 
 
1067
1067
class UnlistableBranch(BzrError):
1068
1068
 
1069
1069
    def __init__(self, br):
1211
1211
        if orig_error is None:
1212
1212
            orig_error = ''
1213
1213
        if msg is None:
1214
 
            msg =  ''
 
1214
            msg = ''
1215
1215
        self.msg = msg
1216
1216
        self.orig_error = orig_error
1217
1217
        BzrError.__init__(self)
1262
1262
        self.exc_type, self.exc_value, self.exc_tb = exc_info
1263
1263
        self.exc_info = exc_info
1264
1264
        traceback_strings = traceback.format_exception(
1265
 
                self.exc_type, self.exc_value, self.exc_tb)
 
1265
            self.exc_type, self.exc_value, self.exc_tb)
1266
1266
        self.traceback_text = ''.join(traceback_strings)
1267
1267
 
1268
1268
 
1569
1569
class BzrMoveFailedError(BzrError):
1570
1570
 
1571
1571
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1572
 
        "%(_has_extra)s%(extra)s")
 
1572
            "%(_has_extra)s%(extra)s")
1573
1573
 
1574
1574
    def __init__(self, from_path='', to_path='', extra=None):
1575
1575
        from breezy.osutils import splitpath
1605
1605
class BzrRenameFailedError(BzrMoveFailedError):
1606
1606
 
1607
1607
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
1608
 
        "%(_has_extra)s%(extra)s")
 
1608
            "%(_has_extra)s%(extra)s")
1609
1609
 
1610
1610
    def __init__(self, from_path, to_path, extra=None):
1611
1611
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1657
1657
class BadConversionTarget(BzrError):
1658
1658
 
1659
1659
    _fmt = "Cannot convert from format %(from_format)s to format %(format)s." \
1660
 
            "    %(problem)s"
 
1660
        "    %(problem)s"
1661
1661
 
1662
1662
    def __init__(self, problem, format, from_format=None):
1663
1663
        BzrError.__init__(self)
1708
1708
    keep, and delete it when you are done."""
1709
1709
 
1710
1710
    def __init__(self, limbo_dir):
1711
 
       BzrError.__init__(self)
1712
 
       self.limbo_dir = limbo_dir
 
1711
        BzrError.__init__(self)
 
1712
        self.limbo_dir = limbo_dir
1713
1713
 
1714
1714
 
1715
1715
class ExistingPendingDeletion(BzrError):
1719
1719
    wish to keep, and delete it when you are done."""
1720
1720
 
1721
1721
    def __init__(self, pending_deletion):
1722
 
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1722
        BzrError.__init__(self, pending_deletion=pending_deletion)
1723
1723
 
1724
1724
 
1725
1725
class ImmortalLimbo(BzrError):
1729
1729
    keep, and delete it when you are done."""
1730
1730
 
1731
1731
    def __init__(self, limbo_dir):
1732
 
       BzrError.__init__(self)
1733
 
       self.limbo_dir = limbo_dir
 
1732
        BzrError.__init__(self)
 
1733
        self.limbo_dir = limbo_dir
1734
1734
 
1735
1735
 
1736
1736
class ImmortalPendingDeletion(BzrError):
1737
1737
 
1738
1738
    _fmt = ("Unable to delete transform temporary directory "
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.")
 
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.")
1741
1741
 
1742
1742
    def __init__(self, pending_deletion):
1743
 
       BzrError.__init__(self, pending_deletion=pending_deletion)
 
1743
        BzrError.__init__(self, pending_deletion=pending_deletion)
1744
1744
 
1745
1745
 
1746
1746
class OutOfDateTree(BzrError):
1832
1832
class RichRootUpgradeRequired(UpgradeRequired):
1833
1833
 
1834
1834
    _fmt = ("To use this feature you must upgrade your branch at %(path)s to"
1835
 
           " a format which supports rich roots.")
 
1835
            " a format which supports rich roots.")
1836
1836
 
1837
1837
 
1838
1838
class LocalRequiresBoundBranch(BzrError):
2050
2050
 
2051
2051
class NotAMergeDirective(BzrError):
2052
2052
    """File starting with %(firstline)r is not a merge directive"""
 
2053
 
2053
2054
    def __init__(self, firstline):
2054
2055
        BzrError.__init__(self, firstline=firstline)
2055
2056
 
2344
2345
    def __init__(self, host, port, orig_error):
2345
2346
        # nb: in python2.4 socket.error doesn't have a useful repr
2346
2347
        BzrError.__init__(self, host=host, port=port,
2347
 
            orig_error=repr(orig_error.args))
 
2348
                          orig_error=repr(orig_error.args))
2348
2349
 
2349
2350
 
2350
2351
class TipChangeRejected(BzrError):
2429
2430
class RecursiveBind(BzrError):
2430
2431
 
2431
2432
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
2432
 
        'Please use `brz unbind` to fix.')
 
2433
            'Please use `brz unbind` to fix.')
2433
2434
 
2434
2435
    def __init__(self, branch_url):
2435
2436
        self.branch_url = branch_url