[rfc] removing LockableFiles

Martin Pool mbp at sourcefrog.net
Fri Jul 6 10:01:45 BST 2007


I have had another code cleanup on the back burner for a while and
thought I would float a preview of what I want to do.

This follows on from the CountedLock patch back in May.

At the moment we have a class called LockableFiles.  Most
implementations of Branch, Repository and WorkingTree hold a reference
to one of these in a .control_files member.  I think LockableFiles
ties together several things in a way that is not particularly useful
or helpful, and that makes other changes harder.  It's functions are:

 * passing file operations through to a transport - would be simpler
to just have the component talk to the transport directly, and that
would allow it to use a richer interface and make it clearer

 * setting default permissions on newly created files, so that
everything in the control directory has the same permissions - could
be more easily and perhaps more efficiently done in the transport
layer.

 * passing lock operations through to a lock - would be simpler to
just have the transport talk to a lock

 * keeping a use count on underlying locks - can be separated out to CountedLock

 * maintaining transactions tied to locking and unlocking - probably
better done through a lock enhancement akin to countedlock

 * also the .control_files member is an implementation detail of the
component and shouldn't be public

Most of these are decoupled from each other - the locking operations
don't have any effect on the transport operations, as I think was
originally intended by this class.  I don't think it's adding any
value as a facade either.

So I propose to change things so that Branch, WorkingTree, Repository
components just have a _transport and a _lock, and then to delete this
class.

-- 
Martin



More information about the bazaar mailing list