/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-06-05 16:27:16 UTC
  • mfrom: (3475 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3476.
  • Revision ID: john@arbash-meinel.com-20080605162716-a3hn238tnctbfd8j
merge bzr.dev, resolve NEWS

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."""
684
732
 
685
733
class UnknownFormatError(BzrError):
686
734
    
687
 
    _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
688
740
 
689
741
 
690
742
class IncompatibleFormat(BzrError):
854
906
        self.obj = obj
855
907
 
856
908
 
857
 
class ReadOnlyLockError(LockError):
858
 
 
859
 
    _fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
860
 
 
861
 
    @symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
862
 
    def __init__(self, fname, msg):
863
 
        LockError.__init__(self, '')
864
 
        self.fname = fname
865
 
        self.msg = msg
866
 
 
867
 
 
868
909
class LockFailed(LockError):
869
910
 
870
911
    internal_error = False
1026
1067
        BzrError.__init__(self, branch=branch, revision=revision)
1027
1068
 
1028
1069
 
1029
 
# zero_ninetyone: this exception is no longer raised and should be removed
1030
 
class NotLeftParentDescendant(InternalBzrError):
1031
 
 
1032
 
    _fmt = ("Revision %(old_revision)s is not the left parent of"
1033
 
            " %(new_revision)s, but branch %(branch_location)s expects this")
1034
 
 
1035
 
    def __init__(self, branch, old_revision, new_revision):
1036
 
        BzrError.__init__(self, branch_location=branch.base,
1037
 
                          old_revision=old_revision,
1038
 
                          new_revision=new_revision)
1039
 
 
1040
 
 
1041
1070
class RangeInChangeOption(BzrError):
1042
1071
 
1043
1072
    _fmt = "Option --change does not accept revision ranges"
1169
1198
        self.bases = bases
1170
1199
 
1171
1200
 
1172
 
class NoCommits(BzrError):
 
1201
class NoCommits(BranchError):
1173
1202
 
1174
1203
    _fmt = "Branch %(branch)s has no commits."
1175
1204
 
1176
 
    def __init__(self, branch):
1177
 
        BzrError.__init__(self, branch=branch)
1178
 
 
1179
1205
 
1180
1206
class UnlistableStore(BzrError):
1181
1207
 
1439
1465
        self.details = details
1440
1466
 
1441
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
 
1442
1492
# A set of semi-meaningful errors which can be thrown
1443
1493
class TransportNotPossible(TransportError):
1444
1494
 
2029
2079
        self.path = path
2030
2080
 
2031
2081
 
 
2082
class RepositoryUpgradeRequired(UpgradeRequired):
 
2083
 
 
2084
    _fmt = "To use this feature you must upgrade your repository at %(path)s."
 
2085
 
 
2086
 
2032
2087
class LocalRequiresBoundBranch(BzrError):
2033
2088
 
2034
2089
    _fmt = "Cannot perform local-only commits on unbound branches."
2178
2233
 
2179
2234
    _fmt = "No smart server available at %(url)s"
2180
2235
 
 
2236
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
2181
2237
    def __init__(self, url):
2182
2238
        self.url = url
2183
2239
 
2197
2253
            " Please set BZR_SSH environment variable.")
2198
2254
 
2199
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
        
2200
2267
class GhostRevisionUnusableHere(BzrError):
2201
2268
 
2202
2269
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
2379
2446
        self.response_tuple = response_tuple
2380
2447
 
2381
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
 
2382
2464
class ContainerError(BzrError):
2383
2465
    """Base class of container errors."""
2384
2466
 
2500
2582
        BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2501
2583
 
2502
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
 
2503
2597
class AlreadyBranch(BzrDirError):
2504
2598
 
2505
2599
    _fmt = "'%(display_url)s' is already a branch."
2520
2614
    _fmt = "'%(display_url)s' is already a lightweight checkout."
2521
2615
 
2522
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
 
2523
2627
class ReconfigurationNotSupported(BzrDirError):
2524
2628
 
2525
2629
    _fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2576
2680
 
2577
2681
    def __init__(self, timezone):
2578
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])