~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store/text.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:
29
29
from bzrlib.errors import BzrError
30
30
 
31
31
from cStringIO import StringIO
32
 
from stat import ST_SIZE
33
32
 
34
33
 
35
34
class TextStore(bzrlib.store.TransportStore):
66
65
    def __len__(self):
67
66
        return len(list(self._iter_relpath()))
68
67
 
69
 
    def total_size(self):
70
 
        """Return (count, bytes)
71
 
 
72
 
        This is the (compressed) size stored on disk, not the size of
73
 
        the content."""
74
 
        total = 0
75
 
        count = 0
76
 
        for relpath, st in self._iter_relpaths():
77
 
            count += 1
78
 
            total += st[ST_SIZE]
79
 
                
80
 
        return count, total
81
 
 
82
68
 
83
69
class ScratchTextStore(TextStore):
84
70
    """Self-destructing test subclass of TextStore.