~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-16 08:23:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1459.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051016082322-b0ee714c30d084e6
pull up total_size into TransportStore

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
"""
26
26
 
27
27
from cStringIO import StringIO
28
 
from stat import ST_MODE, S_ISDIR
 
28
from stat import ST_MODE, S_ISDIR, ST_SIZE
29
29
from zlib import adler32
30
30
 
31
31
import bzrlib.errors as errors
270
270
        """Return True if this store is able to be listed."""
271
271
        return self._transport.listable()
272
272
 
 
273
    def total_size(self):
 
274
        """Return (count, bytes)
 
275
 
 
276
        This is the (compressed) size stored on disk, not the size of
 
277
        the content."""
 
278
        total = 0
 
279
        count = 0
 
280
        for relpath, st in self._iter_relpaths():
 
281
            count += 1
 
282
            total += st[ST_SIZE]
 
283
                
 
284
        return count, total
 
285
 
273
286
 
274
287
class ImmutableMemoryStore(Store):
275
288
    """A memory only store."""