~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_knit.py

  • Committer: Aaron Bentley
  • Date: 2006-06-25 23:18:09 UTC
  • mto: This revision was merged to the branch mainline in revision 1812.
  • Revision ID: aaron.bentley@utoronto.ca-20060625231809-224c5facfe6bcd69
Remove knit caches

Show diffs side-by-side

added added

removed removed

Lines of Context:
272
272
        self.assertEquals(origins[0], ('text-c', 'z\n'))
273
273
        self.assertEquals(origins[1], ('text-b', 'c\n'))
274
274
 
275
 
    def test_extraction_reads_components_once(self):
276
 
        t = MemoryTransport()
277
 
        instrumented_t = TransportLogger(t)
278
 
        k1 = KnitVersionedFile('id', instrumented_t, create=True, delta=True)
279
 
        # should read the index
280
 
        self.assertEqual([('id.kndx',)], instrumented_t._calls)
281
 
        instrumented_t._calls = []
282
 
        # add a text       
283
 
        k1.add_lines('base', [], ['text\n'])
284
 
        # should not have read at all
285
 
        self.assertEqual([], instrumented_t._calls)
286
 
 
287
 
        # add a text
288
 
        k1.add_lines('sub', ['base'], ['text\n', 'text2\n'])
289
 
        # should not have read at all
290
 
        self.assertEqual([], instrumented_t._calls)
291
 
        
292
 
        # read a text
293
 
        k1.get_lines('sub')
294
 
        # should not have read at all
295
 
        self.assertEqual([], instrumented_t._calls)
296
 
 
297
 
        # clear the cache
298
 
        k1.clear_cache()
299
 
 
300
 
        # read a text
301
 
        k1.get_lines('base')
302
 
        # should have read a component
303
 
        # should not have read the first component only
304
 
        self.assertEqual([('id.knit', [(0, 87)])], instrumented_t._calls)
305
 
        instrumented_t._calls = []
306
 
        # read again
307
 
        k1.get_lines('base')
308
 
        # should not have read at all
309
 
        self.assertEqual([], instrumented_t._calls)
310
 
        # and now read the other component
311
 
        k1.get_lines('sub')
312
 
        # should have read the second component
313
 
        self.assertEqual([('id.knit', [(87, 93)])], instrumented_t._calls)
314
 
        instrumented_t._calls = []
315
 
 
316
 
        # clear the cache
317
 
        k1.clear_cache()
318
 
        # add a text cold 
319
 
        k1.add_lines('sub2', ['base'], ['text\n', 'text3\n'])
320
 
        # should read the first component only
321
 
        self.assertEqual([('id.knit', [(0, 87)])], instrumented_t._calls)
322
 
 
323
275
    def test_get_line_delta_texts(self):
324
276
        """Make sure we can call get_texts on text with reused line deltas"""
325
277
        k1 = KnitVersionedFile('test1', get_transport('.'),