412
412
tree1.lock_read()
413
413
self.addCleanup(tree1.unlock)
415
revtree_1 = tree1.branch.repository.revision_tree('rev-1')
416
revtree_2 = tree1.branch.repository.revision_tree('rev-2')
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)
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())
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())
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())
435
443
def test_annotate_author_or_committer(self):