[Pkg-bazaar-commits] ./bzr/unstable r208: show compression ratio
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:44:01 UTC 2009
------------------------------------------------------------
revno: 208
committer: mbp at sourcefrog.net
timestamp: Sat 2005-04-09 15:09:10 +1000
message:
show compression ratio
modified:
bzrlib/revfile.py
-------------- next part --------------
=== modified file 'bzrlib/revfile.py'
--- a/bzrlib/revfile.py 2005-04-09 05:06:36 +0000
+++ b/bzrlib/revfile.py 2005-04-09 05:09:10 +0000
@@ -178,13 +178,17 @@
This does the compression if that makes sense."""
flags = 0
- if len(data) > 50:
+ data_len = len(data)
+ if data_len > 50:
# don't do compression if it's too small; it's unlikely to win
# enough to be worthwhile
compr_data = zlib.compress(data)
- if len(compr_data) < len(data):
+ compr_len = len(compr_data)
+ if compr_len < data_len:
data = compr_data
flags = FL_GZIP
+ print '- compressed %d -> %d, %.1f%%' \
+ % (data_len, compr_len, float(compr_len)/float(data_len) * 100.0)
idx = len(self)
self.datafile.seek(0, 2) # to end
More information about the Pkg-bazaar-commits
mailing list