522
357
class NotADirectory(PathError):
524
_fmt = '"%(path)s" is not a directory %(extra)s'
359
_fmt = "%(path)r is not a directory %(extra)s"
527
362
class NotInWorkingDirectory(PathError):
529
_fmt = '"%(path)s" is not in the working directory %(extra)s'
364
_fmt = "%(path)r is not in the working directory %(extra)s"
532
367
class DirectoryNotEmpty(PathError):
534
_fmt = 'Directory not empty: "%(path)s"%(extra)s'
537
class HardLinkNotSupported(PathError):
539
_fmt = 'Hard-linking "%(path)s" is not supported'
542
class ReadingCompleted(InternalBzrError):
369
_fmt = "Directory not empty: %(path)r%(extra)s"
372
class ReadingCompleted(BzrError):
544
374
_fmt = ("The MediumRequest '%(request)s' has already had finish_reading "
545
375
"called upon it - the request has been completed and no more "
546
376
"data may be read.")
378
internal_error = True
548
380
def __init__(self, request):
549
381
self.request = request
552
384
class ResourceBusy(PathError):
554
_fmt = 'Device or resource busy: "%(path)s"%(extra)s'
386
_fmt = "Device or resource busy: %(path)r%(extra)s"
557
389
class PermissionDenied(PathError):
559
_fmt = 'Permission denied: "%(path)s"%(extra)s'
391
_fmt = "Permission denied: %(path)r%(extra)s"
562
394
class InvalidURL(PathError):
564
_fmt = 'Invalid url supplied to transport: "%(path)s"%(extra)s'
396
_fmt = "Invalid url supplied to transport: %(path)r%(extra)s"
567
399
class InvalidURLJoin(PathError):
569
_fmt = "Invalid URL join request: %(reason)s: %(base)r + %(join_args)r"
571
def __init__(self, reason, base, join_args):
574
self.join_args = join_args
575
PathError.__init__(self, base, reason)
578
class InvalidRebaseURLs(PathError):
580
_fmt = "URLs differ by more than path: %(from_)r and %(to)r"
582
def __init__(self, from_, to):
585
PathError.__init__(self, from_, 'URLs differ by more than path.')
588
class UnavailableRepresentation(InternalBzrError):
590
_fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
591
"is encoded as '%(native)s'.")
593
def __init__(self, key, wanted, native):
594
InternalBzrError.__init__(self)
401
_fmt = "Invalid URL join request: %(args)s%(extra)s"
403
def __init__(self, msg, base, args):
404
PathError.__init__(self, base, msg)
405
self.args = [base] + list(args)
600
408
class UnknownHook(BzrError):
2326
1725
self.extra = ''
2329
class InvalidImportLine(InternalBzrError):
1728
class InvalidImportLine(BzrError):
2331
1730
_fmt = "Not a valid import statement: %(msg)\n%(text)s"
1732
internal_error = True
2333
1734
def __init__(self, text, msg):
2334
1735
BzrError.__init__(self)
2335
1736
self.text = text
2339
class ImportNameCollision(InternalBzrError):
2341
_fmt = ("Tried to import an object to the same name as"
2342
" an existing object. %(name)s")
2344
def __init__(self, name):
2345
BzrError.__init__(self)
2349
class NotAMergeDirective(BzrError):
2350
"""File starting with %(firstline)r is not a merge directive"""
2351
def __init__(self, firstline):
2352
BzrError.__init__(self, firstline=firstline)
2355
class NoMergeSource(BzrError):
2356
"""Raise if no merge source was specified for a merge directive"""
2358
_fmt = "A merge directive must provide either a bundle or a public"\
2362
class IllegalMergeDirectivePayload(BzrError):
2363
"""A merge directive contained something other than a patch or bundle"""
2365
_fmt = "Bad merge directive payload %(start)r"
2367
def __init__(self, start):
2372
class PatchVerificationFailed(BzrError):
2373
"""A patch from a merge directive could not be verified"""
2375
_fmt = "Preview patch does not match requested changes."
2378
class PatchMissing(BzrError):
2379
"""Raise a patch type was specified but no patch supplied"""
2381
_fmt = "Patch_type was %(patch_type)s, but no patch was supplied."
2383
def __init__(self, patch_type):
2384
BzrError.__init__(self)
2385
self.patch_type = patch_type
2388
class TargetNotBranch(BzrError):
2389
"""A merge directive's target branch is required, but isn't a branch"""
2391
_fmt = ("Your branch does not have all of the revisions required in "
2392
"order to merge this merge directive and the target "
2393
"location specified in the merge directive is not a branch: "
2396
def __init__(self, location):
2397
BzrError.__init__(self)
2398
self.location = location
2401
class UnsupportedInventoryKind(BzrError):
2403
_fmt = """Unsupported entry kind %(kind)s"""
2405
def __init__(self, kind):
2409
class BadSubsumeSource(BzrError):
2411
_fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s"
2413
def __init__(self, tree, other_tree, reason):
2415
self.other_tree = other_tree
2416
self.reason = reason
2419
class SubsumeTargetNeedsUpgrade(BzrError):
2421
_fmt = """Subsume target %(other_tree)s needs to be upgraded."""
2423
def __init__(self, other_tree):
2424
self.other_tree = other_tree
2427
class BadReferenceTarget(InternalBzrError):
2429
_fmt = "Can't add reference to %(other_tree)s into %(tree)s." \
2432
def __init__(self, tree, other_tree, reason):
2434
self.other_tree = other_tree
2435
self.reason = reason
2438
class NoSuchTag(BzrError):
2440
_fmt = "No such tag: %(tag_name)s"
2442
def __init__(self, tag_name):
2443
self.tag_name = tag_name
2446
class TagsNotSupported(BzrError):
2448
_fmt = ("Tags not supported by %(branch)s;"
2449
" you may be able to use bzr upgrade --dirstate-tags.")
2451
def __init__(self, branch):
2452
self.branch = branch
2455
class TagAlreadyExists(BzrError):
2457
_fmt = "Tag %(tag_name)s already exists."
2459
def __init__(self, tag_name):
2460
self.tag_name = tag_name
2463
class MalformedBugIdentifier(BzrError):
2465
_fmt = "Did not understand bug identifier %(bug_id)s: %(reason)s"
2467
def __init__(self, bug_id, reason):
2468
self.bug_id = bug_id
2469
self.reason = reason
2472
class InvalidBugTrackerURL(BzrError):
2474
_fmt = ("The URL for bug tracker \"%(abbreviation)s\" doesn't "
2475
"contain {id}: %(url)s")
2477
def __init__(self, abbreviation, url):
2478
self.abbreviation = abbreviation
2482
class UnknownBugTrackerAbbreviation(BzrError):
2484
_fmt = ("Cannot find registered bug tracker called %(abbreviation)s "
2487
def __init__(self, abbreviation, branch):
2488
self.abbreviation = abbreviation
2489
self.branch = branch
2492
class UnexpectedSmartServerResponse(BzrError):
2494
_fmt = "Could not understand response from smart server: %(response_tuple)r"
2496
def __init__(self, response_tuple):
2497
self.response_tuple = response_tuple
2500
class ErrorFromSmartServer(BzrError):
2502
_fmt = "Error received from smart server: %(error_tuple)r"
1740
class ImportNameCollision(BzrError):
1742
_fmt = "Tried to import an object to the same name as an existing object. %(name)s"
2504
1744
internal_error = True
2506
def __init__(self, error_tuple):
2507
self.error_tuple = error_tuple
2509
self.error_verb = error_tuple[0]
2511
self.error_verb = None
2512
self.error_args = error_tuple[1:]
2515
class ContainerError(BzrError):
2516
"""Base class of container errors."""
2519
class UnknownContainerFormatError(ContainerError):
2521
_fmt = "Unrecognised container format: %(container_format)r"
2523
def __init__(self, container_format):
2524
self.container_format = container_format
2527
class UnexpectedEndOfContainerError(ContainerError):
2529
_fmt = "Unexpected end of container stream"
2532
class UnknownRecordTypeError(ContainerError):
2534
_fmt = "Unknown record type: %(record_type)r"
2536
def __init__(self, record_type):
2537
self.record_type = record_type
2540
class InvalidRecordError(ContainerError):
2542
_fmt = "Invalid record: %(reason)s"
2544
def __init__(self, reason):
2545
self.reason = reason
2548
class ContainerHasExcessDataError(ContainerError):
2550
_fmt = "Container has data after end marker: %(excess)r"
2552
def __init__(self, excess):
2553
self.excess = excess
2556
class DuplicateRecordNameError(ContainerError):
2558
_fmt = "Container has multiple records with the same name: %(name)s"
2560
def __init__(self, name):
2564
class NoDestinationAddress(InternalBzrError):
2566
_fmt = "Message does not have a destination address."
2569
class RepositoryDataStreamError(BzrError):
2571
_fmt = "Corrupt or incompatible data stream: %(reason)s"
2573
def __init__(self, reason):
2574
self.reason = reason
2577
class SMTPError(BzrError):
2579
_fmt = "SMTP error: %(error)s"
2581
def __init__(self, error):
2585
class NoMessageSupplied(BzrError):
2587
_fmt = "No message supplied."
2590
class NoMailAddressSpecified(BzrError):
2592
_fmt = "No mail-to address specified."
2595
class UnknownMailClient(BzrError):
2597
_fmt = "Unknown mail client: %(mail_client)s"
2599
def __init__(self, mail_client):
2600
BzrError.__init__(self, mail_client=mail_client)
2603
class MailClientNotFound(BzrError):
2605
_fmt = "Unable to find mail client with the following names:"\
2606
" %(mail_command_list_string)s"
2608
def __init__(self, mail_command_list):
2609
mail_command_list_string = ', '.join(mail_command_list)
2610
BzrError.__init__(self, mail_command_list=mail_command_list,
2611
mail_command_list_string=mail_command_list_string)
2613
class SMTPConnectionRefused(SMTPError):
2615
_fmt = "SMTP connection to %(host)s refused"
2617
def __init__(self, error, host):
2622
class DefaultSMTPConnectionRefused(SMTPConnectionRefused):
2624
_fmt = "Please specify smtp_server. No server at default %(host)s."
2627
class BzrDirError(BzrError):
2629
def __init__(self, bzrdir):
2630
import bzrlib.urlutils as urlutils
2631
display_url = urlutils.unescape_for_display(bzrdir.root_transport.base,
2633
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2636
class UnsyncedBranches(BzrDirError):
2638
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2639
" bzr help sync-for-reconfigure.")
2641
def __init__(self, bzrdir, target_branch):
2642
BzrDirError.__init__(self, bzrdir)
2643
import bzrlib.urlutils as urlutils
2644
self.target_url = urlutils.unescape_for_display(target_branch.base,
2648
class AlreadyBranch(BzrDirError):
2650
_fmt = "'%(display_url)s' is already a branch."
2653
class AlreadyTree(BzrDirError):
2655
_fmt = "'%(display_url)s' is already a tree."
2658
class AlreadyCheckout(BzrDirError):
2660
_fmt = "'%(display_url)s' is already a checkout."
2663
class AlreadyLightweightCheckout(BzrDirError):
2665
_fmt = "'%(display_url)s' is already a lightweight checkout."
2668
class AlreadyUsingShared(BzrDirError):
2670
_fmt = "'%(display_url)s' is already using a shared repository."
2673
class AlreadyStandalone(BzrDirError):
2675
_fmt = "'%(display_url)s' is already standalone."
2678
class ReconfigurationNotSupported(BzrDirError):
2680
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2683
class NoBindLocation(BzrDirError):
2685
_fmt = "No location could be found to bind to at %(display_url)s."
2688
class UncommittedChanges(BzrError):
2690
_fmt = 'Working tree "%(display_url)s" has uncommitted changes.'
2692
def __init__(self, tree):
2693
import bzrlib.urlutils as urlutils
2694
display_url = urlutils.unescape_for_display(
2695
tree.bzrdir.root_transport.base, 'ascii')
2696
BzrError.__init__(self, tree=tree, display_url=display_url)
2699
class MissingTemplateVariable(BzrError):
2701
_fmt = 'Variable {%(name)s} is not available.'
2703
def __init__(self, name):
2707
class NoTemplate(BzrError):
2709
_fmt = 'No template specified.'
2712
class UnableCreateSymlink(BzrError):
2714
_fmt = 'Unable to create symlink %(path_str)son this platform'
2716
def __init__(self, path=None):
2720
path_str = repr(str(path))
2721
except UnicodeEncodeError:
2722
path_str = repr(path)
2724
self.path_str = path_str
2727
class UnsupportedTimezoneFormat(BzrError):
2729
_fmt = ('Unsupported timezone format "%(timezone)s", '
2730
'options are "utc", "original", "local".')
2732
def __init__(self, timezone):
2733
self.timezone = timezone
2736
class CommandAvailableInPlugin(StandardError):
2738
internal_error = False
2740
def __init__(self, cmd_name, plugin_metadata, provider):
2742
self.plugin_metadata = plugin_metadata
2743
self.cmd_name = cmd_name
2744
self.provider = provider
2748
_fmt = ('"%s" is not a standard bzr command. \n'
2749
'However, the following official plugin provides this command: %s\n'
2750
'You can install it by going to: %s'
2751
% (self.cmd_name, self.plugin_metadata['name'],
2752
self.plugin_metadata['url']))
2757
class NoPluginAvailable(BzrError):
2761
class NotATerminal(BzrError):
2763
_fmt = 'Unable to ask for a password without real terminal.'
2766
class UnableEncodePath(BzrError):
2768
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2769
'user encoding %(user_encoding)s')
2771
def __init__(self, path, kind):
2774
self.user_encoding = osutils.get_user_encoding()
2777
class NoSuchAlias(BzrError):
2779
_fmt = ('The alias "%(alias_name)s" does not exist.')
2781
def __init__(self, alias_name):
2782
BzrError.__init__(self, alias_name=alias_name)
2785
class DirectoryLookupFailure(BzrError):
2786
"""Base type for lookup errors."""
2791
class InvalidLocationAlias(DirectoryLookupFailure):
2793
_fmt = '"%(alias_name)s" is not a valid location alias.'
2795
def __init__(self, alias_name):
2796
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2799
class UnsetLocationAlias(DirectoryLookupFailure):
2801
_fmt = 'No %(alias_name)s location assigned.'
2803
def __init__(self, alias_name):
2804
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2807
class CannotBindAddress(BzrError):
2809
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2811
def __init__(self, host, port, orig_error):
2812
BzrError.__init__(self, host=host, port=port,
2813
orig_error=orig_error[1])
2816
class UnknownRules(BzrError):
2818
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
2820
def __init__(self, unknowns):
2821
BzrError.__init__(self, unknowns_str=", ".join(unknowns))
2824
class HookFailed(BzrError):
2825
"""Raised when a pre_change_branch_tip hook function fails anything other
2826
than TipChangeRejected.
2829
_fmt = ("Hook '%(hook_name)s' during %(hook_stage)s failed:\n"
2830
"%(traceback_text)s%(exc_value)s")
2832
def __init__(self, hook_stage, hook_name, exc_info):
2834
self.hook_stage = hook_stage
2835
self.hook_name = hook_name
2836
self.exc_info = exc_info
2837
self.exc_type = exc_info[0]
2838
self.exc_value = exc_info[1]
2839
self.exc_tb = exc_info[2]
2840
self.traceback_text = ''.join(traceback.format_tb(self.exc_tb))
2843
class TipChangeRejected(BzrError):
2844
"""A pre_change_branch_tip hook function may raise this to cleanly and
2845
explicitly abort a change to a branch tip.
2848
_fmt = u"Tip change rejected: %(msg)s"
2850
def __init__(self, msg):
1746
def __init__(self, name):
1747
BzrError.__init__(self)