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."""
685
733
class UnknownFormatError(BzrError):
687
_fmt = "Unknown branch format: %(format)r"
735
_fmt = "Unknown %(kind)s format: %(format)r"
737
def __init__(self, format, kind='branch'):
690
742
class IncompatibleFormat(BzrError):
857
class ReadOnlyLockError(LockError):
859
_fmt = "Cannot acquire write lock on %(fname)s. %(msg)s"
861
@symbol_versioning.deprecated_method(symbol_versioning.zero_ninetytwo)
862
def __init__(self, fname, msg):
863
LockError.__init__(self, '')
868
909
class LockFailed(LockError):
870
911
internal_error = False
1026
1067
BzrError.__init__(self, branch=branch, revision=revision)
1029
# zero_ninetyone: this exception is no longer raised and should be removed
1030
class NotLeftParentDescendant(InternalBzrError):
1032
_fmt = ("Revision %(old_revision)s is not the left parent of"
1033
" %(new_revision)s, but branch %(branch_location)s expects this")
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)
1041
1070
class RangeInChangeOption(BzrError):
1043
1072
_fmt = "Option --change does not accept revision ranges"
1169
1198
self.bases = bases
1172
class NoCommits(BzrError):
1201
class NoCommits(BranchError):
1174
1203
_fmt = "Branch %(branch)s has no commits."
1176
def __init__(self, branch):
1177
BzrError.__init__(self, branch=branch)
1180
1206
class UnlistableStore(BzrError):
1439
1465
self.details = details
1468
class UnexpectedProtocolVersionMarker(TransportError):
1470
_fmt = "Received bad protocol version marker: %(marker)r"
1472
def __init__(self, marker):
1473
self.marker = marker
1476
class UnknownSmartMethod(InternalBzrError):
1478
_fmt = "The server does not recognise the '%(verb)s' request."
1480
def __init__(self, verb):
1484
class SmartMessageHandlerError(InternalBzrError):
1486
_fmt = "The message handler raised an exception: %(exc_value)s."
1488
def __init__(self, exc_info):
1489
self.exc_type, self.exc_value, self.tb = exc_info
1442
1492
# A set of semi-meaningful errors which can be thrown
1443
1493
class TransportNotPossible(TransportError):
2029
2079
self.path = path
2082
class RepositoryUpgradeRequired(UpgradeRequired):
2084
_fmt = "To use this feature you must upgrade your repository at %(path)s."
2032
2087
class LocalRequiresBoundBranch(BzrError):
2034
2089
_fmt = "Cannot perform local-only commits on unbound branches."
2197
2253
" Please set BZR_SSH environment variable.")
2256
class GhostRevisionsHaveNoRevno(BzrError):
2257
"""When searching for revnos, if we encounter a ghost, we are stuck"""
2259
_fmt = ("Could not determine revno for {%(revision_id)s} because"
2260
" its ancestry shows a ghost at {%(ghost_revision_id)s}")
2262
def __init__(self, revision_id, ghost_revision_id):
2263
self.revision_id = revision_id
2264
self.ghost_revision_id = ghost_revision_id
2200
2267
class GhostRevisionUnusableHere(BzrError):
2202
2269
_fmt = "Ghost revision {%(revision_id)s} cannot be used here."
2379
2446
self.response_tuple = response_tuple
2449
class ErrorFromSmartServer(BzrError):
2451
_fmt = "Error received from smart server: %(error_tuple)r"
2453
internal_error = True
2455
def __init__(self, error_tuple):
2456
self.error_tuple = error_tuple
2458
self.error_verb = error_tuple[0]
2460
self.error_verb = None
2461
self.error_args = error_tuple[1:]
2382
2464
class ContainerError(BzrError):
2383
2465
"""Base class of container errors."""
2500
2582
BzrError.__init__(self, bzrdir=bzrdir, display_url=display_url)
2585
class UnsyncedBranches(BzrDirError):
2587
_fmt = ("'%(display_url)s' is not in sync with %(target_url)s. See"
2588
" bzr help sync-for-reconfigure.")
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,
2503
2597
class AlreadyBranch(BzrDirError):
2505
2599
_fmt = "'%(display_url)s' is already a branch."
2520
2614
_fmt = "'%(display_url)s' is already a lightweight checkout."
2617
class AlreadyUsingShared(BzrDirError):
2619
_fmt = "'%(display_url)s' is already using a shared repository."
2622
class AlreadyStandalone(BzrDirError):
2624
_fmt = "'%(display_url)s' is already standalone."
2523
2627
class ReconfigurationNotSupported(BzrDirError):
2525
2629
_fmt = "Requested reconfiguration of '%(display_url)s' is not supported."
2577
2681
def __init__(self, timezone):
2578
2682
self.timezone = timezone
2685
class CommandAvailableInPlugin(StandardError):
2687
internal_error = False
2689
def __init__(self, cmd_name, plugin_metadata, provider):
2691
self.plugin_metadata = plugin_metadata
2692
self.cmd_name = cmd_name
2693
self.provider = provider
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']))
2706
class NoPluginAvailable(BzrError):
2710
class NotATerminal(BzrError):
2712
_fmt = 'Unable to ask for a password without real terminal.'
2715
class UnableEncodePath(BzrError):
2717
_fmt = ('Unable to encode %(kind)s path %(path)r in '
2718
'user encoding %(user_encoding)s')
2720
def __init__(self, path, kind):
2723
self.user_encoding = osutils.get_user_encoding()
2726
class NoSuchAlias(BzrError):
2728
_fmt = ('The alias "%(alias_name)s" does not exist.')
2730
def __init__(self, alias_name):
2731
BzrError.__init__(self, alias_name=alias_name)
2734
class CannotBindAddress(BzrError):
2736
_fmt = 'Cannot bind address "%(host)s:%(port)i": %(orig_error)s.'
2738
def __init__(self, host, port, orig_error):
2739
BzrError.__init__(self, host=host, port=port,
2740
orig_error=orig_error[1])