/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: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
class BzrError(StandardError):
42
42
    """
43
 
    Base class for errors raised by brzlib.
 
43
    Base class for errors raised by breezy.
44
44
 
45
45
    :cvar internal_error: if True this was probably caused by a brz bug and
46
46
        should be displayed with a traceback; if False (or absent) this was
132
132
        """Return format string for this exception or None"""
133
133
        fmt = getattr(self, '_fmt', None)
134
134
        if fmt is not None:
135
 
            from brzlib.i18n import gettext
 
135
            from breezy.i18n import gettext
136
136
            return gettext(unicode(fmt)) # _fmt strings should be ascii
137
137
 
138
138
    def __eq__(self, other):
261
261
    _fmt = 'There is no public branch set for "%(branch_url)s".'
262
262
 
263
263
    def __init__(self, branch):
264
 
        import brzlib.urlutils as urlutils
 
264
        import breezy.urlutils as urlutils
265
265
        public_location = urlutils.unescape_for_display(branch.base, 'ascii')
266
266
        BzrError.__init__(self, branch_url=public_location)
267
267
 
558
558
 
559
559
class UnknownHook(BzrError):
560
560
 
561
 
    _fmt = "The %(type)s hook '%(hook)s' is unknown in this version of brzlib."
 
561
    _fmt = "The %(type)s hook '%(hook)s' is unknown in this version of breezy."
562
562
 
563
563
    def __init__(self, hook_type, hook_name):
564
564
        BzrError.__init__(self)
654
654
    _fmt = 'Not a branch: "%(path)s"%(detail)s.'
655
655
 
656
656
    def __init__(self, path, detail=None, bzrdir=None):
657
 
       import brzlib.urlutils as urlutils
 
657
       import breezy.urlutils as urlutils
658
658
       path = urlutils.unescape_for_display(path, 'ascii')
659
659
       if detail is not None:
660
660
           detail = ': ' + detail
696
696
    _fmt = 'No submit branch available for branch "%(path)s"'
697
697
 
698
698
    def __init__(self, branch):
699
 
       import brzlib.urlutils as urlutils
 
699
       import breezy.urlutils as urlutils
700
700
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
701
701
 
702
702
 
870
870
    _fmt = "Path(s) are not versioned: %(paths_as_string)s"
871
871
 
872
872
    def __init__(self, paths):
873
 
        from brzlib.osutils import quotefn
 
873
        from breezy.osutils import quotefn
874
874
        BzrError.__init__(self)
875
875
        self.paths = paths
876
876
        self.paths_as_string = ' '.join([quotefn(p) for p in paths])
885
885
 
886
886
    def __init__(self, paths, extra=None):
887
887
        # circular import
888
 
        from brzlib.osutils import quotefn
 
888
        from breezy.osutils import quotefn
889
889
        BzrError.__init__(self)
890
890
        self.paths = paths
891
891
        self.paths_as_string = ' '.join([quotefn(p) for p in paths])
1195
1195
           ' branch "%(location)s".')
1196
1196
 
1197
1197
    def __init__(self, location):
1198
 
       import brzlib.urlutils as urlutils
 
1198
       import breezy.urlutils as urlutils
1199
1199
       location = urlutils.unescape_for_display(location, 'ascii')
1200
1200
       BzrError.__init__(self, location=location)
1201
1201
 
1992
1992
        "%(_has_extra)s%(extra)s")
1993
1993
 
1994
1994
    def __init__(self, from_path='', to_path='', extra=None):
1995
 
        from brzlib.osutils import splitpath
 
1995
        from breezy.osutils import splitpath
1996
1996
        BzrError.__init__(self)
1997
1997
        if extra:
1998
1998
            self.extra, self._has_extra = extra, ': '
2116
2116
 
2117
2117
 
2118
2118
class ExistingContent(BzrError):
2119
 
    # Added in brzlib 0.92, used by VersionedFile.add_lines.
 
2119
    # Added in breezy 0.92, used by VersionedFile.add_lines.
2120
2120
 
2121
2121
    _fmt = "The content being inserted is already present."
2122
2122
 
2183
2183
        '"%(revstring)s".'
2184
2184
 
2185
2185
    def __init__(self, public_location, revstring):
2186
 
        import brzlib.urlutils as urlutils
 
2186
        import breezy.urlutils as urlutils
2187
2187
        public_location = urlutils.unescape_for_display(public_location,
2188
2188
                                                        'ascii')
2189
2189
        BzrError.__init__(self, public_location=public_location,
2663
2663
 
2664
2664
 
2665
2665
class UnknownErrorFromSmartServer(BzrError):
2666
 
    """An ErrorFromSmartServer could not be translated into a typical brzlib
 
2666
    """An ErrorFromSmartServer could not be translated into a typical breezy
2667
2667
    error.
2668
2668
 
2669
2669
    This is distinct from ErrorFromSmartServer so that it is possible to
2796
2796
class BzrDirError(BzrError):
2797
2797
 
2798
2798
    def __init__(self, bzrdir):
2799
 
        import brzlib.urlutils as urlutils
 
2799
        import breezy.urlutils as urlutils
2800
2800
        display_url = urlutils.unescape_for_display(bzrdir.user_url,
2801
2801
                                                    'ascii')
2802
2802
        BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2809
2809
 
2810
2810
    def __init__(self, bzrdir, target_branch):
2811
2811
        BzrDirError.__init__(self, bzrdir)
2812
 
        import brzlib.urlutils as urlutils
 
2812
        import breezy.urlutils as urlutils
2813
2813
        self.target_url = urlutils.unescape_for_display(target_branch.base,
2814
2814
                                                        'ascii')
2815
2815
 
2876
2876
            more = ''
2877
2877
        else:
2878
2878
            more = ' ' + more
2879
 
        import brzlib.urlutils as urlutils
 
2879
        import breezy.urlutils as urlutils
2880
2880
        user_url = getattr(tree, "user_url", None)
2881
2881
        if user_url is None:
2882
2882
            display_url = str(tree)
2891
2891
            ' changes.')
2892
2892
 
2893
2893
    def __init__(self, branch):
2894
 
        import brzlib.urlutils as urlutils
 
2894
        import breezy.urlutils as urlutils
2895
2895
        user_url = getattr(branch, "user_url", None)
2896
2896
        if user_url is None:
2897
2897
            display_url = str(branch)
2974
2974
            'user encoding %(user_encoding)s')
2975
2975
 
2976
2976
    def __init__(self, path, kind):
2977
 
        from brzlib.osutils import get_user_encoding
 
2977
        from breezy.osutils import get_user_encoding
2978
2978
        self.path = path
2979
2979
        self.kind = kind
2980
2980
        self.user_encoding = get_user_encoding()