185
185
_fmt = "The tree builder is already building a tree."
188
class BranchError(BzrError):
189
"""Base class for concrete 'errors about a branch'."""
191
def __init__(self, branch):
192
BzrError.__init__(self, branch=branch)
188
195
class BzrCheckError(InternalBzrError):
190
197
_fmt = "Internal check failed: %(message)s"
305
312
BzrError.__init__(self, repository=repository, file_id=file_id)
315
class NotStacked(BranchError):
317
_fmt = "The branch '%(branch)s' is not stacked."
308
320
class InventoryModified(InternalBzrError):
310
322
_fmt = ("The current inventory for the tree %(tree)r has been modified,"
542
554
class InvalidURLJoin(PathError):
544
_fmt = 'Invalid URL join request: "%(args)s"%(extra)s'
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"
558
def __init__(self, reason, base, join_args):
561
self.join_args = join_args
562
PathError.__init__(self, base, reason)
565
class UnavailableRepresentation(InternalBzrError):
567
_fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which "
568
"is encoded as '%(native)s'.")
570
def __init__(self, key, wanted, native):
571
InternalBzrError.__init__(self)
551
577
class UnknownHook(BzrError):
566
592
PathError.__init__(self, url, extra=extra)
595
class UnstackableBranchFormat(BzrError):
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.")
600
def __init__(self, format, url):
601
BzrError.__init__(self)
606
class UnstackableRepositoryFormat(BzrError):
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.")
611
def __init__(self, format, url):
612
BzrError.__init__(self)
569
617
class ReadError(PathError):
571
619
_fmt = """Error reading from %(path)r."""
872
class ReadOnlyLockError(LockError):
874
_fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
876
@symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
877
def __init__(self, fname, msg):
878
LockError.__init__(self, '')
883
920
class LockFailed(LockError):
885
922
internal_error = False
1041
1078
BzrError.__init__(self, branch=branch, revision=revision)
1044
# zero_ninetyone: this exception is no longer raised and should be removed
1045
class NotLeftParentDescendant(InternalBzrError):
1047
_fmt = ("Revision %(old_revision)s is not the left parent of"
1048
" %(new_revision)s, but branch %(branch_location)s expects this")
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)
1056
1081
class RangeInChangeOption(BzrError):
1058
1083
_fmt = "Option --change does not accept revision ranges"
1184
1209
self.bases = bases
1187
class NoCommits(BzrError):
1212
class NoCommits(BranchError):
1189
1214
_fmt = "Branch %(branch)s has no commits."
1191
def __init__(self, branch):
1192
BzrError.__init__(self, branch=branch)
1195
1217
class UnlistableStore(BzrError):
1454
1476
self.details = details
1479
class UnexpectedProtocolVersionMarker(TransportError):
1481
_fmt = "Received bad protocol version marker: %(marker)r"
1483
def __init__(self, marker):
1484
self.marker = marker
1487
class UnknownSmartMethod(InternalBzrError):
1489
_fmt = "The server does not recognise the '%(verb)s' request."
1491
def __init__(self, verb):
1495
class SmartMessageHandlerError(InternalBzrError):
1497
_fmt = "The message handler raised an exception: %(exc_value)s."
1499
def __init__(self, exc_info):
1500
self.exc_type, self.exc_value, self.tb = exc_info
1457
1503
# A set of semi-meaningful errors which can be thrown
1458
1504
class TransportNotPossible(TransportError):
2044
2090
self.path = path
2093
class RepositoryUpgradeRequired(UpgradeRequired):
2095
_fmt = "To use this feature you must upgrade your repository at %(path)s."
2047
2098
class LocalRequiresBoundBranch(BzrError):
2049
2100
_fmt = "Cannot perform local-only commits on unbound branches."
2212
2264
" Please set BZR_SSH environment variable.")
2267
class GhostRevisionsHaveNoRevno(BzrError):
2268
"""When searching for revnos, if we encounter a ghost, we are stuck"""
2270
_fmt = ("Could not determine revno for {%(revision_id)s} because"
2271
" its ancestry shows a ghost at {%(ghost_revision_id)s}")
2273
def __init__(self, revision_id, ghost_revision_id):
2274
self.revision_id = revision_id
2275
self.ghost_revision_id = ghost_revision_id
2215
2278
class GhostRevisionUnusableHere(BzrError):
2217
2280
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
2394
2457
self.response_tuple = response_tuple
2460
class ErrorFromSmartServer(BzrError):
2462
_fmt = "Error received from smart server: %(error_tuple)r"
2464
internal_error = True
2466
def __init__(self, error_tuple):
2467
self.error_tuple = error_tuple
2469
self.error_verb = error_tuple[0]
2471
self.error_verb = None
2472
self.error_args = error_tuple[1:]
2397
2475
class ContainerError(BzrError):
2398
2476
"""Base class of container errors."""
2515
2593
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2596
class UnsyncedBranches(BzrDirError):
2598
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2599
" bzr help sync-for-reconfigure.")
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,
2518
2608
class AlreadyBranch(BzrDirError):
2520
2610
_fmt = "'%(display_url)s' is already a branch."
2535
2625
_fmt = "'%(display_url)s' is already a lightweight checkout."
2628
class AlreadyUsingShared(BzrDirError):
2630
_fmt = "'%(display_url)s' is already using a shared repository."
2633
class AlreadyStandalone(BzrDirError):
2635
_fmt = "'%(display_url)s' is already standalone."
2538
2638
class ReconfigurationNotSupported(BzrDirError):
2540
2640
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2593
2693
self.timezone = timezone
2696
class CommandAvailableInPlugin(StandardError):
2698
internal_error = False
2700
def __init__(self, cmd_name, plugin_metadata, provider):
2702
self.plugin_metadata = plugin_metadata
2703
self.cmd_name = cmd_name
2704
self.provider = provider
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']))
2717
class NoPluginAvailable(BzrError):
2721
class NotATerminal(BzrError):
2723
_fmt = 'Unable to ask for a password without real terminal.'
2596
2726
class UnableEncodePath(BzrError):
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()
2737
class NoSuchAlias(BzrError):
2739
_fmt = ('The alias "%(alias_name)s" does not exist.')
2741
def __init__(self, alias_name):
2742
BzrError.__init__(self, alias_name=alias_name)
2745
class DirectoryLookupFailure(BzrError):
2746
"""Base type for lookup errors."""
2751
class InvalidLocationAlias(DirectoryLookupFailure):
2753
_fmt = '"%(alias_name)s" is not a valid location alias.'
2755
def __init__(self, alias_name):
2756
DirectoryLookupFailure.__init__(self, alias_name=alias_name)
2759
class UnsetLocationAlias(DirectoryLookupFailure):
2761
_fmt = 'No %(alias_name)s location assigned.'
2763
def __init__(self, alias_name):
2764
DirectoryLookupFailure.__init__(self, alias_name=alias_name[1:])
2767
class CannotBindAddress(BzrError):
2769
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2771
def __init__(self, host, port, orig_error):
2772
BzrError.__init__(self, host=host, port=port,
2773
orig_error=orig_error[1])
2776
class UnknownRules(BzrError):
2778
_fmt = ('Unknown rules detected: %(unknowns_str)s.')
2780
def __init__(self, unknowns):
2781
BzrError.__init__(self, unknowns_str=", ".join(unknowns))