Rev 2380: Cherry-pick the 2 locking fixes from the 0.15 branch. in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/locking_0_16_errors
John Arbash Meinel
john at arbash-meinel.com
Thu Mar 29 15:01:52 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/locking_0_16_errors
------------------------------------------------------------
revno: 2380
revision-id: john at arbash-meinel.com-20070329140138-md8j2y6tm6g43xuc
parent: pqm at pqm.ubuntu.com-20070327081802-271be0d343108f4f
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: locking_0_16_errors
timestamp: Thu 2007-03-29 09:01:38 -0500
message:
Cherry-pick the 2 locking fixes from the 0.15 branch.
modified:
bzrlib/lock.py lock.py-20050527050856-ec090bb51bc03349
-------------- next part --------------
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py 2007-03-19 22:11:28 +0000
+++ b/bzrlib/lock.py 2007-03-29 14:01:38 +0000
@@ -143,7 +143,7 @@
self.unlock()
# we should be more precise about whats a locking
# error and whats a random-other error
- raise errors.LockError(e)
+ raise errors.LockContention(e)
def unlock(self):
_fcntl_WriteLock._open_locks.remove(self.filename)
@@ -167,7 +167,7 @@
except IOError, e:
# we should be more precise about whats a locking
# error and whats a random-other error
- raise errors.LockError(e)
+ raise errors.LockContention(e)
def unlock(self):
count = _fcntl_ReadLock._open_locks[self.filename]
@@ -228,10 +228,10 @@
try:
# LOCK_NB will cause IOError to be raised if we can't grab a
# lock right away.
- fcntl.lockf(new_f, fcntl.LOCK_SH | fcntl.LOCK_NB)
+ fcntl.lockf(new_f, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError, e:
# TODO: Raise a more specific error based on the type of error
- raise errors.LockError(e)
+ raise errors.LockContention(e)
_fcntl_WriteLock._open_locks.add(self.filename)
self.f = new_f
@@ -276,7 +276,7 @@
raise
except Exception, e:
self._clear_f()
- raise errors.LockError(e)
+ raise errors.LockContention(e)
def unlock(self):
overlapped = pywintypes.OVERLAPPED()
@@ -284,7 +284,7 @@
win32file.UnlockFileEx(self.hfile, 0, 0x7fff0000, overlapped)
self._clear_f()
except Exception, e:
- raise errors.LockError(e)
+ raise errors.LockContention(e)
class _w32c_ReadLock(_w32c_FileLock):
@@ -393,8 +393,8 @@
last_err = _GetLastError()
if last_err in (ERROR_LOCK_VIOLATION,):
raise errors.LockContention(filename)
- raise errors.LockError('Unknown locking error: %s'
- % (last_err,))
+ raise errors.LockContention('Unknown locking error: %s'
+ % (last_err,))
def unlock(self):
overlapped = OVERLAPPED()
@@ -408,8 +408,8 @@
if result == 0:
self._clear_f()
last_err = _GetLastError()
- raise errors.LockError('Unknown unlocking error: %s'
- % (last_err,))
+ raise errors.LockContention('Unknown unlocking error: %s'
+ % (last_err,))
class _ctypes_ReadLock(_ctypes_FileLock):
More information about the bazaar-commits
mailing list