~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_lockable_files.py

Implement RemoteBranch.lock_write/unlock as smart operations.

Because Branch.lock_write/unlock actually also lock/unlock the repository, I've
slightly changed lock_write's interface to accept and return 'tokens' rather
than 'token'.  i.e. a 2-tuple of (branch token, repo token), or None.

Show diffs side-by-side

added added

removed removed

Lines of Context:
239
239
                # tokens.
240
240
                return
241
241
            # Relock with a token.
242
 
            self.lockable.lock_write(token=token)
243
 
            self.lockable.unlock()
 
242
            token_from_reentry = self.lockable.lock_write(token=token)
 
243
            try:
 
244
                self.assertEqual(token, token_from_reentry)
 
245
            finally:
 
246
                self.lockable.unlock()
244
247
        finally:
245
248
            self.lockable.unlock()
246
249
        # The lock should be unlocked on disk.  Verify that with a new lock