~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Martin Pool
  • Date: 2005-05-12 02:18:48 UTC
  • Revision ID: mbp@sourcefrog.net-20050512021848-d1a727373aee2c85
- WorkingTree loads statcache in constructor and holds
  it permanently

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        self.closed = property(self.f.closed)
47
47
 
48
48
    def commit(self):
49
 
        """Close the file and move to final name."""
50
49
        import sys, os
51
50
        
52
51
        self.f.close()
55
54
        os.rename(self.tmpfilename, self.realfilename)
56
55
 
57
56
    def abort(self):
58
 
        """Discard temporary file without committing changes."""
59
57
        import os
60
58
        self.f.close()
61
59
        os.remove(self.tmpfilename)
62
 
 
63
 
    def close(self):
64
 
        """Discard the file unless already committed."""
65
 
        if not self.closed:
66
 
            self.abort()
67
60
        
68
61