Rev 4529: Merge the fcntl change which makes them exclusive. in http://bazaar.launchpad.net/~jameinel/bzr/1.18-lock-warnings
John Arbash Meinel
john at arbash-meinel.com
Thu Jul 30 21:47:04 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.18-lock-warnings
------------------------------------------------------------
revno: 4529 [merge]
revision-id: john at arbash-meinel.com-20090730204645-w20f3wb8k480b5kc
parent: john at arbash-meinel.com-20090730204421-ei0b6opu4h9njsta
parent: john at arbash-meinel.com-20090710214924-9skgfm3b3ejakh6p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.18-lock-warnings
timestamp: Thu 2009-07-30 15:46:45 -0500
message:
Merge the fcntl change which makes them exclusive.
modified:
bzrlib/lock.py lock.py-20050527050856-ec090bb51bc03349
-------------- next part --------------
=== modified file 'bzrlib/lock.py'
--- a/bzrlib/lock.py 2009-07-30 20:42:32 +0000
+++ b/bzrlib/lock.py 2009-07-30 20:46:45 +0000
@@ -187,7 +187,8 @@
super(_fcntl_WriteLock, self).__init__()
# Check we can grab a lock before we actually open the file.
self.filename = osutils.realpath(filename)
- if self.filename in _fcntl_WriteLock._open_locks:
+ if (self.filename in _fcntl_WriteLock._open_locks
+ or self.filename in _fcntl_ReadLock._open_locks):
self._clear_f()
raise errors.LockContention(self.filename)
@@ -220,6 +221,8 @@
def __init__(self, filename):
super(_fcntl_ReadLock, self).__init__()
self.filename = osutils.realpath(filename)
+ if self.filename in _fcntl_WriteLock._open_locks:
+ raise errors.LockContention(self.filename)
_fcntl_ReadLock._open_locks.setdefault(self.filename, 0)
_fcntl_ReadLock._open_locks[self.filename] += 1
self._open(filename, 'rb')
More information about the bazaar-commits
mailing list