[Pkg-bazaar-commits] ./bzr/unstable r127: - store support for retrieving compressed files

mbp at sourcefrog.net mbp at sourcefrog.net
Fri Apr 10 07:51:11 UTC 2009


------------------------------------------------------------
revno: 127
committer: mbp at sourcefrog.net
timestamp: Tue 2005-03-29 10:43:48 +1000
message:
  - store support for retrieving compressed files
modified:
  bzrlib/store.py
  notes/performance.txt
-------------- next part --------------
=== modified file 'bzrlib/store.py'
--- a/bzrlib/store.py	2005-03-25 03:28:33 +0000
+++ b/bzrlib/store.py	2005-03-29 00:43:48 +0000
@@ -23,12 +23,11 @@
 __copyright__ = "Copyright (C) 2005 Canonical Ltd."
 __author__ = "Martin Pool <mbp at canonical.com>"
 
-import os, tempfile, types, osutils
+import os, tempfile, types, osutils, gzip, errno
 from stat import ST_SIZE
 from StringIO import StringIO
 from trace import mutter
 
-
 ######################################################################
 # stores
 
@@ -116,10 +115,20 @@
 
     def __getitem__(self, fileid):
         """Returns a file reading from a particular entry."""
-        return file(self._path(fileid), 'rb')
+        p = self._path(fileid)
+        try:
+            return gzip.GzipFile(p + '.gz', 'rb')
+        except IOError, e:
+            if e.errno == errno.ENOENT:
+                return file(p, 'rb')
+            else:
+                raise e
 
     def total_size(self):
-        """Return (count, bytes)"""
+        """Return (count, bytes)
+
+        This is the (compressed) size stored on disk, not the size of
+        the content."""
         total = 0
         count = 0
         for fid in self:

=== modified file 'notes/performance.txt'
--- a/notes/performance.txt	2005-03-25 08:21:20 +0000
+++ b/notes/performance.txt	2005-03-29 00:43:48 +0000
@@ -269,4 +269,12 @@
  2969 files changed, 372168 insertions(+), 153284 deletions(-)
 
 I wonder why it is not exactly the same?  Maybe because the python
-diff algorithm is a bit differnt to GNU diff.
\ No newline at end of file
+diff algorithm is a bit differnt to GNU diff.
+
+----
+
+2005-03-29  
+
+full check, retrieving all file texts once for the 2.4 kernel branch
+takes 10m elapsed, 1m cpu time.  lots of random IO and seeking.
+



More information about the Pkg-bazaar-commits mailing list