~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

(vila) Fix bzrlib.tests.test_gpg.TestVerify.test_verify_revoked_signature
 with recent versions of gpg. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
17
18
 
18
19
import os
19
20
 
20
21
from bzrlib.lazy_import import lazy_import
21
22
lazy_import(globals(), """
22
23
import stat
23
 
import socket
24
24
import warnings
25
25
 
26
26
from bzrlib import (
79
79
            # the common case is that we won't, though.
80
80
            st = os.fstat(self._fd)
81
81
            if stat.S_IMODE(st.st_mode) != new_mode:
82
 
                os.chmod(self.tmpfilename, new_mode)
83
 
 
84
 
    def _get_closed(self):
85
 
        symbol_versioning.warn('AtomicFile.closed deprecated in bzr 0.10',
86
 
                               DeprecationWarning, stacklevel=2)
87
 
        return self._fd is None
88
 
 
89
 
    closed = property(_get_closed)
 
82
                osutils.chmod_if_possible(self.tmpfilename, new_mode)
90
83
 
91
84
    def __repr__(self):
92
85
        return '%s(%r)' % (self.__class__.__name__,
119
112
        """Discard the file unless already committed."""
120
113
        if self._fd is not None:
121
114
            self.abort()
122
 
 
123
 
    def __del__(self):
124
 
        if self._fd is not None:
125
 
            warnings.warn("%r leaked" % self)