Rev 3213: Change RemoteRepository.get_parent_map to use bz2 not gzip for compression. in http://people.ubuntu.com/~robertc/baz2.0/get_parents.duplicates
Robert Collins
robertc at robertcollins.net
Tue Feb 5 22:08:02 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/get_parents.duplicates
------------------------------------------------------------
revno: 3213
revision-id:robertc at robertcollins.net-20080205220757-p2j8klf0hwhzaim4
parent: robertc at robertcollins.net-20080203225508-0rogbg0ggonuqfhp
committer: Robert Collins <robertc at robertcollins.net>
branch nick: get_parents.duplicates
timestamp: Wed 2008-02-06 09:07:57 +1100
message:
Change RemoteRepository.get_parent_map to use bz2 not gzip for compression.
modified:
bzrlib/remote.py remote.py-20060720103555-yeeg2x51vn0rbtdp-1
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
bzrlib/tests/test_remote.py test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
bzrlib/tests/test_smart.py test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py 2008-02-03 22:55:08 +0000
+++ b/bzrlib/remote.py 2008-02-05 22:07:57 +0000
@@ -17,6 +17,7 @@
# TODO: At some point, handle upgrades by just passing the whole request
# across to run on the server.
+import bz2
from cStringIO import StringIO
from bzrlib import (
@@ -42,7 +43,6 @@
)
from bzrlib.revision import NULL_REVISION
from bzrlib.trace import mutter, note
-from bzrlib.tuned_gzip import GzipFile
# Note: RemoteBzrDirFormat is in bzrdir.py
@@ -854,8 +854,7 @@
reponse[1].cancel_read_body()
raise errors.UnexpectedSmartServerResponse(response[0])
if response[0][0] == 'ok':
- coded = GzipFile(mode='rb',
- fileobj=StringIO(response[1].read_body_bytes())).read()
+ coded = bz2.decompress(response[1].read_body_bytes())
if coded == '':
# no revisions found
return {}
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2008-02-03 22:55:08 +0000
+++ b/bzrlib/smart/repository.py 2008-02-05 22:07:57 +0000
@@ -16,6 +16,7 @@
"""Server-side repository related request implmentations."""
+import bz2
from cStringIO import StringIO
import os
import sys
@@ -31,7 +32,6 @@
SuccessfulSmartServerResponse,
)
from bzrlib import revision as _mod_revision
-from bzrlib.tuned_gzip import GzipFile, bytes_to_gzip
class SmartServerRepositoryRequest(SmartServerRequest):
@@ -169,7 +169,7 @@
lines.append(' '.join((revision, ) + tuple(parents)))
return SuccessfulSmartServerResponse(
- ('ok', ), bytes_to_gzip('\n'.join(lines)))
+ ('ok', ), bz2.compress('\n'.join(lines)))
class SmartServerRepositoryGetRevisionGraph(SmartServerRepositoryRequest):
=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py 2008-02-03 22:55:08 +0000
+++ b/bzrlib/tests/test_remote.py 2008-02-05 22:07:57 +0000
@@ -23,6 +23,7 @@
These tests correspond to tests.test_smart, which exercises the server side.
"""
+import bz2
from cStringIO import StringIO
from bzrlib import (
@@ -46,7 +47,6 @@
from bzrlib.smart.client import _SmartClient
from bzrlib.transport.memory import MemoryTransport
from bzrlib.transport.remote import RemoteTransport
-from bzrlib.tuned_gzip import bytes_to_gzip
class BasicRemoteObjectTests(tests.TestCaseWithTransport):
@@ -609,7 +609,7 @@
r1 = u'\u0e33'.encode('utf8')
r2 = u'\u0dab'.encode('utf8')
lines = [' '.join([r2, r1]), r1]
- encoded_body = bytes_to_gzip('\n'.join(lines))
+ encoded_body = bz2.compress('\n'.join(lines))
responses = [(('ok', ), encoded_body), (('ok', ), encoded_body)]
transport_path = 'quack'
=== modified file 'bzrlib/tests/test_smart.py'
--- a/bzrlib/tests/test_smart.py 2008-02-03 22:55:08 +0000
+++ b/bzrlib/tests/test_smart.py 2008-02-05 22:07:57 +0000
@@ -24,6 +24,7 @@
Tests for low-level protocol encoding are found in test_smart_transport.
"""
+import bz2
from StringIO import StringIO
import tempfile
import tarfile
@@ -37,7 +38,6 @@
import bzrlib.smart.bzrdir
import bzrlib.smart.branch
import bzrlib.smart.repository
-from bzrlib.tuned_gzip import bytes_to_gzip
from bzrlib.util import bencode
@@ -542,7 +542,7 @@
request.execute(backing.local_abspath(''), 'missing-id'))
# Note that it returns a body (of '' gzipped).
self.assertEqual(
- SuccessfulSmartServerResponse(('ok', ), bytes_to_gzip('')),
+ SuccessfulSmartServerResponse(('ok', ), bz2.compress('')),
request.do_body('\n\n0\n'))
More information about the bazaar-commits
mailing list