~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Martin
  • Date: 2011-05-21 16:29:38 UTC
  • mto: This revision was merged to the branch mainline in revision 5907.
  • Revision ID: gzlist@googlemail.com-20110521162938-1vrw3hp0197l3vrl
Add tests for non-ascii conflict serialisation

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
23
24
import warnings
24
25
 
25
26
from bzrlib import (
80
81
            if stat.S_IMODE(st.st_mode) != new_mode:
81
82
                os.chmod(self.tmpfilename, new_mode)
82
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)
 
90
 
83
91
    def __repr__(self):
84
92
        return '%s(%r)' % (self.__class__.__name__,
85
93
                           self.realfilename)
111
119
        """Discard the file unless already committed."""
112
120
        if self._fd is not None:
113
121
            self.abort()
 
122
 
 
123
    def __del__(self):
 
124
        if self._fd is not None:
 
125
            warnings.warn("%r leaked" % self)