~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Martin Pool
  • Date: 2005-07-04 12:26:02 UTC
  • Revision ID: mbp@sourcefrog.net-20050704122602-69901910521e62c3
- check command checks that all inventory-ids are the same as in the revision.

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
            
91
91
        p = self._path(fileid)
92
92
        if os.access(p, os.F_OK) or os.access(p + '.gz', os.F_OK):
93
 
            from bzrlib.errors import bailout
94
93
            raise BzrError("store %r already contains id %r" % (self._basedir, fileid))
95
94
 
96
95
        fn = p
172
171
    def __len__(self):
173
172
        return len(os.listdir(self._basedir))
174
173
 
175
 
 
176
174
    def __getitem__(self, fileid):
177
175
        """Returns a file reading from a particular entry."""
178
176
        p = self._path(fileid)
179
177
        try:
180
178
            return gzip.GzipFile(p + '.gz', 'rb')
181
179
        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
 
 
 
180
            if e.errno == errno.ENOENT:
 
181
                return file(p, 'rb')
 
182
            else:
 
183
                raise e
193
184
 
194
185
    def total_size(self):
195
186
        """Return (count, bytes)