~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

Merge bzr.dev and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
562
562
        PathError.__init__(self, base, reason)
563
563
 
564
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
 
575
 
 
576
 
565
577
class UnknownHook(BzrError):
566
578
 
567
579
    _fmt = "The %(type)s hook '%(hook)s' is unknown in this version of bzrlib."
894
906
        self.obj = obj
895
907
 
896
908
 
897
 
class ReadOnlyLockError(LockError):
898
 
 
899
 
    _fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
900
 
 
901
 
    @symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
902
 
    def __init__(self, fname, msg):
903
 
        LockError.__init__(self, '')
904
 
        self.fname = fname
905
 
        self.msg = msg
906
 
 
907
 
 
908
909
class LockFailed(LockError):
909
910
 
910
911
    internal_error = False
1066
1067
        BzrError.__init__(self, branch=branch, revision=revision)
1067
1068
 
1068
1069
 
1069
 
# zero_ninetyone: this exception is no longer raised and should be removed
1070
 
class NotLeftParentDescendant(InternalBzrError):
1071
 
 
1072
 
    _fmt = ("Revision %(old_revision)s is not the left parent of"
1073
 
            " %(new_revision)s, but branch %(branch_location)s expects this")
1074
 
 
1075
 
    def __init__(self, branch, old_revision, new_revision):
1076
 
        BzrError.__init__(self, branch_location=branch.base,
1077
 
                          old_revision=old_revision,
1078
 
                          new_revision=new_revision)
1079
 
 
1080
 
 
1081
1070
class RangeInChangeOption(BzrError):
1082
1071
 
1083
1072
    _fmt = "Option --change does not accept revision ranges"
1476
1465
        self.details = details
1477
1466
 
1478
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
 
1479
1476
class UnknownSmartMethod(InternalBzrError):
1480
1477
 
1481
1478
    _fmt = "The server does not recognise the '%(verb)s' request."
1484
1481
        self.verb = verb
1485
1482
 
1486
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
 
1487
1492
# A set of semi-meaningful errors which can be thrown
1488
1493
class TransportNotPossible(TransportError):
1489
1494
 
2248
2253
            " Please set BZR_SSH environment variable.")
2249
2254
 
2250
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
        
2251
2267
class GhostRevisionUnusableHere(BzrError):
2252
2268
 
2253
2269
    _fmt = "Ghost revision {%(revision_id)s} cannot be used here."
2430
2446
        self.response_tuple = response_tuple
2431
2447
 
2432
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
 
2433
2464
class ContainerError(BzrError):
2434
2465
    """Base class of container errors."""
2435
2466
 
2551
2582
        BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2552
2583
 
2553
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
 
2554
2597
class AlreadyBranch(BzrDirError):
2555
2598
 
2556
2599
    _fmt = "'%(display_url)s' is already a branch."
2686
2729
 
2687
2730
    def __init__(self, alias_name):
2688
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])