~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

Merge the _LazyGroupContentManager, et al.

This allows us to stream GroupCompressBlocks in their compressed form, and unpack them
during insert, rather than during get().

Show diffs side-by-side

added added

removed removed

Lines of Context:
1663
1663
             'knit-ft', 'knit-delta', 'chunked', 'fulltext',
1664
1664
             'knit-annotated-ft-gz', 'knit-annotated-delta-gz', 'knit-ft-gz',
1665
1665
             'knit-delta-gz',
1666
 
             'knit-delta-closure', 'knit-delta-closure-ref'])
 
1666
             'knit-delta-closure', 'knit-delta-closure-ref',
 
1667
             'groupcompress-block', 'groupcompress-block-ref'])
1667
1668
 
1668
1669
    def capture_stream(self, f, entries, on_seen, parents):
1669
1670
        """Capture a stream for testing."""
1670
1671
        for factory in entries:
1671
1672
            on_seen(factory.key)
1672
1673
            self.assertValidStorageKind(factory.storage_kind)
1673
 
            self.assertEqual(f.get_sha1s([factory.key])[factory.key],
1674
 
                factory.sha1)
 
1674
            if factory.sha1 is not None:
 
1675
                self.assertEqual(f.get_sha1s([factory.key])[factory.key],
 
1676
                    factory.sha1)
1675
1677
            self.assertEqual(parents[factory.key], factory.parents)
1676
1678
            self.assertIsInstance(factory.get_bytes_as(factory.storage_kind),
1677
1679
                str)
1814
1816
        for factory in entries:
1815
1817
            seen.add(factory.key)
1816
1818
            self.assertValidStorageKind(factory.storage_kind)
1817
 
            self.assertEqual(files.get_sha1s([factory.key])[factory.key],
1818
 
                factory.sha1)
 
1819
            if factory.sha1 is not None:
 
1820
                self.assertEqual(files.get_sha1s([factory.key])[factory.key],
 
1821
                                 factory.sha1)
1819
1822
            self.assertEqual(parent_map[factory.key], factory.parents)
1820
1823
            # currently no stream emits mpdiff
1821
1824
            self.assertRaises(errors.UnavailableRepresentation,
2019
2022
                self.assertEqual(None, factory.parents)
2020
2023
            else:
2021
2024
                self.assertValidStorageKind(factory.storage_kind)
2022
 
                self.assertEqual(files.get_sha1s([factory.key])[factory.key],
2023
 
                    factory.sha1)
 
2025
                if factory.sha1 is not None:
 
2026
                    sha1 = files.get_sha1s([factory.key])[factory.key]
 
2027
                    self.assertEqual(sha1, factory.sha1)
2024
2028
                self.assertEqual(parents[factory.key], factory.parents)
2025
2029
                self.assertIsInstance(factory.get_bytes_as(factory.storage_kind),
2026
2030
                    str)