/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-05-06 03:06:18 UTC
  • mfrom: (7500.1.2 trunk-merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200506030618-131sjbc876q7on66
Merge the 3.1 branch.

Merged from https://code.launchpad.net/~jelmer/brz/trunk-merge-3.1/+merge/383481

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Exceptions for bzr, and reporting of them.
18
18
"""
19
19
 
20
 
from __future__ import absolute_import
21
 
 
22
 
from .sixish import (
23
 
    PY3,
24
 
    )
25
20
 
26
21
# TODO: is there any value in providing the .args field used by standard
27
22
# python exceptions?   A list of values with no names seems less useful
108
103
               getattr(self, '_fmt', None),
109
104
               err)
110
105
 
111
 
    if PY3:
112
 
        __str__ = _format
113
 
    else:
114
 
        def __str__(self):
115
 
            return self._format().encode('utf-8')
116
 
 
117
 
        __unicode__ = _format
 
106
    __str__ = _format
118
107
 
119
108
    def __repr__(self):
120
109
        return '%s(%s)' % (self.__class__.__name__, str(self))
182
171
        self.transport = transport
183
172
 
184
173
 
185
 
class InvalidEntryName(InternalBzrError):
186
 
 
187
 
    _fmt = "Invalid entry name: %(name)s"
188
 
 
189
 
    def __init__(self, name):
190
 
        BzrError.__init__(self)
191
 
        self.name = name
192
 
 
193
 
 
194
174
class InvalidRevisionNumber(BzrError):
195
175
 
196
176
    _fmt = "Invalid revision number %(revno)s"
976
956
        self.revision_id = revision_id
977
957
 
978
958
 
979
 
class InvalidRevisionSpec(BzrError):
980
 
 
981
 
    _fmt = ("Requested revision: '%(spec)s' does not exist in branch:"
982
 
            " %(branch_url)s%(extra)s")
983
 
 
984
 
    def __init__(self, spec, branch, extra=None):
985
 
        BzrError.__init__(self, branch=branch, spec=spec)
986
 
        self.branch_url = getattr(branch, 'user_url', str(branch))
987
 
        if extra:
988
 
            self.extra = '\n' + str(extra)
989
 
        else:
990
 
            self.extra = ''
991
 
 
992
 
 
993
959
class AppendRevisionsOnlyViolation(BzrError):
994
960
 
995
961
    _fmt = ('Operation denied because it would change the main history,'