[MERGE][0.15] Updates to OS Locks to support win32

John Arbash Meinel john at arbash-meinel.com
Mon Mar 19 22:18:49 GMT 2007


The attached patch updates our locking code in 2 ways.

1) It adds ReadLock.temporary_write_lock() which allows 'bzr status' to
upgrade to a Write lock if it can, so that it can update the dirstate
with new stat values/sha1 hashes.

2) It provides the framework for making fcntl locks truly exclusive.
(you shouldn't be able to take out a WriteLock if you have a ReadLock,
nor should you be able to take out a ReadLock if you have a WriteLock).

The specific tests for it (and the ability) are currently disabled.
Because it makes revert and merge tests fail. (There are 2 revert tests
which fail if a read lock blocks a write lock, and several more merge
tests which fail if a write lock blocks a read lock).


I would like to merge this for 0.15, because it make 'bzr status' work
again on win32. Without this, 'bzr status' has to read all files that
are out-of-date, and is unable to update the dirstate file. Which means
that unless you do a mutating option (bzr commit?) 'bzr status' is very
slow.

I really wanted to clean up our code so that we could make locks
properly exclusive on all platforms, but I just wasn't able to fix all
the tests. So it is easier to just disable that for now.

Oh, and there are some "InterRepository" tests for old branch formats
that fail if we cause blocking. I think the best fix there is to make
read-locks no-ops, as they are in new formats. But that is more
discussion which needs to take place.

I'm happy to clean this up as people need me to. But it would be nice if
we could get this merged quickly. The alternative is that I think we
need to disable dirstate as the default format on win32.


John
=:->
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: simple_locking.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070319/78ada51e/attachment-0001.diff 


More information about the bazaar mailing list