272
272
verbose=False, full=False, show_ids=False):
273
273
tree = branch.repository.revision_tree(revision_id)
274
274
to_file = StringIO()
275
annotate.annotate_file_revision_tree(tree, file_id, to_file,
275
annotate.annotate_file_tree(tree, file_id, to_file,
276
276
verbose=verbose, full=full, show_ids=show_ids, branch=branch)
277
277
self.assertAnnotateEqualDiff(to_file.getvalue(), expected)
418
418
# this passes if no exception is raised
419
419
to_file = StringIO()
420
annotate.annotate_file_revision_tree(revtree_1, 'a-id',
420
annotate.annotate_file_tree(revtree_1, 'a-id',
421
421
to_file=to_file, branch=tree1.branch)
424
424
to_file = codecs.getwriter('ascii')(sio)
425
425
to_file.encoding = 'ascii' # codecs does not set it
426
annotate.annotate_file_revision_tree(revtree_2, 'b-id',
426
annotate.annotate_file_tree(revtree_2, 'b-id',
427
427
to_file=to_file, branch=tree1.branch)
428
428
self.assertEqualDiff('2 p?rez | bye\n', sio.getvalue())
430
430
# test now with to_file.encoding = None
431
431
to_file = tests.StringIOWrapper()
432
432
to_file.encoding = None
433
annotate.annotate_file_revision_tree(revtree_2, 'b-id',
433
annotate.annotate_file_tree(revtree_2, 'b-id',
434
434
to_file=to_file, branch=tree1.branch)
435
435
self.assertContainsRe('2 p.rez | bye\n', to_file.getvalue())
437
437
# and when it does not exist
438
438
to_file = StringIO()
439
annotate.annotate_file_revision_tree(revtree_2, 'b-id',
439
annotate.annotate_file_tree(revtree_2, 'b-id',
440
440
to_file=to_file, branch=tree1.branch)
441
441
self.assertContainsRe('2 p.rez | bye\n', to_file.getvalue())