Rev 4222: Fix empty text special case for GroupCompressor.compress(). in file:///home/vila/src/bzr/experimental/gc-py-bbc/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Mar 30 16:33:10 BST 2009


At file:///home/vila/src/bzr/experimental/gc-py-bbc/

------------------------------------------------------------
revno: 4222
revision-id: v.ladeuil+lp at free.fr-20090330153309-yvxcjee4ls8fm2xd
parent: v.ladeuil+lp at free.fr-20090330152313-2x286zoihjngnrwp
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: python-groupcompress
timestamp: Mon 2009-03-30 17:33:09 +0200
message:
  Fix empty text special case for GroupCompressor.compress().
  
  * bzrlib/tests/test_groupcompress.py:
  (TestAllGroupCompressors.test_empty_content,
  TestAllGroupCompressors.test_empty_content): Forgotten tests.
  
  * bzrlib/groupcompress.py:
  (_CommonGroupCompressor.compress): Forgotten special case.
-------------- next part --------------
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py	2009-03-30 15:23:13 +0000
+++ b/bzrlib/groupcompress.py	2009-03-30 15:33:09 +0000
@@ -593,16 +593,15 @@
         :param soft: Do a 'soft' compression. This means that we require larger
             ranges to match to be considered for a copy command.
 
-        :return: The sha1 of lines, the start and end offsets in the delta, the
-            type ('fulltext' or 'delta') and the number of bytes accumulated in
-            the group output so far.
+        :return: The sha1 of lines, the start and end offsets in the delta, and
+            the type ('fulltext' or 'delta').
 
         :seealso VersionedFiles.add_lines:
         """
         if not bytes: # empty, like a dir entry, etc
             if nostore_sha == _null_sha1:
                 raise errors.ExistingContent()
-            return _null_sha1, 0, 0, 'fulltext', 0
+            return _null_sha1, 0, 0, 'fulltext'
         # we assume someone knew what they were doing when they passed it in
         if expected_sha is not None:
             sha1 = expected_sha

=== modified file 'bzrlib/tests/test_groupcompress.py'
--- a/bzrlib/tests/test_groupcompress.py	2009-03-30 15:18:29 +0000
+++ b/bzrlib/tests/test_groupcompress.py	2009-03-30 15:33:09 +0000
@@ -83,8 +83,8 @@
     def test_empty_content(self):
         compressor = self.compressor()
         # Adding empty bytes should return the 'null' record
-        sha1, start_point, end_point, kind, _ = compressor.compress(('empty',),
-            '', None)
+        sha1, start_point, end_point, kind = compressor.compress(('empty',),
+                                                                 '', None)
         self.assertEqual(0, start_point)
         self.assertEqual(0, end_point)
         self.assertEqual('fulltext', kind)
@@ -94,8 +94,8 @@
         # Even after adding some content
         compressor.compress(('content',), 'some\nbytes\n', None)
         self.assertTrue(compressor.endpoint > 0)
-        sha1, start_point, end_point, kind, _ = compressor.compress(('empty2',),
-            '', None)
+        sha1, start_point, end_point, kind = compressor.compress(('empty2',),
+                                                                 '', None)
         self.assertEqual(0, start_point)
         self.assertEqual(0, end_point)
         self.assertEqual('fulltext', kind)



More information about the bazaar-commits mailing list