~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Patch Queue Manager
  • Date: 2012-07-23 17:56:45 UTC
  • mfrom: (6538.1.34 branch-store)
  • Revision ID: pqm@pqm.ubuntu.com-20120723175645-92crzj8j7bfnuglm
(abentley) switch --store stores uncommitted changes in branch (Aaron
 Bentley)

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
from __future__ import absolute_import
37
37
 
 
38
import contextlib
38
39
import errno
39
40
import os
40
41
import sys
548
549
            trace.note(gettext('{0!r} was {1} locked again'), self, type_name)
549
550
        self._prev_lock = lock_type
550
551
 
 
552
@contextlib.contextmanager
 
553
def write_locked(lockable):
 
554
    lockable.lock_write()
 
555
    try:
 
556
        yield lockable
 
557
    finally:
 
558
        lockable.unlock()