~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-05-11 11:47:36 UTC
  • mfrom: (5200.3.8 lock_return)
  • Revision ID: pqm@pqm.ubuntu.com-20100511114736-mc1sq9zyo3vufec7
(lifeless) Provide a consistent interface to Tree, Branch,
 Repository where lock methods return an object with an unlock method to
 unlock the lock. This breaks the API for Branch,
 Repository on their lock_write methods. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
292
292
        if repo_token == '':
293
293
            repo_token = None
294
294
        try:
295
 
            repo_token = branch.repository.lock_write(token=repo_token)
 
295
            repo_token = branch.repository.lock_write(
 
296
                token=repo_token).repository_token
296
297
            try:
297
 
                branch_token = branch.lock_write(token=branch_token)
 
298
                branch_token = branch.lock_write(
 
299
                    token=branch_token).branch_token
298
300
            finally:
299
301
                # this leaves the repository with 1 lock
300
302
                branch.repository.unlock()