~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-07-22 23:32:00 UTC
  • Revision ID: mbp@sourcefrog.net-20050722233200-ccdeca985093a9fb
- now needs python 2.4
- update instructions for running selftest

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
    def __len__(self):
173
173
        return len(os.listdir(self._basedir))
174
174
 
175
 
 
176
175
    def __getitem__(self, fileid):
177
176
        """Returns a file reading from a particular entry."""
178
177
        p = self._path(fileid)
179
178
        try:
180
179
            return gzip.GzipFile(p + '.gz', 'rb')
181
180
        except IOError, e:
182
 
            if e.errno != errno.ENOENT:
183
 
                raise
184
 
 
185
 
        try:
186
 
            return file(p, 'rb')
187
 
        except IOError, e:
188
 
            if e.errno != errno.ENOENT:
189
 
                raise
190
 
 
191
 
        raise IndexError(fileid)
192
 
 
 
181
            if e.errno == errno.ENOENT:
 
182
                return file(p, 'rb')
 
183
            else:
 
184
                raise e
193
185
 
194
186
    def total_size(self):
195
187
        """Return (count, bytes)