~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-08-15 01:08:19 UTC
  • mfrom: (2520.4.154 bzr.mpbundle)
  • Revision ID: pqm@pqm.ubuntu.com-20070815010819-0q50hsyvbvu1qs3k
Speed up installing revisions from Bundle 4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1250
1250
        new_text = self.get_raw(StringIO(''.join(bundle_txt)))
1251
1251
        new_text = new_text.replace('<file file_id="exe-1"',
1252
1252
                                    '<file executable="y" file_id="exe-1"')
1253
 
        new_text = new_text.replace('B372', 'B387')
 
1253
        new_text = new_text.replace('B222', 'B237')
1254
1254
        bundle_txt = StringIO()
1255
1255
        bundle_txt.write(serializer._get_bundle_header('4'))
1256
1256
        bundle_txt.write('\n')
1459
1459
            'storage_kind':'fulltext'}, 'file', 'revid', 'fileid')
1460
1460
        writer.end()
1461
1461
        fileobj.seek(0)
1462
 
        record_iter = v4.BundleReader(fileobj).iter_records()
 
1462
        reader = v4.BundleReader(fileobj, stream_input=True)
 
1463
        record_iter = reader.iter_records()
 
1464
        record = record_iter.next()
 
1465
        self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
 
1466
            'info', None, None), record)
 
1467
        record = record_iter.next()
 
1468
        self.assertEqual(("Record body", {'storage_kind': 'fulltext',
 
1469
                          'parents': ['1', '3']}, 'file', 'revid', 'fileid'),
 
1470
                          record)
 
1471
 
 
1472
    def test_roundtrip_record_memory_hungry(self):
 
1473
        fileobj = StringIO()
 
1474
        writer = v4.BundleWriter(fileobj)
 
1475
        writer.begin()
 
1476
        writer.add_info_record(foo='bar')
 
1477
        writer._add_record("Record body", {'parents': ['1', '3'],
 
1478
            'storage_kind':'fulltext'}, 'file', 'revid', 'fileid')
 
1479
        writer.end()
 
1480
        fileobj.seek(0)
 
1481
        reader = v4.BundleReader(fileobj, stream_input=False)
 
1482
        record_iter = reader.iter_records()
1463
1483
        record = record_iter.next()
1464
1484
        self.assertEqual((None, {'foo': 'bar', 'storage_kind': 'header'},
1465
1485
            'info', None, None), record)