Rev 30: Teach groupcompress about 'chunked' encoding in http://bazaar.launchpad.net/%7Ebzr/bzr-groupcompress/trunk

John Arbash Meinel john at arbash-meinel.com
Fri Feb 13 21:52:48 GMT 2009


At http://bazaar.launchpad.net/%7Ebzr/bzr-groupcompress/trunk

------------------------------------------------------------
revno: 30
revision-id: john at arbash-meinel.com-20090213215200-kewu74yjpcllrpjk
parent: john at arbash-meinel.com-20090213213246-a7tsrfs3iqrgkknf
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Fri 2009-02-13 15:52:00 -0600
message:
  Teach groupcompress about 'chunked' encoding
-------------- next part --------------
=== modified file 'groupcompress.py'
--- a/groupcompress.py	2009-02-10 22:03:24 +0000
+++ b/groupcompress.py	2009-02-13 21:52:00 +0000
@@ -27,6 +27,7 @@
     diff,
     errors,
     graph as _mod_graph,
+    osutils,
     pack,
     patiencediff,
     )
@@ -395,7 +396,7 @@
         reannotate = annotate.reannotate
         for record in self.get_record_stream(keys, 'topological', True):
             key = record.key
-            fulltext = split_lines(record.get_bytes_as('fulltext'))
+            chunks = osutils.chunks_to_lines(record.get_bytes_as('chunked'))
             parent_lines = [parent_cache[parent] for parent in parent_map[key]]
             parent_cache[key] = list(
                 reannotate(parent_lines, fulltext, key, None, head_cache))
@@ -582,15 +583,16 @@
             # Raise an error when a record is missing.
             if record.storage_kind == 'absent':
                 raise errors.RevisionNotPresent([record.key], self)
-            elif record.storage_kind == 'fulltext':
-                bytes = record.get_bytes_as('fulltext')
+            elif record.storage_kind in ('chunked', 'fulltext'):
+                lines = osutils.chunks_to_lines(record.get_bytes_as('chunked'))
             else:
                 adapter_key = record.storage_kind, 'fulltext'
                 adapter = get_adapter(adapter_key)
                 bytes = adapter.get_bytes(record,
                     record.get_bytes_as(record.storage_kind))
+                lines = osutils.split_lines(bytes)
             found_sha1, end_point = self._compressor.compress(record.key,
-                split_lines(bytes), record.sha1)
+                lines, record.sha1)
             if record.key[-1] is None:
                 key = record.key[:-1] + ('sha1:' + found_sha1,)
             else:



More information about the bazaar-commits mailing list