/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

  • Committer: John Arbash Meinel
  • Date: 2008-07-08 14:55:19 UTC
  • mfrom: (3530 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3532.
  • Revision ID: john@arbash-meinel.com-20080708145519-paqg4kjwbpgs2xmq
Merge bzr.dev 3530

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
    _fmt = "The tree builder is already building a tree."
186
186
 
187
187
 
 
188
class BranchError(BzrError):
 
189
    """Base class for concrete 'errors about a branch'."""
 
190
 
 
191
    def __init__(self, branch):
 
192
        BzrError.__init__(self, branch=branch)
 
193
 
 
194
 
188
195
class BzrCheckError(InternalBzrError):
189
196
    
190
197
    _fmt = "Internal check failed: %(message)s"
305
312
        BzrError.__init__(self, repository=repository, file_id=file_id)
306
313
 
307
314
 
 
315
class NotStacked(BranchError):
 
316
 
 
317
    _fmt = "The branch '%(branch)s' is not stacked."
 
318
 
 
319
 
308
320
class InventoryModified(InternalBzrError):
309
321
 
310
322
    _fmt = ("The current inventory for the tree %(tree)r has been modified,"
541
553
 
542
554
class InvalidURLJoin(PathError):
543
555
 
544
 
    _fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
545
 
 
546
 
    def __init__(self, msg, base, args):
547
 
        PathError.__init__(self, base, msg)
548
 
        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
549
575
 
550
576
 
551
577
class UnknownHook(BzrError):
566
592
        PathError.__init__(self, url, extra=extra)
567
593
 
568
594
 
 
595
class UnstackableBranchFormat(BzrError):
 
596
 
 
597
    _fmt = ("The branch '%(url)s'(%(format)s) is not a stackable format. "
 
598
        "You will need to upgrade the branch to permit branch stacking.")
 
599
 
 
600
    def __init__(self, format, url):
 
601
        BzrError.__init__(self)
 
602
        self.format = format
 
603
        self.url = url
 
604
 
 
605
 
 
606
class UnstackableRepositoryFormat(BzrError):
 
607
 
 
608
    _fmt = ("The repository '%(url)s'(%(format)s) is not a stackable format. "
 
609
        "You will need to upgrade the repository to permit branch stacking.")
 
610
 
 
611
    def __init__(self, format, url):
 
612
        BzrError.__init__(self)
 
613
        self.format = format
 
614
        self.url = url
 
615
 
 
616
 
569
617
class ReadError(PathError):
570
618
    
571
619
    _fmt = """Error reading from %(path)r."""
869
917
        self.obj = obj
870
918
 
871
919
 
872
 
class ReadOnlyLockError(LockError):
873
 
 
874
 
    _fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
875
 
 
876
 
    @symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
877
 
    def __init__(self, fname, msg):
878
 
        LockError.__init__(self, '')
879
 
        self.fname = fname
880
 
        self.msg = msg
881
 
 
882
 
 
883
920
class LockFailed(LockError):
884
921
 
885
922
    internal_error = False
1041
1078
        BzrError.__init__(self, branch=branch, revision=revision)
1042
1079
 
1043
1080
 
1044
 
# zero_ninetyone: this exception is no longer raised and should be removed
1045
 
class NotLeftParentDescendant(InternalBzrError):
1046
 
 
1047
 
    _fmt = ("Revision %(old_revision)s is not the left parent of"
1048
 
            " %(new_revision)s, but branch %(branch_location)s expects this")
1049
 
 
1050
 
    def __init__(self, branch, old_revision, new_revision):
1051
 
        BzrError.__init__(self, branch_location=branch.base,
1052
 
                          old_revision=old_revision,
1053
 
                          new_revision=new_revision)
1054
 
 
1055
 
 
1056
1081
class RangeInChangeOption(BzrError):
1057
1082
 
1058
1083
    _fmt = "Option --change does not accept revision ranges"
1184
1209
        self.bases = bases
1185
1210
 
1186
1211
 
1187
 
class NoCommits(BzrError):
 
1212
class NoCommits(BranchError):
1188
1213
 
1189
1214
    _fmt = "Branch %(branch)s has no commits."
1190
1215
 
1191
 
    def __init__(self, branch):
1192
 
        BzrError.__init__(self, branch=branch)
1193
 
 
1194
1216
 
1195
1217
class UnlistableStore(BzrError):
1196
1218
 
1454
1476
        self.details = details
1455
1477
 
1456
1478
 
 
1479
class UnexpectedProtocolVersionMarker(TransportError):
 
1480
 
 
1481
    _fmt = "Received bad protocol version marker: %(marker)r"
 
1482
 
 
1483
    def __init__(self, marker):
 
1484
        self.marker = marker
 
1485
 
 
1486
 
 
1487
class UnknownSmartMethod(InternalBzrError):
 
1488
 
 
1489
    _fmt = "The server does not recognise the '%(verb)s' request."
 
1490
 
 
1491
    def __init__(self, verb):
 
1492
        self.verb = verb
 
1493
 
 
1494
 
 
1495
class SmartMessageHandlerError(InternalBzrError):
 
1496
 
 
1497
    _fmt = "The message handler raised an exception: %(exc_value)s."
 
1498
 
 
1499
    def __init__(self, exc_info):
 
1500
        self.exc_type, self.exc_value, self.tb = exc_info
 
1501
        
 
1502
 
1457
1503
# A set of semi-meaningful errors which can be thrown
1458
1504
class TransportNotPossible(TransportError):
1459
1505
 
2044
2090
        self.path = path
2045
2091
 
2046
2092
 
 
2093
class RepositoryUpgradeRequired(UpgradeRequired):
 
2094
 
 
2095
    _fmt = "To use this feature you must upgrade your repository at %(path)s."
 
2096
 
 
2097
 
2047
2098
class LocalRequiresBoundBranch(BzrError):
2048
2099
 
2049
2100
    _fmt = "Cannot perform local-only commits on unbound branches."
2193
2244
 
2194
2245
    _fmt = "No smart server available at %(url)s"
2195
2246
 
 
2247
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
2196
2248
    def __init__(self, url):
2197
2249
        self.url = url
2198
2250
 
2212
2264
            " Please set BZR_SSH environment variable.")
2213
2265
 
2214
2266
 
 
2267
class GhostRevisionsHaveNoRevno(BzrError):
 
2268
    """When searching for revnos, if we encounter a ghost, we are stuck"""
 
2269
 
 
2270
    _fmt = ("Could not determine revno for {%(revision_id)s} because"
 
2271
            " its ancestry shows a ghost at {%(ghost_revision_id)s}")
 
2272
 
 
2273
    def __init__(self, revision_id, ghost_revision_id):
 
2274
        self.revision_id = revision_id
 
2275
        self.ghost_revision_id = ghost_revision_id
 
2276
 
 
2277
        
2215
2278
class GhostRevisionUnusableHere(BzrError):
2216
2279
 
2217
2280
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
2394
2457
        self.response_tuple = response_tuple
2395
2458
 
2396
2459
 
 
2460
class ErrorFromSmartServer(BzrError):
 
2461
 
 
2462
    _fmt = "Error received from smart server: %(error_tuple)r"
 
2463
 
 
2464
    internal_error = True
 
2465
 
 
2466
    def __init__(self, error_tuple):
 
2467
        self.error_tuple = error_tuple
 
2468
        try:
 
2469
            self.error_verb = error_tuple[0]
 
2470
        except IndexError:
 
2471
            self.error_verb = None
 
2472
        self.error_args = error_tuple[1:]
 
2473
 
 
2474
 
2397
2475
class ContainerError(BzrError):
2398
2476
    """Base class of container errors."""
2399
2477
 
2515
2593
        BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2516
2594
 
2517
2595
 
 
2596
class UnsyncedBranches(BzrDirError):
 
2597
 
 
2598
    _fmt = ("'%(display_url)s' is not in sync with %(target_url)s.  See"
 
2599
            " bzr help sync-for-reconfigure.")
 
2600
 
 
2601
    def __init__(self, bzrdir, target_branch):
 
2602
        BzrDirError.__init__(self, bzrdir)
 
2603
        import bzrlib.urlutils as urlutils
 
2604
        self.target_url = urlutils.unescape_for_display(target_branch.base,
 
2605
                                                        'ascii')
 
2606
 
 
2607
 
2518
2608
class AlreadyBranch(BzrDirError):
2519
2609
 
2520
2610
    _fmt = "'%(display_url)s' is already a branch."
2535
2625
    _fmt = "'%(display_url)s' is already a lightweight checkout."
2536
2626
 
2537
2627
 
 
2628
class AlreadyUsingShared(BzrDirError):
 
2629
 
 
2630
    _fmt = "'%(display_url)s' is already using a shared repository."
 
2631
 
 
2632
 
 
2633
class AlreadyStandalone(BzrDirError):
 
2634
 
 
2635
    _fmt = "'%(display_url)s' is already standalone."
 
2636
 
 
2637
 
2538
2638
class ReconfigurationNotSupported(BzrDirError):
2539
2639
 
2540
2640
    _fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2593
2693
        self.timezone = timezone
2594
2694
 
2595
2695
 
 
2696
class CommandAvailableInPlugin(StandardError):
 
2697
    
 
2698
    internal_error = False
 
2699
 
 
2700
    def __init__(self, cmd_name, plugin_metadata, provider):
 
2701
        
 
2702
        self.plugin_metadata = plugin_metadata
 
2703
        self.cmd_name = cmd_name
 
2704
        self.provider = provider
 
2705
 
 
2706
    def __str__(self):
 
2707
 
 
2708
        _fmt = ('"%s" is not a standard bzr command. \n' 
 
2709
                'However, the following official plugin provides this command: %s\n'
 
2710
                'You can install it by going to: %s'
 
2711
                % (self.cmd_name, self.plugin_metadata['name'], 
 
2712
                    self.plugin_metadata['url']))
 
2713
 
 
2714
        return _fmt
 
2715
 
 
2716
 
 
2717
class NoPluginAvailable(BzrError):
 
2718
    pass    
 
2719
 
 
2720
 
 
2721
class NotATerminal(BzrError):
 
2722
 
 
2723
    _fmt = 'Unable to ask for a password without real terminal.'
 
2724
 
 
2725
 
2596
2726
class UnableEncodePath(BzrError):
2597
2727
 
2598
2728
    _fmt = ('Unable to encode %(kind)s path %(path)r in '
2602
2732
        self.path = path
2603
2733
        self.kind = kind
2604
2734
        self.user_encoding = osutils.get_user_encoding()
 
2735
 
 
2736
 
 
2737
class NoSuchAlias(BzrError):
 
2738
 
 
2739
    _fmt = ('The alias "%(alias_name)s" does not exist.')
 
2740
 
 
2741
    def __init__(self, alias_name):
 
2742
        BzrError.__init__(self, alias_name=alias_name)
 
2743
 
 
2744
 
 
2745
class DirectoryLookupFailure(BzrError):
 
2746
    """Base type for lookup errors."""
 
2747
 
 
2748
    pass
 
2749
 
 
2750
 
 
2751
class InvalidLocationAlias(DirectoryLookupFailure):
 
2752
 
 
2753
    _fmt = '"%(alias_name)s" is not a valid location alias.'
 
2754
 
 
2755
    def __init__(self, alias_name):
 
2756
        DirectoryLookupFailure.__init__(self, alias_name=alias_name)
 
2757
 
 
2758
 
 
2759
class UnsetLocationAlias(DirectoryLookupFailure):
 
2760
 
 
2761
    _fmt = 'No %(alias_name)s location assigned.'
 
2762
 
 
2763
    def __init__(self, alias_name):
 
2764
        DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
 
2765
 
 
2766
 
 
2767
class CannotBindAddress(BzrError):
 
2768
 
 
2769
    _fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
 
2770
 
 
2771
    def __init__(self, host, port, orig_error):
 
2772
        BzrError.__init__(self, host=host, port=port,
 
2773
            orig_error=orig_error[1])
 
2774
 
 
2775
 
 
2776
class UnknownRules(BzrError):
 
2777
 
 
2778
    _fmt = ('Unknown rules detected: %(unknowns_str)s.')
 
2779
 
 
2780
    def __init__(self, unknowns):
 
2781
        BzrError.__init__(self, unknowns_str=", ".join(unknowns))