~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    trace,
47
47
    )
48
48
from bzrlib.hooks import Hooks
49
 
from bzrlib.i18n import gettext
 
49
 
50
50
 
51
51
class LockHooks(Hooks):
52
52
 
171
171
            self.f.close()
172
172
            self.f = None
173
173
 
 
174
    def __del__(self):
 
175
        if self.f:
 
176
            from warnings import warn
 
177
            warn("lock on %r not released" % self.f)
 
178
            self.unlock()
 
179
 
174
180
    def unlock(self):
175
181
        raise NotImplementedError()
176
182
 
535
541
    locked the same way), and -Drelock is set, then this will trace.note a
536
542
    message about it.
537
543
    """
538
 
 
 
544
    
539
545
    _prev_lock = None
540
546
 
541
547
    def _note_lock(self, lock_type):
544
550
                type_name = 'read'
545
551
            else:
546
552
                type_name = 'write'
547
 
            trace.note(gettext('{0!r} was {1} locked again'), self, type_name)
 
553
            trace.note('%r was %s locked again', self, type_name)
548
554
        self._prev_lock = lock_type
549
555