Rev 6277: (mbp) remove dead code for lzma compression (Martin Pool) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Nov 18 05:41:49 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6277 [merge]
revision-id: pqm at pqm.ubuntu.com-20111118054148-blm76siz9s4y51dw
parent: pqm at pqm.ubuntu.com-20111117195038-1e3ypqmovs2bjhtp
parent: mbp at canonical.com-20111118051319-9cj53bg5e06zl7rw
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-11-18 05:41:48 +0000
message:
  (mbp) remove dead code for lzma compression (Martin Pool)
modified:
  bzrlib/groupcompress.py        groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
  bzrlib/tests/blackbox/test_export.py test_export.py-20051229024010-e6c26658e460fb1c
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py	2011-09-15 11:31:47 +0000
+++ b/bzrlib/groupcompress.py	2011-11-18 05:13:19 +0000
@@ -18,10 +18,6 @@
 
 import time
 import zlib
-try:
-    import pylzma
-except ImportError:
-    pylzma = None
 
 from bzrlib.lazy_import import lazy_import
 lazy_import(globals(), """
@@ -57,8 +53,6 @@
 # groupcompress blocks.
 BATCH_SIZE = 2**16
 
-_USE_LZMA = False and (pylzma is not None)
-
 # osutils.sha_string('')
 _null_sha1 = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
 
@@ -153,6 +147,7 @@
                 self._content = ''
             elif self._compressor_name == 'lzma':
                 # We don't do partial lzma decomp yet
+                import pylzma
                 self._content = pylzma.decompress(z_content)
             elif self._compressor_name == 'zlib':
                 # Start a zlib decompressor
@@ -299,16 +294,6 @@
         self._content = content
         self._z_content_chunks = None
 
-    def _create_z_content_using_lzma(self):
-        if self._content_chunks is not None:
-            self._content = ''.join(self._content_chunks)
-            self._content_chunks = None
-        if self._content is None:
-            raise AssertionError('Nothing to compress')
-        z_content = pylzma.compress(self._content)
-        self._z_content_chunks = (z_content,)
-        self._z_content_length = len(z_content)
-
     def _create_z_content_from_chunks(self, chunks):
         compressor = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION)
         # Peak in this point is 1 fulltext, 1 compressed text, + zlib overhead
@@ -322,9 +307,6 @@
     def _create_z_content(self):
         if self._z_content_chunks is not None:
             return
-        if _USE_LZMA:
-            self._create_z_content_using_lzma()
-            return
         if self._content_chunks is not None:
             chunks = self._content_chunks
         else:
@@ -334,10 +316,7 @@
     def to_chunks(self):
         """Create the byte stream as a series of 'chunks'"""
         self._create_z_content()
-        if _USE_LZMA:
-            header = self.GCB_LZ_HEADER
-        else:
-            header = self.GCB_HEADER
+        header = self.GCB_HEADER
         chunks = ['%s%d\n%d\n'
                   % (header, self._z_content_length, self._content_length),
                  ]

=== modified file 'bzrlib/tests/blackbox/test_export.py'
--- a/bzrlib/tests/blackbox/test_export.py	2011-07-08 23:01:39 +0000
+++ b/bzrlib/tests/blackbox/test_export.py	2011-11-14 05:48:28 +0000
@@ -194,8 +194,6 @@
     def test_tbz2_export(self):
         self.run_tar_export_disk_and_stdout('tbz2', 'bz2')
 
-    # TODO: test_xz_export, I don't have pylzma working here to test it.
-
     def test_zip_export_unicode(self):
         self.requireFeature(features.UnicodeFilenameFeature)
         tree = self.make_branch_and_tree('zip')




More information about the bazaar-commits mailing list