~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-29 01:26:19 UTC
  • Revision ID: mbp@sourcefrog.net-20050329012619-dd8959fc63b3a074
- fixup checks on retrieved files to cope with compression,
  and have less checks now there's a check command again

- move code to destroy stores into the ScratchStore subclass

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
                
156
156
        return count, total
157
157
 
158
 
    def delete_all(self):
159
 
        for fileid in self:
160
 
            self.delete(fileid)
161
 
 
162
 
    def delete(self, fileid):
163
 
        """Remove nominated store entry.
164
 
 
165
 
        Most stores will be add-only."""
166
 
        filename = self._path(fileid)
167
 
        ## osutils.make_writable(filename)
168
 
        ## TODO: handle gzip
169
 
        os.remove(filename)
170
 
 
171
 
    def destroy(self):
172
 
        """Remove store; only allowed if it is empty."""
173
 
        os.rmdir(self._basedir)
174
 
        mutter("%r destroyed" % self)
175
158
 
176
159
 
177
160
 
185
168
        ImmutableStore.__init__(self, tempfile.mkdtemp())
186
169
 
187
170
    def __del__(self):
188
 
        self.delete_all()
189
 
        self.destroy()
 
171
        for f in os.listdir(self._basedir):
 
172
            os.remove(os.path.join(self._basedir, f))
 
173
        os.rmdir(self._basedir)
 
174
        mutter("%r destroyed" % self)