~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_annotate.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-28 07:08:27 UTC
  • mfrom: (2553.1.3 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20070628070827-h5s313dg5tnag9vj
(robertc) Show the names of commit hooks during commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Whitebox tests for annotate functionality."""
18
18
 
19
 
import codecs
20
19
from cStringIO import StringIO
21
20
 
22
21
from bzrlib import (
302
301
                             'rev-1_1_1_1_1_1_1 | sixth\n',
303
302
                             sio.getvalue())
304
303
 
305
 
    def test_annotate_unicode_author(self):
306
 
        tree1 = self.make_branch_and_tree('tree1')
307
 
 
308
 
        self.build_tree_contents([('tree1/a', 'adi\xc3\xb3s')])
309
 
        tree1.add(['a'], ['a-id'])
310
 
        tree1.commit('a', rev_id='rev-1',
311
 
                     committer=u'Pepe P\xe9rez <pperez@ejemplo.com>',
312
 
                     timestamp=1166046000.00, timezone=0)
313
 
 
314
 
        self.build_tree_contents([('tree1/b', 'bye')])
315
 
        tree1.add(['b'], ['b-id'])
316
 
        tree1.commit('b', rev_id='rev-2',
317
 
                     committer=u'p\xe9rez',
318
 
                     timestamp=1166046000.00, timezone=0)
319
 
 
320
 
        # this passes if no exception is raised
321
 
        to_file = StringIO()
322
 
        annotate.annotate_file(tree1.branch, 'rev-1', 'a-id', to_file=to_file)
323
 
 
324
 
        sio = StringIO()
325
 
        to_file = codecs.getwriter('ascii')(sio)
326
 
        to_file.encoding = 'ascii' # codecs does not set it
327
 
        annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
328
 
        self.assertEqualDiff('2   p?rez   | bye\n', sio.getvalue())
329
 
 
330
 
        # test now with to_file.encoding = None
331
 
        to_file = tests.StringIOWrapper()
332
 
        to_file.encoding = None
333
 
        annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
334
 
        self.assertContainsRe('2   p.rez   | bye\n', to_file.getvalue())
335
 
 
336
 
        # and when it does not exist
337
 
        to_file = StringIO()
338
 
        annotate.annotate_file(tree1.branch, 'rev-2', 'b-id', to_file=to_file)
339
 
        self.assertContainsRe('2   p.rez   | bye\n', to_file.getvalue())
340
 
 
341
304
 
342
305
class TestReannotate(tests.TestCase):
343
306