/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Jelmer Vernooij
  • Date: 2017-02-05 17:00:29 UTC
  • mto: (6621.2.1 py3)
  • mto: This revision was merged to the branch mainline in revision 6624.
  • Revision ID: jelmer@jelmer.uk-20170205170029-s01xdro0hkixhq3r
Convert some octal numbers to new notations.

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 (
68
68
        if new_mode is not None:
69
69
            local_mode = new_mode
70
70
        else:
71
 
            local_mode = 0666
 
71
            local_mode = 0o666
72
72
 
73
73
        # Use a low level fd operation to avoid chmodding later.
74
74
        # This may not succeed, but it should help most of the time
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)