~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Aaron Bentley
  • Date: 2012-07-13 19:32:33 UTC
  • mto: This revision was merged to the branch mainline in revision 6540.
  • Revision ID: aaron@aaronbentley.com-20120713193233-l6y0l0twwhd3wmka
Switch to much simpler implementation of restore_uncommitted.

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()