~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Patch Queue Manager
  • Date: 2011-10-14 16:54:26 UTC
  • mfrom: (6216.1.1 remove-this-file)
  • Revision ID: pqm@pqm.ubuntu.com-20111014165426-tjix4e6idryf1r2z
(jelmer) Remove an accidentally committed .THIS file. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2008, 2009, 2010 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
16
16
 
17
17
 
18
18
import os
19
 
import sys
20
19
 
21
20
from bzrlib.lazy_import import lazy_import
22
21
lazy_import(globals(), """
23
22
import stat
24
 
import socket
25
23
import warnings
26
24
 
27
25
from bzrlib import (
60
58
 
61
59
        self.realfilename = filename
62
60
 
63
 
        flags = os.O_EXCL | os.O_CREAT | os.O_WRONLY
 
61
        flags = os.O_EXCL | os.O_CREAT | os.O_WRONLY | osutils.O_NOINHERIT
64
62
        if mode == 'wb':
65
63
            flags |= osutils.O_BINARY
66
64
        elif mode != 'wt':
82
80
            if stat.S_IMODE(st.st_mode) != new_mode:
83
81
                os.chmod(self.tmpfilename, new_mode)
84
82
 
85
 
    def _get_closed(self):
86
 
        symbol_versioning.warn('AtomicFile.closed deprecated in bzr 0.10',
87
 
                               DeprecationWarning, stacklevel=2)
88
 
        return self._fd is None
89
 
 
90
 
    closed = property(_get_closed)
91
 
 
92
83
    def __repr__(self):
93
84
        return '%s(%r)' % (self.__class__.__name__,
94
85
                           self.realfilename)
120
111
        """Discard the file unless already committed."""
121
112
        if self._fd is not None:
122
113
            self.abort()
123
 
 
124
 
    def __del__(self):
125
 
        if self._fd is not None:
126
 
            warnings.warn("%r leaked" % self)