[MERGE][#237067] Lock/unlock the RemoteRepository when locking/unlocking a RemoteBranch

Andrew Bennetts andrew at canonical.com
Fri Sep 5 11:49:10 BST 2008

This change mainly fixes <https://bugs.launchpad.net/bzr/+bug/237067>, which
causes ObjectNotLocked errors for simple operations like “bzr cat bzr://...”.
It essentially does this by calling self.repository.lock_read/lock_write/unlock
in RemoteBranch.lock_read/lock_write/unlock, just like normal branches do.

It also fixes a few other issues as a side-effect of tidying up the code:

  * RemoteBranch._ensure_real no longer replaces the
    RemoteRepository's _real_repository if one is already set.  This was causing
    me considerable confusion when debugging, and possibly some bugs too.
  * RemoteBranch.lock_write no longer calls _ensure_real.  Hooray!
  * test_remote.py no longer needs to monkey-patch _ensure_real (thanks to the
    previous point).
  * test_remote.py also got a small refactoring to get rid of some other
  * RemoteBranch._set_last_revision_descendant assuming that _real_branch was
    not None (which used to be basically always true due to the previous item).

Basically, various bits of cruft (and associated XXX comments) have finally been
removed from remote.py's locking logic.  I'm much much happier with the sanity
of this code now.

I also added another simple test to branch_implementations/test_locking.py that
caught a bug in an earlier version of this fix.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: objectnotlocked-3698.patch
Type: text/x-diff
Size: 28678 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080905/d16ce4d5/attachment-0001.bin 

More information about the bazaar mailing list