~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/store.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-24 00:44:18 UTC
  • Revision ID: mbp@sourcefrog.net-20050324004418-b4a050f656c07f5f
show space usage for various stores in the info command

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
__author__ = "Martin Pool <mbp@canonical.com>"
25
25
 
26
26
import os, tempfile, types, osutils
 
27
from stat import ST_SIZE
27
28
from StringIO import StringIO
28
29
from trace import mutter
29
30
 
117
118
        """Returns a file reading from a particular entry."""
118
119
        return file(self._path(fileid), 'rb')
119
120
 
 
121
    def total_size(self):
 
122
        """Return (count, bytes)"""
 
123
        total = 0
 
124
        count = 0
 
125
        for fid in self:
 
126
            count += 1
 
127
            total += os.stat(self._path(fid))[ST_SIZE]
 
128
        return count, total
 
129
 
120
130
    def delete_all(self):
121
131
        for fileid in self:
122
132
            self.delete(fileid)