~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockable_files.py

  • Committer: Aaron Bentley
  • Date: 2008-04-24 04:58:42 UTC
  • mfrom: (3377 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3380.
  • Revision ID: aaron@aaronbentley.com-20080424045842-0cajl9v6s4u52kaw
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
from cStringIO import StringIO
18
18
import codecs
19
19
#import traceback
 
20
from warnings import warn
20
21
 
21
22
import bzrlib
22
23
from bzrlib.decorators import (needs_read_lock,
104
105
 
105
106
    def __del__(self):
106
107
        if self.is_locked():
107
 
            # XXX: This should show something every time, and be suitable for
108
 
            # headless operation and embedding
109
 
            from warnings import warn
110
 
            warn("file group %r was not explicitly unlocked" % self)
111
 
            self._lock.unlock()
 
108
            # do not automatically unlock; there should have been a
 
109
            # try/finally to unlock this.
 
110
            warn("%r was gc'd while locked" % self)
112
111
 
113
112
    def break_lock(self):
114
113
        """Break the lock of this lockable files group if it is held.