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):
1791
2463
self.extra = ''
1794
class InvalidImportLine(BzrError):
2466
class InvalidImportLine(InternalBzrError):
1796
2468
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
1798
internal_error = True
1800
2470
def __init__(self, text, msg):
1801
2471
BzrError.__init__(self)
1802
2472
self.text = text
1806
class ImportNameCollision(BzrError):
1808
_fmt = "Tried to import an object to the same name as an existing object. %(name)s"
1810
internal_error = True
1812
def __init__(self, name):
1813
BzrError.__init__(self)
2476
class ImportNameCollision(InternalBzrError):
2478
_fmt = ("Tried to import an object to the same name as"
2479
" an existing object. %(name)s")
2481
def __init__(self, name):
2482
BzrError.__init__(self)
2486
class NotAMergeDirective(BzrError):
2487
"""File starting with %(firstline)r is not a merge directive"""
2488
def __init__(self, firstline):
2489
BzrError.__init__(self, firstline=firstline)
2492
class NoMergeSource(BzrError):
2493
"""Raise if no merge source was specified for a merge directive"""
2495
_fmt = "A merge directive must provide either a bundle or a public"\
2499
class IllegalMergeDirectivePayload(BzrError):
2500
"""A merge directive contained something other than a patch or bundle"""
2502
_fmt = "Bad merge directive payload %(start)r"
2504
def __init__(self, start):
2509
class PatchVerificationFailed(BzrError):
2510
"""A patch from a merge directive could not be verified"""
2512
_fmt = "Preview patch does not match requested changes."
2515
class PatchMissing(BzrError):
2516
"""Raise a patch type was specified but no patch supplied"""
2518
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2520
def __init__(self, patch_type):
2521
BzrError.__init__(self)
2522
self.patch_type = patch_type
2525
class TargetNotBranch(BzrError):
2526
"""A merge directive's target branch is required, but isn't a branch"""
2528
_fmt = ("Your branch does not have all of the revisions required in "
2529
"order to merge this merge directive and the target "
2530
"location specified in the merge directive is not a branch: "
2533
def __init__(self, location):
2534
BzrError.__init__(self)
2535
self.location = location
2538
class UnsupportedInventoryKind(BzrError):
2540
_fmt = """Unsupported entry kind %(kind)s"""
2542
def __init__(self, kind):
2546
class BadSubsumeSource(BzrError):
2548
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2550
def __init__(self, tree, other_tree, reason):
2552
self.other_tree = other_tree
2553
self.reason = reason
2556
class SubsumeTargetNeedsUpgrade(BzrError):
2558
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2560
def __init__(self, other_tree):
2561
self.other_tree = other_tree
2564
class BadReferenceTarget(InternalBzrError):
2566
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2569
def __init__(self, tree, other_tree, reason):
2571
self.other_tree = other_tree
2572
self.reason = reason
2575
class NoSuchTag(BzrError):
2577
_fmt = "No such tag: %(tag_name)s"
2579
def __init__(self, tag_name):
2580
self.tag_name = tag_name
2583
class TagsNotSupported(BzrError):
2585
_fmt = ("Tags not supported by %(branch)s;"
2586
" you may be able to use bzr upgrade.")
2588
def __init__(self, branch):
2589
self.branch = branch
2592
class TagAlreadyExists(BzrError):
2594
_fmt = "Tag %(tag_name)s already exists."
2596
def __init__(self, tag_name):
2597
self.tag_name = tag_name
2600
class MalformedBugIdentifier(BzrError):
2602
_fmt = ('Did not understand bug identifier %(bug_id)s: %(reason)s. '
2603
'See "bzr help bugs" for more information on this feature.')
2605
def __init__(self, bug_id, reason):
2606
self.bug_id = bug_id
2607
self.reason = reason
2610
class InvalidBugTrackerURL(BzrError):
2612
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2613
"contain {id}: %(url)s")
2615
def __init__(self, abbreviation, url):
2616
self.abbreviation = abbreviation
2620
class UnknownBugTrackerAbbreviation(BzrError):
2622
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2625
def __init__(self, abbreviation, branch):
2626
self.abbreviation = abbreviation
2627
self.branch = branch
2630
class InvalidLineInBugsProperty(BzrError):
2632
_fmt = ("Invalid line in bugs property: '%(line)s'")
2634
def __init__(self, line):
2638
class InvalidBugStatus(BzrError):
2640
_fmt = ("Invalid bug status: '%(status)s'")
2642
def __init__(self, status):
2643
self.status = status
2646
class UnexpectedSmartServerResponse(BzrError):
2648
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2650
def __init__(self, response_tuple):
2651
self.response_tuple = response_tuple
2654
class ErrorFromSmartServer(BzrError):
2655
"""An error was received from a smart server.
2657
:seealso: UnknownErrorFromSmartServer
2660
_fmt = "Error received from smart server: %(error_tuple)r"
2662
internal_error = True
2664
def __init__(self, error_tuple):
2665
self.error_tuple = error_tuple
2667
self.error_verb = error_tuple[0]
2669
self.error_verb = None
2670
self.error_args = error_tuple[1:]
2673
class UnknownErrorFromSmartServer(BzrError):
2674
"""An ErrorFromSmartServer could not be translated into a typical bzrlib
2677
This is distinct from ErrorFromSmartServer so that it is possible to
2678
distinguish between the following two cases:
2680
- ErrorFromSmartServer was uncaught. This is logic error in the client
2681
and so should provoke a traceback to the user.
2682
- ErrorFromSmartServer was caught but its error_tuple could not be
2683
translated. This is probably because the server sent us garbage, and
2684
should not provoke a traceback.
2687
_fmt = "Server sent an unexpected error: %(error_tuple)r"
2689
internal_error = False
2691
def __init__(self, error_from_smart_server):
2694
:param error_from_smart_server: An ErrorFromSmartServer instance.
2696
self.error_from_smart_server = error_from_smart_server
2697
self.error_tuple = error_from_smart_server.error_tuple
2700
class ContainerError(BzrError):
2701
"""Base class of container errors."""
2704
class UnknownContainerFormatError(ContainerError):
2706
_fmt = "Unrecognised container format: %(container_format)r"
2708
def __init__(self, container_format):
2709
self.container_format = container_format
2712
class UnexpectedEndOfContainerError(ContainerError):
2714
_fmt = "Unexpected end of container stream"
2717
class UnknownRecordTypeError(ContainerError):
2719
_fmt = "Unknown record type: %(record_type)r"
2721
def __init__(self, record_type):
2722
self.record_type = record_type
2725
class InvalidRecordError(ContainerError):
2727
_fmt = "Invalid record: %(reason)s"
2729
def __init__(self, reason):
2730
self.reason = reason
2733
class ContainerHasExcessDataError(ContainerError):
2735
_fmt = "Container has data after end marker: %(excess)r"
2737
def __init__(self, excess):
2738
self.excess = excess
2741
class DuplicateRecordNameError(ContainerError):
2743
_fmt = "Container has multiple records with the same name: %(name)s"
2745
def __init__(self, name):
2746
self.name = name.decode("utf-8")
2749
class NoDestinationAddress(InternalBzrError):
2751
_fmt = "Message does not have a destination address."
2754
class RepositoryDataStreamError(BzrError):
2756
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2758
def __init__(self, reason):
2759
self.reason = reason
2762
class SMTPError(BzrError):
2764
_fmt = "SMTP error: %(error)s"
2766
def __init__(self, error):
2770
class NoMessageSupplied(BzrError):
2772
_fmt = "No message supplied."
2775
class NoMailAddressSpecified(BzrError):
2777
_fmt = "No mail-to address (--mail-to) or output (-o) specified."
2780
class MailClientNotFound(BzrError):
2782
_fmt = "Unable to find mail client with the following names:"\
2783
" %(mail_command_list_string)s"
2785
def __init__(self, mail_command_list):
2786
mail_command_list_string = ', '.join(mail_command_list)
2787
BzrError.__init__(self, mail_command_list=mail_command_list,
2788
mail_command_list_string=mail_command_list_string)
2790
class SMTPConnectionRefused(SMTPError):
2792
_fmt = "SMTP connection to %(host)s refused"
2794
def __init__(self, error, host):
2799
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2801
_fmt = "Please specify smtp_server. No server at default %(host)s."
2804
class BzrDirError(BzrError):
2806
def __init__(self, bzrdir):
2807
import bzrlib.urlutils as urlutils
2808
display_url = urlutils.unescape_for_display(bzrdir.user_url,
2810
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2813
class UnsyncedBranches(BzrDirError):
2815
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2816
" bzr help sync-for-reconfigure.")
2818
def __init__(self, bzrdir, target_branch):
2819
BzrDirError.__init__(self, bzrdir)
2820
import bzrlib.urlutils as urlutils
2821
self.target_url = urlutils.unescape_for_display(target_branch.base,
2825
class AlreadyBranch(BzrDirError):
2827
_fmt = "'%(display_url)s' is already a branch."
2830
class AlreadyTree(BzrDirError):
2832
_fmt = "'%(display_url)s' is already a tree."
2835
class AlreadyCheckout(BzrDirError):
2837
_fmt = "'%(display_url)s' is already a checkout."
2840
class AlreadyLightweightCheckout(BzrDirError):
2842
_fmt = "'%(display_url)s' is already a lightweight checkout."
2845
class AlreadyUsingShared(BzrDirError):
2847
_fmt = "'%(display_url)s' is already using a shared repository."
2850
class AlreadyStandalone(BzrDirError):
2852
_fmt = "'%(display_url)s' is already standalone."
2855
class AlreadyWithTrees(BzrDirError):
2857
_fmt = ("Shared repository '%(display_url)s' already creates "
2861
class AlreadyWithNoTrees(BzrDirError):
2863
_fmt = ("Shared repository '%(display_url)s' already doesn't create "
2867
class ReconfigurationNotSupported(BzrDirError):
2869
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2872
class NoBindLocation(BzrDirError):
2874
_fmt = "No location could be found to bind to at %(display_url)s."
2877
class UncommittedChanges(BzrError):
2879
_fmt = ('Working tree "%(display_url)s" has uncommitted changes'
2880
' (See bzr status).%(more)s')
2882
def __init__(self, tree, more=None):
2887
import bzrlib.urlutils as urlutils
2888
user_url = getattr(tree, "user_url", None)
2889
if user_url is None:
2890
display_url = str(tree)
2892
display_url = urlutils.unescape_for_display(user_url, 'ascii')
2893
BzrError.__init__(self, tree=tree, display_url=display_url, more=more)
2896
class ShelvedChanges(UncommittedChanges):
2898
_fmt = ('Working tree "%(display_url)s" has shelved changes'
2899
' (See bzr shelve --list).%(more)s')
2902
class MissingTemplateVariable(BzrError):
2904
_fmt = 'Variable {%(name)s} is not available.'
2906
def __init__(self, name):
2910
class NoTemplate(BzrError):
2912
_fmt = 'No template specified.'
2915
class UnableCreateSymlink(BzrError):
2917
_fmt = 'Unable to create symlink %(path_str)son this platform'
2919
def __init__(self, path=None):
2923
path_str = repr(str(path))
2924
except UnicodeEncodeError:
2925
path_str = repr(path)
2927
self.path_str = path_str
2930
class UnsupportedTimezoneFormat(BzrError):
2932
_fmt = ('Unsupported timezone format "%(timezone)s", '
2933
'options are "utc", "original", "local".')
2935
def __init__(self, timezone):
2936
self.timezone = timezone
2939
class CommandAvailableInPlugin(StandardError):
2941
internal_error = False
2943
def __init__(self, cmd_name, plugin_metadata, provider):
2945
self.plugin_metadata = plugin_metadata
2946
self.cmd_name = cmd_name
2947
self.provider = provider
2951
_fmt = ('"%s" is not a standard bzr command. \n'
2952
'However, the following official plugin provides this command: %s\n'
2953
'You can install it by going to: %s'
2954
% (self.cmd_name, self.plugin_metadata['name'],
2955
self.plugin_metadata['url']))
2960
class NoPluginAvailable(BzrError):
2964
class UnableEncodePath(BzrError):
2966
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2967
'user encoding %(user_encoding)s')
2969
def __init__(self, path, kind):
2970
from bzrlib.osutils import get_user_encoding
2973
self.user_encoding = get_user_encoding()
2976
class NoSuchConfig(BzrError):
2978
_fmt = ('The "%(config_id)s" configuration does not exist.')
2980
def __init__(self, config_id):
2981
BzrError.__init__(self, config_id=config_id)
2984
class NoSuchConfigOption(BzrError):
2986
_fmt = ('The "%(option_name)s" configuration option does not exist.')
2988
def __init__(self, option_name):
2989
BzrError.__init__(self, option_name=option_name)
2992
class NoSuchAlias(BzrError):
2994
_fmt = ('The alias "%(alias_name)s" does not exist.')
2996
def __init__(self, alias_name):
2997
BzrError.__init__(self, alias_name=alias_name)
3000
class DirectoryLookupFailure(BzrError):
3001
"""Base type for lookup errors."""
3006
class InvalidLocationAlias(DirectoryLookupFailure):
3008
_fmt = '"%(alias_name)s" is not a valid location alias.'
3010
def __init__(self, alias_name):
3011
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
3014
class UnsetLocationAlias(DirectoryLookupFailure):
3016
_fmt = 'No %(alias_name)s location assigned.'
3018
def __init__(self, alias_name):
3019
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
3022
class CannotBindAddress(BzrError):
3024
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
3026
def __init__(self, host, port, orig_error):
3027
# nb: in python2.4 socket.error doesn't have a useful repr
3028
BzrError.__init__(self, host=host, port=port,
3029
orig_error=repr(orig_error.args))
3032
class UnknownRules(BzrError):
3034
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
3036
def __init__(self, unknowns):
3037
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
3040
class TipChangeRejected(BzrError):
3041
"""A pre_change_branch_tip hook function may raise this to cleanly and
3042
explicitly abort a change to a branch tip.
3045
_fmt = u"Tip change rejected: %(msg)s"
3047
def __init__(self, msg):
3051
class ShelfCorrupt(BzrError):
3053
_fmt = "Shelf corrupt."
3056
class DecompressCorruption(BzrError):
3058
_fmt = "Corruption while decompressing repository file%(orig_error)s"
3060
def __init__(self, orig_error=None):
3061
if orig_error is not None:
3062
self.orig_error = ", %s" % (orig_error,)
3064
self.orig_error = ""
3065
BzrError.__init__(self)
3068
class NoSuchShelfId(BzrError):
3070
_fmt = 'No changes are shelved with id "%(shelf_id)d".'
3072
def __init__(self, shelf_id):
3073
BzrError.__init__(self, shelf_id=shelf_id)
3076
class InvalidShelfId(BzrError):
3078
_fmt = '"%(invalid_id)s" is not a valid shelf id, try a number instead.'
3080
def __init__(self, invalid_id):
3081
BzrError.__init__(self, invalid_id=invalid_id)
3084
class JailBreak(BzrError):
3086
_fmt = "An attempt to access a url outside the server jail was made: '%(url)s'."
3088
def __init__(self, url):
3089
BzrError.__init__(self, url=url)
3092
class UserAbort(BzrError):
3094
_fmt = 'The user aborted the operation.'
3097
class MustHaveWorkingTree(BzrError):
3099
_fmt = ("Branching '%(url)s'(%(format)s) must create a working tree.")
3101
def __init__(self, format, url):
3102
BzrError.__init__(self, format=format, url=url)
3105
class NoSuchView(BzrError):
3106
"""A view does not exist.
3109
_fmt = u"No such view: %(view_name)s."
3111
def __init__(self, view_name):
3112
self.view_name = view_name
3115
class ViewsNotSupported(BzrError):
3116
"""Views are not supported by a tree format.
3119
_fmt = ("Views are not supported by %(tree)s;"
3120
" use 'bzr upgrade' to change your tree to a later format.")
3122
def __init__(self, tree):
3126
class FileOutsideView(BzrError):
3128
_fmt = ('Specified file "%(file_name)s" is outside the current view: '
3131
def __init__(self, file_name, view_files):
3132
self.file_name = file_name
3133
self.view_str = ", ".join(view_files)
3136
class UnresumableWriteGroup(BzrError):
3138
_fmt = ("Repository %(repository)s cannot resume write group "
3139
"%(write_groups)r: %(reason)s")
3141
internal_error = True
3143
def __init__(self, repository, write_groups, reason):
3144
self.repository = repository
3145
self.write_groups = write_groups
3146
self.reason = reason
3149
class UnsuspendableWriteGroup(BzrError):
3151
_fmt = ("Repository %(repository)s cannot suspend a write group.")
3153
internal_error = True
3155
def __init__(self, repository):
3156
self.repository = repository
3159
class LossyPushToSameVCS(BzrError):
3161
_fmt = ("Lossy push not possible between %(source_branch)r and "
3162
"%(target_branch)r that are in the same VCS.")
3164
internal_error = True
3166
def __init__(self, source_branch, target_branch):
3167
self.source_branch = source_branch
3168
self.target_branch = target_branch
3171
class NoRoundtrippingSupport(BzrError):
3173
_fmt = ("Roundtripping is not supported between %(source_branch)r and "
3174
"%(target_branch)r.")
3176
internal_error = True
3178
def __init__(self, source_branch, target_branch):
3179
self.source_branch = source_branch
3180
self.target_branch = target_branch
3183
class FileTimestampUnavailable(BzrError):
3185
_fmt = "The filestamp for %(path)s is not available."
3187
internal_error = True
3189
def __init__(self, path):
3193
class NoColocatedBranchSupport(BzrError):
3195
_fmt = ("%(bzrdir)r does not support co-located branches.")
3197
def __init__(self, bzrdir):
3198
self.bzrdir = bzrdir
3201
class NoWhoami(BzrError):
3203
_fmt = ('Unable to determine your name.\n'
3204
"Please, set your name with the 'whoami' command.\n"
3205
'E.g. bzr whoami "Your Name <name@example.com>"')
3208
class InvalidPattern(BzrError):
3210
_fmt = ('Invalid pattern(s) found. %(msg)s')
3212
def __init__(self, msg):
3216
class RecursiveBind(BzrError):
3218
_fmt = ('Branch "%(branch_url)s" appears to be bound to itself. '
3219
'Please use `bzr unbind` to fix.')
3221
def __init__(self, branch_url):
3222
self.branch_url = branch_url
3225
# FIXME: I would prefer to define the config related exception classes in
3226
# config.py but the lazy import mechanism proscribes this -- vila 20101222
3227
class OptionExpansionLoop(BzrError):
3229
_fmt = 'Loop involving %(refs)r while expanding "%(string)s".'
3231
def __init__(self, string, refs):
3232
self.string = string
3233
self.refs = '->'.join(refs)
3236
class ExpandingUnknownOption(BzrError):
3238
_fmt = 'Option %(name)s is not defined while expanding "%(string)s".'
3240
def __init__(self, name, string):
3242
self.string = string
3245
class NoCompatibleInter(BzrError):
3247
_fmt = ('No compatible object available for operations from %(source)r '
3250
def __init__(self, source, target):
3251
self.source = source
3252
self.target = target
3255
class HpssVfsRequestNotAllowed(BzrError):
3257
_fmt = ("VFS requests over the smart server are not allowed. Encountered: "
3258
"%(method)s, %(arguments)s.")
3260
def __init__(self, method, arguments):
3261
self.method = method
3262
self.arguments = arguments
3265
class UnsupportedKindChange(BzrError):
3267
_fmt = ("Kind change from %(from_kind)s to %(to_kind)s for "
3268
"%(path)s not supported by format %(format)r")
3270
def __init__(self, path, from_kind, to_kind, format):
3272
self.from_kind = from_kind
3273
self.to_kind = to_kind
3274
self.format = format
3277
class MissingFeature(BzrError):
3279
_fmt = ("Missing feature %(feature)s not provided by this "
3280
"version of Bazaar or any plugin.")
3282
def __init__(self, feature):
3283
self.feature = feature
3286
class PatchSyntax(BzrError):
3287
"""Base class for patch syntax errors."""
3290
class BinaryFiles(BzrError):
3292
_fmt = 'Binary files section encountered.'
3294
def __init__(self, orig_name, mod_name):
3295
self.orig_name = orig_name
3296
self.mod_name = mod_name
3299
class MalformedPatchHeader(PatchSyntax):
3301
_fmt = "Malformed patch header. %(desc)s\n%(line)r"
3303
def __init__(self, desc, line):
3308
class MalformedHunkHeader(PatchSyntax):
3310
_fmt = "Malformed hunk header. %(desc)s\n%(line)r"
3312
def __init__(self, desc, line):
3317
class MalformedLine(PatchSyntax):
3319
_fmt = "Malformed line. %(desc)s\n%(line)r"
3321
def __init__(self, desc, line):
3326
class PatchConflict(BzrError):
3328
_fmt = ('Text contents mismatch at line %(line_no)d. Original has '
3329
'"%(orig_line)s", but patch says it should be "%(patch_line)s"')
3331
def __init__(self, line_no, orig_line, patch_line):
3332
self.line_no = line_no
3333
self.orig_line = orig_line.rstrip('\n')
3334
self.patch_line = patch_line.rstrip('\n')
3337
class FeatureAlreadyRegistered(BzrError):
3339
_fmt = 'The feature %(feature)s has already been registered.'
3341
def __init__(self, feature):
3342
self.feature = feature