~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: Robert Collins
  • Date: 2005-09-30 02:54:51 UTC
  • mfrom: (1395)
  • mto: This revision was merged to the branch mainline in revision 1397.
  • Revision ID: robertc@robertcollins.net-20050930025451-47b9e412202be44b
symlink and weaves, whaddya know

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
 
17
# TODO: Could remember a bias towards whether a particular store is typically
 
18
# compressed or not.
 
19
 
17
20
"""
18
21
Stores are the main data-storage mechanism for Bazaar-NG.
19
22
 
222
225
        except OSError:
223
226
            return os.stat(p + '.gz')[ST_SIZE]
224
227
 
 
228
    # TODO: Guard against the same thing being stored twice,
 
229
    # compressed and uncompressed
 
230
 
225
231
    def __iter__(self):
226
232
        for f in os.listdir(self._basedir):
227
233
            if f[-3:] == '.gz':
318
324
        except urllib2.URLError:
319
325
            raise KeyError(fileid)
320
326
 
 
327
    def __contains__(self, fileid):
 
328
        try:
 
329
            self[fileid]
 
330
            return True
 
331
        except KeyError:
 
332
            return False
 
333
        
321
334
 
322
335
class CachedStore:
323
336
    """A store that caches data locally, to avoid repeated downloads.