[MERGE][#144421][#144300] Use write lock in log and status with '-r branch:URL'

Robert Collins robertc at robertcollins.net
Thu Aug 28 10:29:38 BST 2008


On Sat, 2007-12-29 at 18:53 +0100, Lukáš Lalinský wrote:
> This patch replaces lock_read with lock_write in log and status if the
> 'branch:' revision specifier is used. I realize it would be probably
> better to just get rid of the implicit fetching, but I think fixing the
> lock is good enough as an interim solution.

This patch looks to be in a write direction.

I would bb:approve, though that would only get it part-approved, if:
 - there was a helper function that diff and other -r using commands
   could call that will return a read-locked, or write-locked if needed
 - the new method on RevisionSpec was unit tested

I realise that revision specs that pull is not particularly pretty, but
we made that choice some time ago as a decent approach for some
problems. Remember that back then we didn't _have_ read locks, only
write locks. Merging this patch won't make status more complex or error
prone, and we can always improve things later.

That said, teaching status to not pull data should be very straight
forward:
 - add a method to revisionspec called as_revision_tree
 - use that method in  status.py rather than as_revision_id.

(so that
            try:
                rev_id = revision[0].as_revision_id(wt.branch)
                old = wt.branch.repository.revision_tree(rev_id)
            except errors.NoSuchRevision, e:
                raise errors.BzrCommandError(str(e))
becomes
            try:
                old = revision[0].as_revision_tree()
            except errors.NoSuchRevision, e:
                raise errors.BzrCommandError(str(e))
and similarly immediately after that.

This is probably a couple of hours work, and I'm happy to offer more
advice on what tests are needed etc.

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080828/11d40ac5/attachment.pgp 


More information about the bazaar mailing list