/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 19:09:26 UTC
  • mfrom: (6622.1.36 breezy)
  • Revision ID: jelmer@jelmer.uk-20170521190926-5vtz8xaf0e9ylrpc
Merge rename to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
# 'unprintable'.
33
33
 
34
34
 
35
 
# return codes from the bzr program
 
35
# return codes from the brz program
36
36
EXIT_OK = 0
37
37
EXIT_ERROR = 3
38
38
EXIT_INTERNAL_ERROR = 4
40
40
 
41
41
class BzrError(StandardError):
42
42
    """
43
 
    Base class for errors raised by bzrlib.
 
43
    Base class for errors raised by breezy.
44
44
 
45
 
    :cvar internal_error: if True this was probably caused by a bzr bug and
 
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
47
47
        probably a user or environment error and they don't need the gory
48
48
        details.  (That can be overridden by -Derror on the command line.)
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 bzrlib.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 bzrlib.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
 
269
269
class NoHelpTopic(BzrError):
270
270
 
271
271
    _fmt = ("No help could be found for '%(topic)s'. "
272
 
        "Please use 'bzr help topics' to obtain a list of topics.")
 
272
        "Please use 'brz help topics' to obtain a list of topics.")
273
273
 
274
274
    def __init__(self, topic):
275
275
        self.topic = topic
465
465
    """Used when renaming and both source and dest exist."""
466
466
 
467
467
    _fmt = ("Could not rename %(source)s => %(dest)s because both files exist."
468
 
            " (Use --after to tell bzr about a rename that has already"
 
468
            " (Use --after to tell brz about a rename that has already"
469
469
            " happened)%(extra)s")
470
470
 
471
471
    def __init__(self, source, dest, extra=None):
558
558
 
559
559
class UnknownHook(BzrError):
560
560
 
561
 
    _fmt = "The %(type)s hook '%(hook)s' is unknown in this version of bzrlib."
 
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 bzrlib.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 bzrlib.urlutils as urlutils
 
699
       import breezy.urlutils as urlutils
700
700
       self.path = urlutils.unescape_for_display(branch.base, 'ascii')
701
701
 
702
702
 
727
727
class BranchExistsWithoutWorkingTree(PathError):
728
728
 
729
729
    _fmt = 'Directory contains a branch, but no working tree \
730
 
(use bzr checkout if you wish to build a working tree): "%(path)s"'
 
730
(use brz checkout if you wish to build a working tree): "%(path)s"'
731
731
 
732
732
 
733
733
class AtomicFileAlreadyClosed(PathError):
760
760
 
761
761
class UnsupportedFormatError(BzrError):
762
762
 
763
 
    _fmt = "Unsupported branch format: %(format)s\nPlease run 'bzr upgrade'"
 
763
    _fmt = "Unsupported branch format: %(format)s\nPlease run 'brz upgrade'"
764
764
 
765
765
 
766
766
class UnknownFormatError(BzrError):
870
870
    _fmt = "Path(s) are not versioned: %(paths_as_string)s"
871
871
 
872
872
    def __init__(self, paths):
873
 
        from bzrlib.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 bzrlib.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])
1054
1054
class LockCorrupt(LockError):
1055
1055
 
1056
1056
    _fmt = ("Lock is apparently held, but corrupted: %(corruption_info)s\n"
1057
 
            "Use 'bzr break-lock' to clear it")
 
1057
            "Use 'brz break-lock' to clear it")
1058
1058
 
1059
1059
    internal_error = False
1060
1060
 
1195
1195
           ' branch "%(location)s".')
1196
1196
 
1197
1197
    def __init__(self, location):
1198
 
       import bzrlib.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
 
1763
1763
class ConfigOptionValueError(BzrError):
1764
1764
 
1765
1765
    _fmt = ('Bad value "%(value)s" for option "%(name)s".\n'
1766
 
            'See ``bzr help %(name)s``')
 
1766
            'See ``brz help %(name)s``')
1767
1767
 
1768
1768
    def __init__(self, name, value):
1769
1769
        BzrError.__init__(self, name=name, value=value)
1992
1992
        "%(_has_extra)s%(extra)s")
1993
1993
 
1994
1994
    def __init__(self, from_path='', to_path='', extra=None):
1995
 
        from bzrlib.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, ': '
2067
2067
 
2068
2068
class UninitializableFormat(BzrError):
2069
2069
 
2070
 
    _fmt = "Format %(format)s cannot be initialised by this version of bzr."
 
2070
    _fmt = "Format %(format)s cannot be initialised by this version of brz."
2071
2071
 
2072
2072
    def __init__(self, format):
2073
2073
        BzrError.__init__(self)
2116
2116
 
2117
2117
 
2118
2118
class ExistingContent(BzrError):
2119
 
    # Added in bzrlib 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
 
2165
2165
 
2166
2166
class OutOfDateTree(BzrError):
2167
2167
 
2168
 
    _fmt = "Working tree is out of date, please run 'bzr update'.%(more)s"
 
2168
    _fmt = "Working tree is out of date, please run 'brz update'.%(more)s"
2169
2169
 
2170
2170
    def __init__(self, tree, more=None):
2171
2171
        if more is None:
2183
2183
        '"%(revstring)s".'
2184
2184
 
2185
2185
    def __init__(self, public_location, revstring):
2186
 
        import bzrlib.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,
2214
2214
class CorruptRepository(BzrError):
2215
2215
 
2216
2216
    _fmt = ("An error has been detected in the repository %(repo_path)s.\n"
2217
 
            "Please run bzr reconcile on this repository.")
 
2217
            "Please run brz reconcile on this repository.")
2218
2218
 
2219
2219
    def __init__(self, repo):
2220
2220
        BzrError.__init__(self)
2407
2407
 
2408
2408
class UnknownSSH(BzrError):
2409
2409
 
2410
 
    _fmt = "Unrecognised value for BZR_SSH environment variable: %(vendor)s"
 
2410
    _fmt = "Unrecognised value for BRZ_SSH environment variable: %(vendor)s"
2411
2411
 
2412
2412
    def __init__(self, vendor):
2413
2413
        BzrError.__init__(self)
2417
2417
class SSHVendorNotFound(BzrError):
2418
2418
 
2419
2419
    _fmt = ("Don't know how to handle SSH connections."
2420
 
            " Please set BZR_SSH environment variable.")
 
2420
            " Please set BRZ_SSH environment variable.")
2421
2421
 
2422
2422
 
2423
2423
class GhostRevisionsHaveNoRevno(BzrError):
2575
2575
class TagsNotSupported(BzrError):
2576
2576
 
2577
2577
    _fmt = ("Tags not supported by %(branch)s;"
2578
 
            " you may be able to use bzr upgrade.")
 
2578
            " you may be able to use brz upgrade.")
2579
2579
 
2580
2580
    def __init__(self, branch):
2581
2581
        self.branch = branch
2592
2592
class MalformedBugIdentifier(BzrError):
2593
2593
 
2594
2594
    _fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2595
 
            'See "bzr help bugs" for more information on this feature.')
 
2595
            'See "brz help bugs" for more information on this feature.')
2596
2596
 
2597
2597
    def __init__(self, bug_id, reason):
2598
2598
        self.bug_id = bug_id
2663
2663
 
2664
2664
 
2665
2665
class UnknownErrorFromSmartServer(BzrError):
2666
 
    """An ErrorFromSmartServer could not be translated into a typical bzrlib
 
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 bzrlib.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)
2805
2805
class UnsyncedBranches(BzrDirError):
2806
2806
 
