Rev 4221: Simplify GroupCompressor._compress(). in file:///home/vila/src/bzr/experimental/gc-py-bbc/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Mar 30 16:23:13 BST 2009
At file:///home/vila/src/bzr/experimental/gc-py-bbc/
------------------------------------------------------------
revno: 4221
revision-id: v.ladeuil+lp at free.fr-20090330152313-2x286zoihjngnrwp
parent: v.ladeuil+lp at free.fr-20090330151829-s4dpgyurlshjvie0
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: python-groupcompress
timestamp: Mon 2009-03-30 17:23:13 +0200
message:
Simplify GroupCompressor._compress().
* bzrlib/groupcompress.py:
(_CommonGroupCompressor._compress): Don't pass nor return sha1
anymore.
(PythonGroupCompressor._compress, PyrexGroupCompressor._compress):
Simplified accordingly.
-------------- next part --------------
=== modified file 'bzrlib/groupcompress.py'
--- a/bzrlib/groupcompress.py 2009-03-30 15:18:29 +0000
+++ b/bzrlib/groupcompress.py 2009-03-30 15:23:13 +0000
@@ -614,10 +614,10 @@
if key[-1] is None:
key = key[:-1] + ('sha1:' + sha1,)
- (sha1, start, end, type) = self._compress(key, bytes, sha1, len(bytes) / 2, soft)
+ start, end, type = self._compress(key, bytes, len(bytes) / 2, soft)
return sha1, start, end, type
- def _compress(self, key, bytes, sha1, max_delta_size, soft=False):
+ def _compress(self, key, bytes, max_delta_size, soft=False):
"""Compress lines with label key.
:param key: A key tuple. It is stored in the output for identification
@@ -625,8 +625,6 @@
:param bytes: The bytes to be compressed
- :param sha1: The sha1 for 'bytes'.
-
:param max_delta_size: The size above which we issue a fulltext instead
of a delta.
@@ -710,7 +708,7 @@
# The actual content is managed by LinesDeltaIndex
self.chunks = self._delta_index.lines
- def _compress(self, key, bytes, sha1, max_delta_size, soft=False):
+ def _compress(self, key, bytes, max_delta_size, soft=False):
"""see _CommonGroupCompressor._compress"""
input_len = len(bytes)
new_lines = osutils.split_lines(bytes)
@@ -739,7 +737,7 @@
chunk_end = len(self.chunks)
self.labels_deltas[key] = (start, chunk_start,
self.endpoint, chunk_end)
- return sha1, start, self.endpoint, type
+ return start, self.endpoint, type
class PyrexGroupCompressor(_CommonGroupCompressor):
@@ -762,7 +760,7 @@
super(PyrexGroupCompressor, self).__init__()
self._delta_index = DeltaIndex()
- def _compress(self, key, bytes, sha1, max_delta_size, soft=False):
+ def _compress(self, key, bytes, max_delta_size, soft=False):
"""see _CommonGroupCompressor._compress"""
input_len = len(bytes)
# By having action/label/sha1/len, we can parse the group if the index
@@ -804,7 +802,7 @@
raise AssertionError('the delta index is out of sync'
'with the output lines %s != %s'
% (self._delta_index._source_offset, self.endpoint))
- return sha1, start, self.endpoint, type
+ return start, self.endpoint, type
def _output_chunks(self, new_chunks):
"""Output some chunks.
More information about the bazaar-commits
mailing list