~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Robert Collins
  • Date: 2005-09-27 07:24:40 UTC
  • mfrom: (1185.1.41)
  • Revision ID: robertc@robertcollins.net-20050927072440-1bf4d99c3e1db5b3
pair programming worx... merge integration and weave

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
 
19
19
from warnings import warn
20
 
 
 
20
from osutils import rename
21
21
 
22
22
class AtomicFile(object):
23
23
    """A file that does an atomic-rename to move into place.
65
65
        self.f.close()
66
66
        self.f = None
67
67
        
68
 
        if sys.platform == 'win32':
69
 
            # windows cannot rename over an existing file
70
 
            try:
71
 
                os.remove(self.realfilename)
72
 
            except OSError, e:
73
 
                import errno
74
 
                if e.errno != errno.ENOENT:
75
 
                    raise
76
 
                
77
 
        os.rename(self.tmpfilename, self.realfilename)
 
68
        rename(self.tmpfilename, self.realfilename)
78
69
 
79
70
 
80
71
    def abort(self):