~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/__init__.py

  • Committer: Robert Collins
  • Date: 2005-10-17 00:11:49 UTC
  • mto: This revision was merged to the branch mainline in revision 1459.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051017001149-fe23a449de1385f7
test get with suffixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    def __len__(self):
53
53
        raise NotImplementedError('Children should define their length')
54
54
 
55
 
    def get(self, file_id):
56
 
        """Returns a file reading from a particular entry."""
 
55
    def get(self, file_id, suffix=None):
 
56
        """Returns a file reading from a particular entry.
 
57
        
 
58
        If suffix is present, retrieve the named suffix for file_id.
 
59
        """
 
60
        raise NotImplementedError
57
61
 
58
62
    def __getitem__(self, fileid):
59
63
        """DEPRECATED. Please use .get(file_id) instead."""
220
224
        """
221
225
        raise NotImplementedError
222
226
 
223
 
    def get(self, fileid):
224
 
        """Returns a file reading from a particular entry."""
225
 
        fn = self._relpath(fileid)
 
227
    def get(self, fileid, suffix=None):
 
228
        """See Store.get()."""
 
229
        if suffix is None:
 
230
            fn = self._relpath(fileid)
 
231
        else:
 
232
            fn = self._relpath(fileid, [suffix])
226
233
        try:
227
234
            return self._get(fn)
228
235
        except errors.NoSuchFile:
236
243
        self._suffixes = set()
237
244
 
238
245
    def __len__(self):
239
 
        return len(list(self._iter_relpath()))
 
246
        return len(list(self.__iter__()))
240
247
 
241
248
    def _relpath(self, fileid, suffixes=[]):
242
249
        self._check_fileid(fileid)