/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 bzrlib/errors.py

Merge with stacked-fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
553
553
 
554
554
class InvalidURLJoin(PathError):
555
555
 
556
 
    _fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
557
 
 
558
 
    def __init__(self, msg, base, args):
559
 
        PathError.__init__(self, base, msg)
560
 
        self.args = [base] + list(args)
 
556
    _fmt = "Invalid URL join request: %(reason)s: %(base)r + %(join_args)r"
 
557
 
 
558
    def __init__(self, reason, base, join_args):
 
559
        self.reason = reason
 
560
        self.base = base
 
561
        self.join_args = join_args
 
562
        PathError.__init__(self, base, reason)
 
563
 
 
564
 
 
565
class UnavailableRepresentation(InternalBzrError):
 
566
 
 
567
    _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
 
568
        "is encoded as '%(native)s'.")
 
569
 
 
570
    def __init__(self, key, wanted, native):
 
571
        InternalBzrError.__init__(self)
 
572
        self.wanted = wanted
 
573
        self.native = native
 
574
        self.key = key
561
575
 
562
576
 
563
577
class UnknownHook(BzrError):
718
732
 
719
733
class UnknownFormatError(BzrError):
720
734
    
721
 
    _fmt = "Unknown branch format: %(format)r"
 
735
    _fmt = "Unknown %(kind)s format: %(format)r"
 
736
 
 
737
    def __init__(self, format, kind='branch'):
 
738
        self.kind = kind
 
739
        self.format = format
722
740
 
723
741
 
724
742
class IncompatibleFormat(BzrError):
888
906
        self.obj = obj
889
907
 
890
908
 
891
 
class ReadOnlyLockError(LockError):
892
 
 
893
 
    _fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
894
 
 
895
 
    @symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
896
 
    def __init__(self, fname, msg):
897
 
        LockError.__init__(self, '')
898
 
        self.fname = fname
899
 
        self.msg = msg
900
 
 
901
 
 
902
909
class LockFailed(LockError):
903
910
 
904
911
    internal_error = False
1060
1067
        BzrError.__init__(self, branch=branch, revision=revision)
1061
1068
 
1062
1069
 
1063
 
# zero_ninetyone: this exception is no longer raised and should be removed
1064
 
class NotLeftParentDescendant(InternalBzrError):
1065
 
 
1066
 
    _fmt = ("Revision %(old_revision)s is not the left parent of"
1067
 
            " %(new_revision)s, but branch %(branch_location)s expects this")
1068
 
 
1069
 
    def __init__(self, branch, old_revision, new_revision):
1070
 
        BzrError.__init__(self, branch_location=branch.base,
1071
 
                          old_revision=old_revision,
1072
 
                          new_revision=new_revision)
1073
 
 
1074
 
 
1075
1070
class RangeInChangeOption(BzrError):
1076
1071
 
1077
1072
    _fmt = "Option --change does not accept revision ranges"
1470
1465
        self.details = details
1471
1466
 
1472
1467
 
 
1468
class UnexpectedProtocolVersionMarker(TransportError):
 
1469
 
 
1470
    _fmt = "Received bad protocol version marker: %(marker)r"
 
1471
 
 
1472
    def __init__(self, marker):
 
1473
        self.marker = marker
 
1474
 
 
1475
 
 
1476
class UnknownSmartMethod(InternalBzrError):
 
1477
 
 
1478
    _fmt = "The server does not recognise the '%(verb)s' request."
 
1479
 
 
1480
    def __init__(self, verb):
 
1481
        self.verb = verb
 
1482
 
 
1483
 
 
1484
class SmartMessageHandlerError(InternalBzrError):
 
1485
 
 
1486
    _fmt = "The message handler raised an exception: %(exc_value)s."
 
1487
 
 
1488
    def __init__(self, exc_info):
 
1489
        self.exc_type, self.exc_value, self.tb = exc_info
 
1490
        
 
1491
 
1473
1492
# A set of semi-meaningful errors which can be thrown
1474
1493
class TransportNotPossible(TransportError):
1475
1494
 
2060
2079
        self.path = path
2061
2080
 
2062
2081
 
 
2082
class RepositoryUpgradeRequired(UpgradeRequired):
 
2083
 
 
2084
    _fmt = "To use this feature you must upgrade your repository at %(path)s."
 
2085
 
 
2086
 
2063
2087
class LocalRequiresBoundBranch(BzrError):
2064
2088
 
2065
2089
    _fmt = "Cannot perform local-only commits on unbound branches."
2209
2233
 
2210
2234
    _fmt = "No smart server available at %(url)s"
2211
2235
 
 
2236
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
2212
2237
    def __init__(self, url):
2213
2238
        self.url = url
2214
2239
 
2228
2253
            " Please set BZR_SSH environment variable.")
2229
2254
 
2230
2255
 
 
2256
class GhostRevisionsHaveNoRevno(BzrError):
 
2257
    """When searching for revnos, if we encounter a ghost, we are stuck"""
 
