267
271
"""Cannot operate on a file because it is a control file."""
270
class LockError(Exception):
274
class LockError(BzrNewError):
275
"""Lock error: %(message)s"""
272
276
# All exceptions from the lock/unlock functions should be from
273
277
# this exception class. They will be translated as necessary. The
274
278
# original exception is available as e.original_error
280
# New code should prefer to raise specific subclasses
281
def __init__(self, message):
282
self.message = message
277
285
class CommitNotPossible(LockError):
278
286
"""A commit was attempted but we do not have a write lock open."""
281
291
class AlreadyCommitted(LockError):
282
292
"""A rollback was requested, but is not able to be accomplished."""
285
297
class ReadOnlyError(LockError):
286
"""A write attempt was made in a read only transaction."""
298
"""A write attempt was made in a read only transaction on %(obj)s"""
299
def __init__(self, obj):
303
class BranchNotLocked(LockError):
304
"""Branch %(branch)r is not locked"""
305
def __init__(self, branch):
306
# XXX: sometimes called with a LockableFiles instance not a Branch
310
class ReadOnlyObjectDirtiedError(ReadOnlyError):
311
"""Cannot change object %(obj)r in read only transaction"""
312
def __init__(self, obj):
316
class UnlockableTransport(LockError):
317
"""Cannot lock: transport is read only: %(transport)s"""
318
def __init__(self, transport):
319
self.transport = transport
322
class LockContention(LockError):
323
"""Could not acquire lock %(lock)s"""
324
# TODO: show full url for lock, combining the transport and relative bits?
325
def __init__(self, lock):
329
class LockBroken(LockError):
330
"""Lock was broken while still open: %(lock)s - check storage consistency!"""
331
def __init__(self, lock):
335
class LockBreakMismatch(LockError):
336
"""Lock was released and re-acquired before being broken: %(lock)s: held by %(holder)r, wanted to break %(target)r"""
337
def __init__(self, lock, holder, target):
343
class LockNotHeld(LockError):
344
"""Lock not held: %(lock)s"""
345
def __init__(self, lock):
349
class BranchNotLocked(LockError):
350
"""Branch %(branch)r not locked"""
351
def __init__(self, branch):
289
355
class PointlessCommit(BzrNewError):