branch locking mk2.
Nir Soffer
nirs at freeshell.org
Tue Feb 14 03:31:55 GMT 2006
Some more comments and questions:
INFO_NAME = '/info'
self._info_path = path + self.INFO_NAME
transport expect to get posix like path e.g foo/info?
def is_held(self):
...
Maybe use read only property instead:
def __init__(self):
self._is_held = False
is_held = property(lambda self: self._is_held)
Which will make the client code more readable:
if lock.is_held:
...
The module docstring is excellent, it misses example usage of the
locks. For example, how to create and lock, how to get a lock with
blocking etc.
Last, this is a problem I see in other places in bzr, it will be hard
to reuse this code in another project, because it uses lot of
bzrlib.stuff. For example, instead of defining LockContention and
friends in lockfile, they are defined in bzr.errors, so code that want
to reuse this code will have to either import bzr.errors, or rewrite
those errors. Same for the transport - if you want to use this code for
the file system, you have to import bzr.transport
On 13 Feb, 2006, at 16:11, Martin Pool wrote:
> OK, an implementation of this is up here:
>
> http://people.ubuntu.com/~mbp/bzr.mbp.locks/
>
> Sadly this does not pass the tests yet because some of them attempt to
> take locks that are already held - a problem which is normally hidden
> on
> unix. (Making it consistent across platforms and transports is an
> advantage of doing it with lock directories, I think.)
>
> If anyone would like to look over lockfile.py and test_lockfile.py
> (attached) that'd be great.
>
> --
> Martin
> <test_lockfile.py><lockfile.py>
Best Regards,
Nir Soffer
More information about the bazaar
mailing list