~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_annotate.py

  • Committer: Jelmer Vernooij
  • Date: 2011-05-02 18:34:45 UTC
  • mto: This revision was merged to the branch mainline in revision 5826.
  • Revision ID: jelmer@samba.org-20110502183445-1th2s8gqowgjx4xm
Convert more tests to use annotate_file_revision_tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
411
411
 
412
412
        tree1.lock_read()
413
413
        self.addCleanup(tree1.unlock)
 
414
 
 
415
        revtree_1 = tree1.branch.repository.revision_tree('rev-1')
 
416
        revtree_2 = tree1.branch.repository.revision_tree('rev-2')
 
417
 
414
418
        # this passes if no exception is raised
415
419
        to_file = StringIO()
416
 
        annotate.annotate_file(tree1.branch, 'rev-1', 'a-id', to_file=to_file)
 
420
        annotate.annotate_file_revision_tree(revtree_1, 'a-id',
 
421
            to_file=to_file, branch=tree1.branch)
417
422
 
418
423
        sio = StringIO()
419
424
        to_file = codecs.getwriter('ascii')(sio)
420
425
        to_file.encoding = 'ascii' # codecs does not set it
421
 
        annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
 
426
        annotate.annotate_file_revision_tree(revtree_2, 'b-id',
 
427
            to_file=to_file, branch=tree1.branch)
422
428
        self.assertEqualDiff('2   p?rez   | bye\n', sio.getvalue())
423
429
 
424
430
        # test now with to_file.encoding = None
425
431
        to_file = tests.StringIOWrapper()
426
432
        to_file.encoding = None
427
 
        annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
 
433
        annotate.annotate_file_revision_tree(revtree_2, 'b-id',
 
434
            to_file=to_file, branch=tree1.branch)
428
435
        self.assertContainsRe('2   p.rez   | bye\n', to_file.getvalue())
429
436
 
430
437
        # and when it does not exist
431
438
        to_file = StringIO()
432
 
        annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
 
439
        annotate.annotate_file_revision_tree(revtree_2, 'b-id',
 
440
            to_file=to_file, branch=tree1.branch)
433
441
        self.assertContainsRe('2   p.rez   | bye\n', to_file.getvalue())
434
442
 
435
443
    def test_annotate_author_or_committer(self):