/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/per_versionedfile.py

  • Committer: Jelmer Vernooij
  • Date: 2020-01-30 17:54:42 UTC
  • mto: This revision was merged to the branch mainline in revision 7473.
  • Revision ID: jelmer@jelmer.uk-20200130175442-82mohr4ji3o3mh48
Add VersionedFiles.add_content.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
from ..transport.memory import MemoryTransport
60
60
from ..bzr import versionedfile as versionedfile
61
61
from ..bzr.versionedfile import (
 
62
    ChunkedContentFactory,
62
63
    ConstantMapper,
63
64
    HashEscapedPrefixMapper,
64
65
    PrefixMapper,
1546
1547
        key1 = self.get_simple_key(b'r1')
1547
1548
        key2 = self.get_simple_key(b'r2')
1548
1549
        keyf = self.get_simple_key(b'foo')
1549
 
        f.add_chunks(key0, [], [b'a', b'\nb\n'])
 
1550
        def add_chunks(key, parents, chunks):
 
1551
            factory = ChunkedContentFactory(
 
1552
                key, parents, osutils.sha_strings(chunks), chunks)
 
1553
            return f.add_content(factory)
 
1554
 
 
1555
        add_chunks(key0, [], [b'a', b'\nb\n'])
1550
1556
        if self.graph:
1551
 
            f.add_chunks(key1, [key0], [b'b', b'\n', b'c\n'])
 
1557
            add_chunks(key1, [key0], [b'b', b'\n', b'c\n'])
1552
1558
        else:
1553
 
            f.add_chunks(key1, [], [b'b\n', b'c\n'])
 
1559
            add_chunks(key1, [], [b'b\n', b'c\n'])
1554
1560
        keys = f.keys()
1555
1561
        self.assertIn(key0, keys)
1556
1562
        self.assertIn(key1, keys)