87
82
for key, value in kwds.items():
88
83
setattr(self, key, value)
91
86
s = getattr(self, '_preformatted_string', None)
93
# contains a preformatted message; must be cast to plain str
88
# contains a preformatted message
96
91
fmt = self._get_format_string()
98
s = fmt % self.__dict__
93
d = dict(self.__dict__)
99
95
# __str__() should always return a 'str' object
100
96
# never a 'unicode' object.
101
if isinstance(s, unicode):
102
return s.encode('utf8')
104
except (AttributeError, TypeError, NameError, ValueError, KeyError), e:
105
return 'Unprintable exception %s: dict=%r, fmt=%r, error=%s' \
106
% (self.__class__.__name__,
108
getattr(self, '_fmt', None),
99
pass # just bind to 'e' for formatting below
102
return 'Unprintable exception %s: dict=%r, fmt=%r, error=%r' \
103
% (self.__class__.__name__,
105
getattr(self, '_fmt', None),
108
def __unicode__(self):
110
if isinstance(u, str):
111
# Try decoding the str using the default encoding.
113
elif not isinstance(u, unicode):
114
# Try to make a unicode object from it, because __unicode__ must
115
# return a unicode object.
121
if isinstance(s, unicode):
124
# __str__ must return a str.
129
return '%s(%s)' % (self.__class__.__name__, str(self))
111
131
def _get_format_string(self):
112
132
"""Return format string for this exception or None"""
113
133
fmt = getattr(self, '_fmt', None)
114
134
if fmt is not None:
116
fmt = getattr(self, '__doc__', None)
118
symbol_versioning.warn("%s uses its docstring as a format, "
119
"it should use _fmt instead" % self.__class__.__name__,
122
return 'Unprintable exception %s: dict=%r, fmt=%r' \
123
% (self.__class__.__name__,
125
getattr(self, '_fmt', None),
129
class BzrNewError(BzrError):
130
"""Deprecated error base class."""
131
# base classes should override the docstring with their human-
132
# readable explanation
134
def __init__(self, *args, **kwds):
135
# XXX: Use the underlying BzrError to always generate the args attribute
136
# if it doesn't exist. We can't use super here, because exceptions are
137
# old-style classes in python2.4 (but new in 2.5). --bmc, 20060426
138
symbol_versioning.warn('BzrNewError was deprecated in bzr 0.13; '
139
'please convert %s to use BzrError instead'
140
% self.__class__.__name__,
143
BzrError.__init__(self, *args)
144
for key, value in kwds.items():
145
setattr(self, key, value)
149
# __str__() should always return a 'str' object
150
# never a 'unicode' object.
151
s = self.__doc__ % self.__dict__
152
if isinstance(s, unicode):
153
return s.encode('utf8')
155
except (TypeError, NameError, ValueError, KeyError), e:
156
return 'Unprintable exception %s(%r): %s' \
157
% (self.__class__.__name__,
158
self.__dict__, str(e))
135
from bzrlib.i18n import gettext
136
return gettext(unicode(fmt)) # _fmt strings should be ascii
138
def __eq__(self, other):
139
if self.__class__ is not other.__class__:
140
return NotImplemented
141
return self.__dict__ == other.__dict__
144
class InternalBzrError(BzrError):
145
"""Base class for errors that are internal in nature.
147
This is a convenience class for errors that are internal. The
148
internal_error attribute can still be altered in subclasses, if needed.
149
Using this class is simply an easy way to get internal errors.
152
internal_error = True
161
155
class AlreadyBuilding(BzrError):
163
157
_fmt = "The tree builder is already building a tree."
166
class BzrCheckError(BzrError):
168
_fmt = "Internal check failed: %(message)s"
170
internal_error = True
172
def __init__(self, message):
173
BzrError.__init__(self)
174
self.message = message
177
class InvalidEntryName(BzrError):
160
class BranchError(BzrError):
161
"""Base class for concrete 'errors about a branch'."""
163
def __init__(self, branch):
164
BzrError.__init__(self, branch=branch)
167
class BzrCheckError(InternalBzrError):
169
_fmt = "Internal check failed: %(msg)s"
171
def __init__(self, msg):
172
BzrError.__init__(self)
176
class DirstateCorrupt(BzrError):
178
_fmt = "The dirstate file (%(state)s) appears to be corrupt: %(msg)s"
180
def __init__(self, state, msg):
181
BzrError.__init__(self)
186
class DisabledMethod(InternalBzrError):
188
_fmt = "The smart server method '%(class_name)s' is disabled."
190
def __init__(self, class_name):
191
BzrError.__init__(self)
192
self.class_name = class_name
195
class IncompatibleAPI(BzrError):
197
_fmt = 'The API for "%(api)s" is not compatible with "%(wanted)s". '\
198
'It supports versions "%(minimum)s" to "%(current)s".'
200
def __init__(self, api, wanted, minimum, current):
203
self.minimum = minimum
204
self.current = current
207
class InProcessTransport(BzrError):
209
_fmt = "The transport '%(transport)s' is only accessible within this " \
212
def __init__(self, transport):
213
self.transport = transport
216
class InvalidEntryName(InternalBzrError):
179
218
_fmt = "Invalid entry name: %(name)s"
181
internal_error = True
183
220
def __init__(self, name):
184
221
BzrError.__init__(self)
188
225
class InvalidRevisionNumber(BzrError):
190
227
_fmt = "Invalid revision number %(revno)s"
192
229
def __init__(self, revno):
1771
2454
self.extra = ''
1774
class InvalidImportLine(BzrError):
2457
class InvalidImportLine(InternalBzrError):
1776
2459
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
1778
internal_error = True
1780
2461
def __init__(self, text, msg):
1781
2462
BzrError.__init__(self)
1782
2463
self.text = text
1786
class ImportNameCollision(BzrError):
1788
_fmt = "Tried to import an object to the same name as an existing object. %(name)s"
1790
internal_error = True
1792
def __init__(self, name):
1793
BzrError.__init__(self)
2467
class ImportNameCollision(InternalBzrError):
2469
_fmt = ("Tried to import an object to the same name as"
2470
" an existing object. %(name)s")
2472
def __init__(self, name):
2473
BzrError.__init__(self)
2477
class NotAMergeDirective(BzrError):
2478
"""File starting with %(firstline)r is not a merge directive"""
2479
def __init__(self, firstline):
2480
BzrError.__init__(self, firstline=firstline)
2483
class NoMergeSource(BzrError):
2484
"""Raise if no merge source was specified for a merge directive"""
2486
_fmt = "A merge directive must provide either a bundle or a public"\
2490
class IllegalMergeDirectivePayload(BzrError):
2491
"""A merge directive contained something other than a patch or bundle"""
2493
_fmt = "Bad merge directive payload %(start)r"
2495
def __init__(self, start):
2500
class PatchVerificationFailed(BzrError):
2501
"""A patch from a merge directive could not be verified"""
2503
_fmt = "Preview patch does not match requested changes."
2506
class PatchMissing(BzrError):
2507
"""Raise a patch type was specified but no patch supplied"""
2509
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2511
def __init__(self, patch_type):
2512
BzrError.__init__(self)
2513
self.patch_type = patch_type
2516
class TargetNotBranch(BzrError):
2517
"""A merge directive's target branch is required, but isn't a branch"""
2519
_fmt = ("Your branch does not have all of the revisions required in "
2520
"order to merge this merge directive and the target "
2521
"location specified in the merge directive is not a branch: "
2524
def __init__(self, location):
2525
BzrError.__init__(self)
2526
self.location = location
2529
class UnsupportedInventoryKind(BzrError):
2531
_fmt = """Unsupported entry kind %(kind)s"""
2533
def __init__(self, kind):
2537
class BadSubsumeSource(BzrError):
2539
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2541
def __init__(self, tree, other_tree, reason):
2543
self.other_tree = other_tree
2544
self.reason = reason
2547
class SubsumeTargetNeedsUpgrade(BzrError):
2549
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2551
def __init__(self, other_tree):
2552
self.other_tree = other_tree
2555
class BadReferenceTarget(InternalBzrError):
2557
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2560
def __init__(self, tree, other_tree, reason):
2562
self.other_tree = other_tree
2563
self.reason = reason
2566
class NoSuchTag(BzrError):
2568
_fmt = "No such tag: %(tag_name)s"
2570
def __init__(self, tag_name):
2571
self.tag_name = tag_name
2574
class TagsNotSupported(BzrError):
2576
_fmt = ("Tags not supported by %(branch)s;"
2577
" you may be able to use bzr upgrade.")
2579
def __init__(self, branch):
2580
self.branch = branch
2583
class TagAlreadyExists(BzrError):
2585
_fmt = "Tag %(tag_name)s already exists."
2587
def __init__(self, tag_name):
2588
self.tag_name = tag_name
2591
class MalformedBugIdentifier(BzrError):
2593
_fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2594
'See "bzr help bugs" for more information on this feature.')
2596
def __init__(self, bug_id, reason):
2597
self.bug_id = bug_id
2598
self.reason = reason
2601
class InvalidBugTrackerURL(BzrError):
2603
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2604
"contain {id}: %(url)s")
2606
def __init__(self, abbreviation, url):
2607
self.abbreviation = abbreviation
2611
class UnknownBugTrackerAbbreviation(BzrError):
2613
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2616
def __init__(self, abbreviation, branch):
2617
self.abbreviation = abbreviation
2618
self.branch = branch
2621
class InvalidLineInBugsProperty(BzrError):
2623
_fmt = ("Invalid line in bugs property: '%(line)s'")
2625
def __init__(self, line):
2629
class InvalidBugStatus(BzrError):
2631
_fmt = ("Invalid bug status: '%(status)s'")
2633
def __init__(self, status):
2634
self.status = status
2637
class UnexpectedSmartServerResponse(BzrError):
2639
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2641
def __init__(self, response_tuple):
2642
self.response_tuple = response_tuple
2645
class ErrorFromSmartServer(BzrError):
2646
"""An error was received from a smart server.
2648
:seealso: UnknownErrorFromSmartServer
2651
_fmt = "Error received from smart server: %(error_tuple)r"
2653
internal_error = True
2655
def __init__(self, error_tuple):
2656
self.error_tuple = error_tuple
2658
self.error_verb = error_tuple[0]
2660
self.error_verb = None
2661
self.error_args = error_tuple[1:]
2664
class UnknownErrorFromSmartServer(BzrError):
2665
"""An ErrorFromSmartServer could not be translated into a typical bzrlib
2668
This is distinct from ErrorFromSmartServer so that it is possible to
2669
distinguish between the following two cases:
2671
- ErrorFromSmartServer was uncaught. This is logic error in the client
2672
and so should provoke a traceback to the user.
2673
- ErrorFromSmartServer was caught but its error_tuple could not be
2674
translated. This is probably because the server sent us garbage, and
2675
should not provoke a traceback.
2678
_fmt = "Server sent an unexpected error: %(error_tuple)r"
2680
internal_error = False
2682
def __init__(self, error_from_smart_server):
2685
:param error_from_smart_server: An ErrorFromSmartServer instance.
2687
self.error_from_smart_server = error_from_smart_server
2688
self.error_tuple = error_from_smart_server.error_tuple
2691
class ContainerError(BzrError):
2692
"""Base class of container errors."""
2695
class UnknownContainerFormatError(ContainerError):
2697
_fmt = "Unrecognised container format: %(container_format)r"
2699
def __init__(self, container_format):
2700
self.container_format = container_format
2703
class UnexpectedEndOfContainerError(ContainerError):
2705
_fmt = "Unexpected end of container stream"
2708
class UnknownRecordTypeError(ContainerError):
2710
_fmt = "Unknown record type: %(record_type)r"
2712
def __init__(self, record_type):
2713
self.record_type = record_type
2716
class InvalidRecordError(ContainerError):
2718
_fmt = "Invalid record: %(reason)s"
2720
def __init__(self, reason):
2721
self.reason = reason
2724
class ContainerHasExcessDataError(ContainerError):
2726
_fmt = "Container has data after end marker: %(excess)r"
2728
def __init__(self, excess):
2729
self.excess = excess
2732
class DuplicateRecordNameError(ContainerError):
2734
_fmt = "Container has multiple records with the same name: %(name)s"
2736
def __init__(self, name):
2737
self.name = name.decode("utf-8")
2740
class NoDestinationAddress(InternalBzrError):
2742
_fmt = "Message does not have a destination address."
2745
class RepositoryDataStreamError(BzrError):
2747
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2749
def __init__(self, reason):
2750
self.reason = reason
2753
class SMTPError(BzrError):
2755
_fmt = "SMTP error: %(error)s"
2757
def __init__(self, error):
2761
class NoMessageSupplied(BzrError):
2763
_fmt = "No message supplied."
2766
class NoMailAddressSpecified(BzrError):
2768
_fmt = "No mail-to address (--mail-to) or output (-o) specified."
2771
class MailClientNotFound(BzrError):
2773
_fmt = "Unable to find mail client with the following names:"\
2774
" %(mail_command_list_string)s"
2776
def __init__(self, mail_command_list):
2777
mail_command_list_string = ', '.join(mail_command_list)
2778
BzrError.__init__(self, mail_command_list=mail_command_list,
2779
mail_command_list_string=mail_command_list_string)
2781
class SMTPConnectionRefused(SMTPError):
2783
_fmt = "SMTP connection to %(host)s refused"
2785
def __init__(self, error, host):
2790
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2792
_fmt = "Please specify smtp_server. No server at default %(host)s."
2795
class BzrDirError(BzrError):
2797
def __init__(self, bzrdir):
2798
import bzrlib.urlutils as urlutils
2799
display_url = urlutils.unescape_for_display(bzrdir.user_url,
2801
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2804
class UnsyncedBranches(BzrDirError):
2806
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2807
" bzr help sync-for-reconfigure.")
2809
def __init__(self, bzrdir, target_branch):
2810
BzrDirError.__init__(self, bzrdir)
2811
import bzrlib.urlutils as urlutils
2812
self.target_url = urlutils.unescape_for_display(target_branch.base,
2816
class AlreadyBranch(BzrDirError):
2818
_fmt = "'%(display_url)s' is already a branch."
2821
class AlreadyTree(BzrDirError):
2823
_fmt = "'%(display_url)s' is already a tree."
2826
class AlreadyCheckout(BzrDirError):
2828
_fmt = "'%(display_url)s' is already a checkout."
2831
class AlreadyLightweightCheckout(BzrDirError):
2833
_fmt = "'%(display_url)s' is already a lightweight checkout."
2836
class AlreadyUsingShared(BzrDirError):
2838
_fmt = "'%(display_url)s' is already using a shared repository."
2841
class AlreadyStandalone(BzrDirError):
2843
_fmt = "'%(display_url)s' is already standalone."
2846
class AlreadyWithTrees(BzrDirError):
2848
_fmt = ("Shared repository '%(display_url)s' already creates "
2852
class AlreadyWithNoTrees(BzrDirError):
2854
_fmt = ("Shared repository '%(display_url)s' already doesn't create "
2858
class ReconfigurationNotSupported(BzrDirError):
2860
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2863
class NoBindLocation(BzrDirError):
2865
_fmt = "No location could be found to bind to at %(display_url)s."
2868
class UncommittedChanges(BzrError):
2870
_fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2871
' (See bzr status).%(more)s')
2873
def __init__(self, tree, more=None):
2878
import bzrlib.urlutils as urlutils
2879
user_url = getattr(tree, "user_url", None)
2880
if user_url is None:
2881
display_url = str(tree)
2883
display_url = urlutils.unescape_for_display(user_url, 'ascii')
2884
BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2887
class ShelvedChanges(UncommittedChanges):
2889
_fmt = ('Working tree "%(display_url)s" has shelved changes'
2890
' (See bzr shelve --list).%(more)s')
2893
class MissingTemplateVariable(BzrError):
2895
_fmt = 'Variable {%(name)s} is not available.'
2897
def __init__(self, name):
2901
class NoTemplate(BzrError):
2903
_fmt = 'No template specified.'
2906
class UnableCreateSymlink(BzrError):
2908
_fmt = 'Unable to create symlink %(path_str)son this platform'
2910
def __init__(self, path=None):
2914
path_str = repr(str(path))
2915
except UnicodeEncodeError:
2916
path_str = repr(path)
2918
self.path_str = path_str
2921
class UnsupportedTimezoneFormat(BzrError):
2923
_fmt = ('Unsupported timezone format "%(timezone)s", '
2924
'options are "utc", "original", "local".')
2926
def __init__(self, timezone):
2927
self.timezone = timezone
2930
class CommandAvailableInPlugin(StandardError):
2932
internal_error = False
2934
def __init__(self, cmd_name, plugin_metadata, provider):
2936
self.plugin_metadata = plugin_metadata
2937
self.cmd_name = cmd_name
2938
self.provider = provider
2942
_fmt = ('"%s" is not a standard bzr command. \n'
2943
'However, the following official plugin provides this command: %s\n'
2944
'You can install it by going to: %s'
2945
% (self.cmd_name, self.plugin_metadata['name'],
2946
self.plugin_metadata['url']))
2951
class NoPluginAvailable(BzrError):
2955
class UnableEncodePath(BzrError):
2957
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2958
'user encoding %(user_encoding)s')
2960
def __init__(self, path, kind):
2961
from bzrlib.osutils import get_user_encoding
2964
self.user_encoding = get_user_encoding()
2967
class NoSuchConfig(BzrError):
2969
_fmt = ('The "%(config_id)s" configuration does not exist.')
2971
def __init__(self, config_id):
2972
BzrError.__init__(self, config_id=config_id)
2975
class NoSuchConfigOption(BzrError):
2977
_fmt = ('The "%(option_name)s" configuration option does not exist.')
2979
def __init__(self, option_name):
2980
BzrError.__init__(self, option_name=option_name)
2983
class NoSuchAlias(BzrError):
2985
_fmt = ('The alias "%(alias_name)s" does not exist.')
2987
def __init__(self, alias_name):
2988
BzrError.__init__(self, alias_name=alias_name)
2991
class DirectoryLookupFailure(BzrError):
2992
"""Base type for lookup errors."""
2997
class InvalidLocationAlias(DirectoryLookupFailure):
2999
_fmt = '"%(alias_name)s" is not a valid location alias.'
3001
def __init__(self, alias_name):
3002
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
3005
class UnsetLocationAlias(DirectoryLookupFailure):
3007
_fmt = 'No %(alias_name)s location assigned.'
3009
def __init__(self, alias_name):
3010
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
3013
class CannotBindAddress(BzrError):
3015
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
3017
def __init__(self, host, port, orig_error):
3018
# nb: in python2.4 socket.error doesn't have a useful repr
3019
BzrError.__init__(self, host=host, port=port,
3020
orig_error=repr(orig_error.args))
3023
class UnknownRules(BzrError):
3025
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
3027
def __init__(self, unknowns):
3028
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
3031
class TipChangeRejected(BzrError):
3032
"""A pre_change_branch_tip hook function may raise this to cleanly and
3033
explicitly abort a change to a branch tip.
3036
_fmt = u"Tip change rejected: %(msg)s"
3038
def __init__(self, msg):
3042
class ShelfCorrupt(BzrError):
3044
_fmt = "Shelf corrupt."
3047
class DecompressCorruption(BzrError):
3049
_fmt = "Corruption while decompressing repository file%(orig_error)s"
3051
def __init__(self, orig_error=None):
3052
if orig_error is not None:
3053
self.orig_error = ", %s" % (orig_error,)
3055
self.orig_error = ""
3056
BzrError.__init__(self)
3059
class NoSuchShelfId(BzrError):
3061
_fmt = 'No changes are shelved with id "%(shelf_id)d".'
3063
def __init__(self, shelf_id):
3064
BzrError.__init__(self, shelf_id=shelf_id)
3067
class InvalidShelfId(BzrError):
3069
_fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
3071
def __init__(self, invalid_id):
3072
BzrError.__init__(self, invalid_id=invalid_id)
3075
class JailBreak(BzrError):
3077
_fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
3079
def __init__(self, url):
3080
BzrError.__init__(self, url=url)
3083
class UserAbort(BzrError):
3085
_fmt = 'The user aborted the operation.'
3088
class MustHaveWorkingTree(BzrError):
3090
_fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
3092
def __init__(self, format, url):
3093
BzrError.__init__(self, format=format, url=url)
3096
class NoSuchView(BzrError):
3097
"""A view does not exist.
3100
_fmt = u"No such view: %(view_name)s."
3102
def __init__(self, view_name):
3103
self.view_name = view_name
3106
class ViewsNotSupported(BzrError):
3107
"""Views are not supported by a tree format.
3110
_fmt = ("Views are not supported by %(tree)s;"
3111
" use 'bzr upgrade' to change your tree to a later format.")
3113
def __init__(self, tree):
3117
class FileOutsideView(BzrError):
3119
_fmt = ('Specified file "%(file_name)s" is outside the current view: '
3122
def __init__(self, file_name, view_files):
3123
self.file_name = file_name
3124
self.view_str = ", ".join(view_files)
3127
class UnresumableWriteGroup(BzrError):
3129
_fmt = ("Repository %(repository)s cannot resume write group "
3130
"%(write_groups)r: %(reason)s")
3132
internal_error = True
3134
def __init__(self, repository, write_groups, reason):
3135
self.repository = repository
3136
self.write_groups = write_groups
3137
self.reason = reason
3140
class UnsuspendableWriteGroup(BzrError):
3142
_fmt = ("Repository %(repository)s cannot suspend a write group.")
3144
internal_error = True
3146
def __init__(self, repository):
3147
self.repository = repository
3150
class LossyPushToSameVCS(BzrError):
3152
_fmt = ("Lossy push not possible between %(source_branch)r and "
3153
"%(target_branch)r that are in the same VCS.")
3155
internal_error = True
3157
def __init__(self, source_branch, target_branch):
3158
self.source_branch = source_branch
3159
self.target_branch = target_branch
3162
class NoRoundtrippingSupport(BzrError):
3164
_fmt = ("Roundtripping is not supported between %(source_branch)r and "
3165
"%(target_branch)r.")
3167
internal_error = True
3169
def __init__(self, source_branch, target_branch):
3170
self.source_branch = source_branch
3171
self.target_branch = target_branch
3174
class FileTimestampUnavailable(BzrError):
3176
_fmt = "The filestamp for %(path)s is not available."
3178
internal_error = True
3180
def __init__(self, path):
3184
class NoColocatedBranchSupport(BzrError):
3186
_fmt = ("%(bzrdir)r does not support co-located branches.")
3188
def __init__(self, bzrdir):
3189
self.bzrdir = bzrdir
3192
class NoWhoami(BzrError):
3194
_fmt = ('Unable to determine your name.\n'
3195
"Please, set your name with the 'whoami' command.\n"
3196
'E.g. bzr whoami "Your Name <name@example.com>"')
3199
class InvalidPattern(BzrError):
3201
_fmt = ('Invalid pattern(s) found. %(msg)s')
3203
def __init__(self, msg):
3207
class RecursiveBind(BzrError):
3209
_fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
3210
'Please use `bzr unbind` to fix.')
3212
def __init__(self, branch_url):
3213
self.branch_url = branch_url
3216
# FIXME: I would prefer to define the config related exception classes in
3217
# config.py but the lazy import mechanism proscribes this -- vila 20101222
3218
class OptionExpansionLoop(BzrError):
3220
_fmt = 'Loop involving %(refs)r while expanding "%(string)s".'
3222
def __init__(self, string, refs):
3223
self.string = string
3224
self.refs = '->'.join(refs)
3227
class ExpandingUnknownOption(BzrError):
3229
_fmt = 'Option %(name)s is not defined while expanding "%(string)s".'
3231
def __init__(self, name, string):
3233
self.string = string
3236
class NoCompatibleInter(BzrError):
3238
_fmt = ('No compatible object available for operations from %(source)r '
3241
def __init__(self, source, target):
3242
self.source = source
3243
self.target = target
3246
class HpssVfsRequestNotAllowed(BzrError):
3248
_fmt = ("VFS requests over the smart server are not allowed. Encountered: "
3249
"%(method)s, %(arguments)s.")
3251
def __init__(self, method, arguments):
3252
self.method = method
3253
self.arguments = arguments
3256
class UnsupportedKindChange(BzrError):
3258
_fmt = ("Kind change from %(from_kind)s to %(to_kind)s for "
3259
"%(path)s not supported by format %(format)r")
3261
def __init__(self, path, from_kind, to_kind, format):
3263
self.from_kind = from_kind
3264
self.to_kind = to_kind
3265
self.format = format
3268
class MissingFeature(BzrError):
3270
_fmt = ("Missing feature %(feature)s not provided by this "
3271
"version of Bazaar or any plugin.")
3273
def __init__(self, feature):
3274
self.feature = feature
3277
class PatchSyntax(BzrError):
3278
"""Base class for patch syntax errors."""
3281
class BinaryFiles(BzrError):
3283
_fmt = 'Binary files section encountered.'
3285
def __init__(self, orig_name, mod_name):
3286
self.orig_name = orig_name
3287
self.mod_name = mod_name
3290
class MalformedPatchHeader(PatchSyntax):
3292
_fmt = "Malformed patch header. %(desc)s\n%(line)r"
3294
def __init__(self, desc, line):
3299
class MalformedHunkHeader(PatchSyntax):
3301
_fmt = "Malformed hunk header. %(desc)s\n%(line)r"
3303
def __init__(self, desc, line):
3308
class MalformedLine(PatchSyntax):
3310
_fmt = "Malformed line. %(desc)s\n%(line)r"
3312
def __init__(self, desc, line):
3317
class PatchConflict(BzrError):
3319
_fmt = ('Text contents mismatch at line %(line_no)d. Original has '
3320
'"%(orig_line)s", but patch says it should be "%(patch_line)s"')
3322
def __init__(self, line_no, orig_line, patch_line):
3323
self.line_no = line_no
3324
self.orig_line = orig_line.rstrip('\n')
3325
self.patch_line = patch_line.rstrip('\n')
3328
class FeatureAlreadyRegistered(BzrError):
3330
_fmt = 'The feature %(feature)s has already been registered.'
3332
def __init__(self, feature):
3333
self.feature = feature