~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: aaron.bentley at utoronto
  • Date: 2005-08-18 02:24:28 UTC
  • mto: (1092.1.41) (1185.3.4) (974.1.47)
  • mto: This revision was merged to the branch mainline in revision 1110.
  • Revision ID: aaron.bentley@utoronto.ca-20050818022428-4c0bf84005f4dba8
mergedĀ mbp@sourcefrog.net-20050817233101-0939da1cf91f2472

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
 
175
176
    def __getitem__(self, fileid):
176
177
        """Returns a file reading from a particular entry."""
177
178
        p = self._path(fileid)
178
179
        try:
179
180
            return gzip.GzipFile(p + '.gz', 'rb')
180
181
        except IOError, e:
181
 
            if e.errno == errno.ENOENT:
182
 
                return file(p, 'rb')
183
 
            else:
184
 
                raise 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
 
185
193
 
186
194
    def total_size(self):
187
195
        """Return (count, bytes)