2807
2807
    _fmt = ("'%(display_url)s' is not in sync with %(target_url)s.  See"
2808
 
            " bzr help sync-for-reconfigure.")
 
2808
            " brz help sync-for-reconfigure.")
2809
2809
 
2810
2810
    def __init__(self, bzrdir, target_branch):
2811
2811
        BzrDirError.__init__(self, bzrdir)
2812
 
        import bzrlib.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
 
2869
2869
class UncommittedChanges(BzrError):
2870
2870
 
2871
2871
    _fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2872
 
            ' (See bzr status).%(more)s')
 
2872
            ' (See brz status).%(more)s')
2873
2873
 
2874
2874
    def __init__(self, tree, more=None):
2875
2875
        if more is None:
2876
2876
            more = ''
2877
2877
        else:
2878
2878
            more = ' ' + more
2879
 
        import bzrlib.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 bzrlib.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)
2903
2903
class ShelvedChanges(UncommittedChanges):
2904
2904
 
2905
2905
    _fmt = ('Working tree "%(display_url)s" has shelved changes'
2906
 
            ' (See bzr shelve --list).%(more)s')
 
2906
            ' (See brz shelve --list).%(more)s')
2907
2907
 
2908
2908
 
2909
2909
class MissingTemplateVariable(BzrError):
2955
2955
 
2956
2956
    def __str__(self):
2957
2957
 
2958
 
        _fmt = ('"%s" is not a standard bzr command. \n'
 
2958
        _fmt = ('"%s" is not a standard brz command. \n'
2959
2959
                'However, the following official plugin provides this command: %s\n'
2960
2960
                'You can install it by going to: %s'
2961
2961
                % (self.cmd_name, self.plugin_metadata['name'],
2974
2974
            'user encoding %(user_encoding)s')
2975
2975
 
2976
2976
    def __init__(self, path, kind):
2977
 
        from bzrlib.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()
3124
3124
    """
3125
3125
 
3126
3126
    _fmt = ("Views are not supported by %(tree)s;"
3127
 
            " use 'bzr upgrade' to change your tree to a later format.")
 
3127
            " use 'brz upgrade' to change your tree to a later format.")
3128
3128
 
3129
3129
    def __init__(self, tree):
3130
3130
        self.tree = tree
3209
3209
 
3210
3210
    _fmt = ('Unable to determine your name.\n'
3211
3211
        "Please, set your name with the 'whoami' command.\n"
3212
 
        'E.g. bzr whoami "Your Name <name@example.com>"')
 
3212
        'E.g. brz whoami "Your Name <name@example.com>"')
3213
3213
 
3214
3214
 
3215
3215
class InvalidPattern(BzrError):
3223
3223
class RecursiveBind(BzrError):
3224
3224
 
3225
3225
    _fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
3226
 
        'Please use `bzr unbind` to fix.')
 
3226
        'Please use `brz unbind` to fix.')
3227
3227
 
3228
3228
    def __init__(self, branch_url):
3229
3229
        self.branch_url = branch_url