~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_versionedfile.py

  • Committer: Robert Collins
  • Date: 2007-07-25 00:52:21 UTC
  • mfrom: (2650 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2651.
  • Revision ID: robertc@robertcollins.net-20070725005221-0ysm6il5mqnme3wz
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
247
247
        self.assertEqual(['line'], f.get_lines('eolbeforefirstparent'))
248
248
        #self.assertTrue(deltas['eolbeforefirstparent'] in expected_deltas)
249
249
 
 
250
    def test_make_mpdiffs(self):
 
251
        from bzrlib import multiparent
 
252
        vf = self.get_file('foo')
 
253
        sha1s = self._setup_for_deltas(vf)
 
254
        new_vf = self.get_file('bar')
 
255
        for version in multiparent.topo_iter(vf):
 
256
            mpdiff = vf.make_mpdiffs([version])[0]
 
257
            new_vf.add_mpdiffs([(version, vf.get_parents(version),
 
258
                                 vf.get_sha1(version), mpdiff)])
 
259
            self.assertEqualDiff(vf.get_text(version),
 
260
                                 new_vf.get_text(version))
 
261
 
250
262
    def _setup_for_deltas(self, f):
251
263
        self.assertRaises(errors.RevisionNotPresent, f.get_delta, 'base')
252
264
        # add texts that should trip the knit maximum delta chain threshold
807
819
            '3f786850e387550fdab836ed7e6dc881de23001b', vf.get_sha1('b'))
808
820
        self.assertEqual(
809
821
            '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8', vf.get_sha1('c'))
 
822
 
 
823
        self.assertEqual(['3f786850e387550fdab836ed7e6dc881de23001b',
 
824
                          '86f7e437faa5a7fce15d1ddcb9eaeaea377667b8',
 
825
                          '3f786850e387550fdab836ed7e6dc881de23001b'],
 
826
                          vf.get_sha1s(['a', 'c', 'b']))
810
827
        
811
828
 
812
829
class TestWeave(TestCaseWithTransport, VersionedFileTestMixIn):