~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-16 19:18:39 UTC
  • mto: This revision was merged to the branch mainline in revision 6391.
  • Revision ID: jelmer@samba.org-20111216191839-eg681lxqibi1qxu1
Fix remaining tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib.lazy_import import lazy_import
21
21
lazy_import(globals(), """
22
22
import stat
23
 
import socket
24
23
import warnings
25
24
 
26
25
from bzrlib import (
79
78
            # the common case is that we won't, though.
80
79
            st = os.fstat(self._fd)
81
80
            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)
 
81
                osutils.chmod_if_possible(self.tmpfilename, new_mode)
90
82
 
91
83
    def __repr__(self):
92
84
        return '%s(%r)' % (self.__class__.__name__,
119
111
        """Discard the file unless already committed."""
120
112
        if self._fd is not None:
121
113
            self.abort()
122
 
 
123
 
    def __del__(self):
124
 
        if self._fd is not None:
125
 
            warnings.warn("%r leaked" % self)