~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Aaron Bentley
  • Date: 2005-10-04 04:32:32 UTC
  • mfrom: (1185.12.6)
  • mto: (1185.12.13)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: aaron.bentley@utoronto.ca-20051004043231-40302a149769263b
merged my own changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from warnings import warn
20
20
from osutils import rename
21
 
import errno
22
21
 
23
22
class AtomicFile(object):
24
23
    """A file that does an atomic-rename to move into place.
66
65
        self.f.close()
67
66
        self.f = None
68
67
        
69
 
        try:
70
 
            stat = os.lstat(self.realfilename)
71
 
            os.chmod(self.tmpfilename, stat.st_mode)
72
 
        except OSError, e:
73
 
            if e.errno != errno.ENOENT:
74
 
                raise
75
68
        rename(self.tmpfilename, self.realfilename)
76
69
 
77
70