2258
 
 
2259
    _fmt = ("Could not determine revno for {%(revision_id)s} because"
 
2260
            " its ancestry shows a ghost at {%(ghost_revision_id)s}")
 
2261
 
 
2262
    def __init__(self, revision_id, ghost_revision_id):
 
2263
        self.revision_id = revision_id
 
2264
        self.ghost_revision_id = ghost_revision_id
 
2265
 
 
2266
        
2231
2267
class GhostRevisionUnusableHere(BzrError):
2232
2268
 
2233
2269
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
2410
2446
        self.response_tuple = response_tuple
2411
2447
 
2412
2448
 
 
2449
class ErrorFromSmartServer(BzrError):
 
2450
 
 
2451
    _fmt = "Error received from smart server: %(error_tuple)r"
 
2452
 
 
2453
    internal_error = True
 
2454
 
 
2455
    def __init__(self, error_tuple):
 
2456
        self.error_tuple = error_tuple
 
2457
        try:
 
2458
            self.error_verb = error_tuple[0]
 
2459
        except IndexError:
 
2460
            self.error_verb = None
 
2461
        self.error_args = error_tuple[1:]
 
2462
 
 
2463
 
2413
2464
class ContainerError(BzrError):
2414
2465
    """Base class of container errors."""
2415
2466
 
2531
2582
        BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2532
2583
 
2533
2584
 
 
2585
class UnsyncedBranches(BzrDirError):
 
2586
 
 
2587
    _fmt = ("'%(display_url)s' is not in sync with %(target_url)s.  See"
 
2588
            " bzr help sync-for-reconfigure.")
 
2589
 
 
2590
    def __init__(self, bzrdir, target_branch):
 
2591
        BzrDirError.__init__(self, bzrdir)
 
2592
        import bzrlib.urlutils as urlutils
 
2593
        self.target_url = urlutils.unescape_for_display(target_branch.base,
 
2594
                                                        'ascii')
 
2595
 
 
2596
 
2534
2597
class AlreadyBranch(BzrDirError):
2535
2598
 
2536
2599
    _fmt = "'%(display_url)s' is already a branch."
2551
2614
    _fmt = "'%(display_url)s' is already a lightweight checkout."
2552
2615
 
2553
2616
 
 
2617
class AlreadyUsingShared(BzrDirError):
 
2618
 
 
2619
    _fmt = "'%(display_url)s' is already using a shared repository."
 
2620
 
 
2621
 
 
2622
class AlreadyStandalone(BzrDirError):
 
2623
 
 
2624
    _fmt = "'%(display_url)s' is already standalone."
 
2625
 
 
2626
 
2554
2627
class ReconfigurationNotSupported(BzrDirError):
2555
2628
 
2556
2629
    _fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2607
2680
 
2608
2681
    def __init__(self, timezone):
2609
2682
        self.timezone = timezone
 
2683
 
 
2684
 
 
2685
class CommandAvailableInPlugin(StandardError):
 
2686
    
 
2687
    internal_error = False
 
2688
 
 
2689
    def __init__(self, cmd_name, plugin_metadata, provider):
 
2690
        
 
2691
        self.plugin_metadata = plugin_metadata
 
2692
        self.cmd_name = cmd_name
 
2693
        self.provider = provider
 
2694
 
 
2695
    def __str__(self):
 
2696
 
 
2697
        _fmt = ('"%s" is not a standard bzr command. \n' 
 
2698
                'However, the following official plugin provides this command: %s\n'
 
2699
                'You can install it by going to: %s'
 
2700
                % (self.cmd_name, self.plugin_metadata['name'], 
 
2701
                    self.plugin_metadata['url']))
 
2702
 
 
2703
        return _fmt
 
2704
 
 
2705
 
 
2706
class NoPluginAvailable(BzrError):
 
2707
    pass    
 
2708
 
 
2709
 
 
2710
class NotATerminal(BzrError):
 
2711
 
 
2712
    _fmt = 'Unable to ask for a password without real terminal.'
 
2713
 
 
2714
 
 
2715
class UnableEncodePath(BzrError):
 
2716
 
 
2717
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
 
2718
            'user encoding %(user_encoding)s')
 
2719
 
 
2720
    def __init__(self, path, kind):
 
2721
        self.path = path
 
2722
        self.kind = kind
 
2723
        self.user_encoding = osutils.get_user_encoding()
 
2724
 
 
2725
 
 
2726
class NoSuchAlias(BzrError):
 
2727
 
 
2728
    _fmt = ('The alias "%(alias_name)s" does not exist.')
 
2729
 
 
2730
    def __init__(self, alias_name):
 
2731
        BzrError.__init__(self, alias_name=alias_name)
 
2732
 
 
2733
 
 
2734
class CannotBindAddress(BzrError):
 
2735
 
 
2736
    _fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
 
2737
 
 
2738
    def __init__(self, host, port, orig_error):
 
2739
        BzrError.__init__(self, host=host, port=port,
 
2740
            orig_error=orig_error[1])