~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-04-07 07:52:50 UTC
  • mfrom: (3340.1.1 208418-1.4)
  • Revision ID: pqm@pqm.ubuntu.com-20080407075250-phs53xnslo8boaeo
Return the correct knit serialisation method in _StreamAccess.
        (Andrew Bennetts, Martin Pool, Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1924
1924
            errors.KnitDataStreamUnknown,
1925
1925
            target.insert_data_stream, data_stream)
1926
1926
 
 
1927
    def test_insert_data_stream_bug_208418(self):
 
1928
        """You can insert a stream with an incompatible format, even when:
 
1929
          * the stream has a line-delta record,
 
1930
          * whose parent is in the target, also stored as a line-delta
 
1931
 
 
1932
        See <https://launchpad.net/bugs/208418>.
 
1933
        """
 
1934
        base_lines = split_lines(TEXT_1)
 
1935
        # Make the target
 
1936
        target = self.make_test_knit(name='target', annotate=True)
 
1937
        target.add_lines('version-1', [], base_lines)
 
1938
        target.add_lines('version-2', ['version-1'], base_lines + ['a\n'])
 
1939
        # The second record should be a delta.
 
1940
        self.assertEqual('line-delta', target._index.get_method('version-2'))
 
1941
        
 
1942
        # Make a source, with a different format, but the same data
 
1943
        source = self.make_test_knit(name='source', annotate=False)
 
1944
        source.add_lines('version-1', [], base_lines)
 
1945
        source.add_lines('version-2', ['version-1'], base_lines + ['a\n'])
 
1946
        # Now add another record, which should be stored as a delta against
 
1947
        # version-2.
 
1948
        source.add_lines('version-3', ['version-2'], base_lines + ['b\n'])
 
1949
        self.assertEqual('line-delta', source._index.get_method('version-3'))
 
1950
 
 
1951
        # Make a stream of the new version
 
1952
        data_stream = source.get_data_stream(['version-3'])
 
1953
        # And insert into the target
 
1954
        target.insert_data_stream(data_stream)
 
1955
        # No errors should have been raised.
 
1956
 
 
1957
 
1927
1958
    #  * test that a stream of "already present version, then new version"
1928
1959
    #    inserts correctly.
1929
1960