/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_annotate.py

  • Committer: Jelmer Vernooij
  • Date: 2020-05-06 02:13:25 UTC
  • mfrom: (7490.7.21 work)
  • mto: This revision was merged to the branch mainline in revision 7501.
  • Revision ID: jelmer@jelmer.uk-20200506021325-awbmmqu1zyorz7sj
Merge 3.1 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Whitebox tests for annotate functionality."""
18
18
 
19
19
import codecs
 
20
from io import BytesIO, StringIO
20
21
 
21
22
from .. import (
22
23
    annotate,
23
24
    tests,
24
25
    )
25
 
from ..sixish import (
26
 
    BytesIO,
27
 
    )
28
26
from .ui_testing import StringIOWithEncoding
29
27
 
30
28
 
31
29
def annotation(text):
32
 
    return [tuple(l.split(' ', 1)) for l in text.splitlines(True)]
33
 
 
34
 
 
35
 
parent_1 = annotation("""\
 
30
    return [tuple(l.split(b' ', 1)) for l in text.splitlines(True)]
 
31
 
 
32
 
 
33
parent_1 = annotation(b"""\
36
34
rev1 a
37
35
rev2 b
38
36
rev3 c
41
39
""")
42
40
 
43
41
 
44
 
parent_2 = annotation("""\
 
42
parent_2 = annotation(b"""\
45
43
rev1 a
46
44
rev3 c
47
45
rev4 d
51
49
""")
52
50
 
53
51
 
54
 
expected_2_1 = annotation("""\
 
52
expected_2_1 = annotation(b"""\
55
53
rev1 a
56
54
blahblah b
57
55
rev3 c
68
66
# f: in 2, but not in new, so ignored
69
67
# g: not in 1 or 2, so it goes to blahblah
70
68
# h: only in parent 2, so 2 gets it
71
 
expected_1_2_2 = annotation("""\
 
69
expected_1_2_2 = annotation(b"""\
72
70
rev1 a
73
71
rev2 b
74
72
rev3 c
79
77
""")
80
78
 
81
79
 
82
 
new_1 = """\
 
80
new_1 = b"""\
83
81
a
84
82
b
85
83
c
87
85
e
88
86
""".splitlines(True)
89
87
 
90
 
expected_1 = annotation("""\
 
88
expected_1 = annotation(b"""\
91
89
blahblah a
92
90
blahblah b
93
91
blahblah c
96
94
""")
97
95
 
98
96
 
99
 
new_2 = """\
 
97
new_2 = b"""\
100
98
a
101
99
b
102
100
c
120
118
#  |/
121
119
#  E    # D should supersede A and stay as D (not become E because C references
122
120
#         A)
123
 
duplicate_base = annotation("""\
 
121
duplicate_base = annotation(b"""\
124
122
rev-base first
125
123
rev-base second
126
124
rev-base third
127
125
rev-base fourth-base
128
126
""")
129
127
 
130
 
duplicate_A = annotation("""\
 
128
duplicate_A = annotation(b"""\
131
129
rev-base first
132
130
rev-A alt-second
133
131
rev-base third
134
132
rev-A fourth-A
135
133
""")
136
134
 
137
 
duplicate_B = annotation("""\
 
135
duplicate_B = annotation(b"""\
138
136
rev-base first
139
137
rev-B alt-second
140
138
rev-base third
141
139
rev-B fourth-B
142
140
""")
143
141
 
144
 
duplicate_C = annotation("""\
 
142
duplicate_C = annotation(b"""\
145
143
rev-base first
146
144
rev-A alt-second
147
145
rev-base third
148
146
rev-C fourth-C
149
147
""")
150
148
 
151
 
duplicate_D = annotation("""\
 
149
duplicate_D = annotation(b"""\
152
150
rev-base first
153
151
rev-A alt-second
154
152
rev-base third
155
153
rev-D fourth-D
156
154
""")
157
155
 
158
 
duplicate_E = annotation("""\
 
156
duplicate_E = annotation(b"""\
159
157
rev-base first
160
158
rev-A alt-second
161
159
rev-base third
180
178
        builder.start_series()
181
179
        self.addCleanup(builder.finish_series)
182
180
        builder.build_snapshot(None, [
183
 
            ('add', ('', 'root-id', 'directory', None)),
184
 
            ('add', ('a', 'a-id', 'file', 'first\n')),
 
181
            ('add', ('', b'root-id', 'directory', None)),
 
182
            ('add', ('a', b'a-id', 'file', b'first\n')),
185
183
            ], timestamp=1166046000.00, timezone=0, committer="joe@foo.com",
186
 
            revision_id='rev-1')
187
 
        builder.build_snapshot(['rev-1'], [
188
 
            ('modify', ('a-id', 'first\nsecond\n')),
 
184
            revision_id=b'rev-1')
 
185
        builder.build_snapshot([b'rev-1'], [
 
186
            ('modify', ('a', b'first\nsecond\n')),
189
187
            ], timestamp=1166046001.00, timezone=0, committer="joe@foo.com",
190
 
            revision_id='rev-2')
191
 
        builder.build_snapshot(['rev-1'], [
192
 
            ('modify', ('a-id', 'first\nthird\n')),
 
188
            revision_id=b'rev-2')
 
189
        builder.build_snapshot([b'rev-1'], [
 
190
            ('modify', ('a', b'first\nthird\n')),
193
191
            ], timestamp=1166046002.00, timezone=0, committer="barry@foo.com",
194
 
            revision_id='rev-1_1_1')
195
 
        builder.build_snapshot(['rev-2', 'rev-1_1_1'], [
196
 
            ('modify', ('a-id', 'first\nsecond\nthird\n')),
 
192
            revision_id=b'rev-1_1_1')
 
193
        builder.build_snapshot([b'rev-2', b'rev-1_1_1'], [
 
194
            ('modify', ('a', b'first\nsecond\nthird\n')),
197
195
            ], timestamp=1166046003.00, timezone=0, committer="sal@foo.com",
198
 
            revision_id='rev-3')
 
196
            revision_id=b'rev-3')
199
197
        return builder
200
198
 
201
199
    def create_deeply_merged_trees(self):
222
220
        rev-6
223
221
        """
224
222
        builder = self.create_merged_trees()
225
 
        builder.build_snapshot(['rev-1_1_1'], [], revision_id='rev-1_1_2')
226
 
        builder.build_snapshot(['rev-3', 'rev-1_1_2'], [], revision_id='rev-4')
227
 
        builder.build_snapshot(['rev-1_1_1'], [
228
 
            ('modify', ('a-id', 'first\nthird\nfourth\n')),
 
223
        builder.build_snapshot([b'rev-1_1_1'], [], revision_id=b'rev-1_1_2')
 
224
        builder.build_snapshot([b'rev-3', b'rev-1_1_2'],
 
225
                               [], revision_id=b'rev-4')
 
226
        builder.build_snapshot([b'rev-1_1_1'], [
 
227
            ('modify', ('a', b'first\nthird\nfourth\n')),
229
228
            ], timestamp=1166046003.00, timezone=0, committer="jerry@foo.com",
230
 
            revision_id='rev-1_2_1')
231
 
        builder.build_snapshot(['rev-1_2_1'], [],
232
 
            timestamp=1166046004.00, timezone=0, committer="jerry@foo.com",
233
 
            revision_id='rev-1_2_2')
234
 
        builder.build_snapshot(['rev-4', 'rev-1_2_2'], [
235
 
            ('modify', ('a-id', 'first\nsecond\nthird\nfourth\n')),
 
229
            revision_id=b'rev-1_2_1')
 
230
        builder.build_snapshot([b'rev-1_2_1'], [],
 
231
                               timestamp=1166046004.00, timezone=0, committer="jerry@foo.com",
 
232
                               revision_id=b'rev-1_2_2')
 
233
        builder.build_snapshot([b'rev-4', b'rev-1_2_2'], [
 
234
            ('modify', ('a', b'first\nsecond\nthird\nfourth\n')),
236
235
            ], timestamp=1166046004.00, timezone=0, committer="jerry@foo.com",
237
 
            revision_id='rev-5')
238
 
        builder.build_snapshot(['rev-1_2_1'], [
239
 
            ('modify', ('a-id', 'first\nthird\nfourth\nfifth\nsixth\n')),
 
236
            revision_id=b'rev-5')
 
237
        builder.build_snapshot([b'rev-1_2_1'], [
 
238
            ('modify', ('a', b'first\nthird\nfourth\nfifth\nsixth\n')),
240
239
            ], timestamp=1166046005.00, timezone=0, committer="george@foo.com",
241
 
            revision_id='rev-1_3_1')
242
 
        builder.build_snapshot(['rev-5', 'rev-1_3_1'], [
243
 
            ('modify', ('a-id',
244
 
                        'first\nsecond\nthird\nfourth\nfifth\nsixth\n')),
245
 
            ], revision_id='rev-6')
 
240
            revision_id=b'rev-1_3_1')
 
241
        builder.build_snapshot([b'rev-5', b'rev-1_3_1'], [
 
242
            ('modify', ('a',
 
243
                        b'first\nsecond\nthird\nfourth\nfifth\nsixth\n')),
 
244
            ], revision_id=b'rev-6')
246
245
        return builder
247
246
 
248
247
    def create_duplicate_lines_tree(self):
249
248
        builder = self.make_branch_builder('branch')
250
249
        builder.start_series()
251
250
        self.addCleanup(builder.finish_series)
252
 
        base_text = ''.join(l for r, l in duplicate_base)
253
 
        a_text = ''.join(l for r, l in duplicate_A)
254
 
        b_text = ''.join(l for r, l in duplicate_B)
255
 
        c_text = ''.join(l for r, l in duplicate_C)
256
 
        d_text = ''.join(l for r, l in duplicate_D)
257
 
        e_text = ''.join(l for r, l in duplicate_E)
 
251
        base_text = b''.join(l for r, l in duplicate_base)
 
252
        a_text = b''.join(l for r, l in duplicate_A)
 
253
        b_text = b''.join(l for r, l in duplicate_B)
 
254
        c_text = b''.join(l for r, l in duplicate_C)
 
255
        d_text = b''.join(l for r, l in duplicate_D)
 
256
        e_text = b''.join(l for r, l in duplicate_E)
258
257
        builder.build_snapshot(None, [
259
 
            ('add', ('', 'root-id', 'directory', None)),
260
 
            ('add', ('file', 'file-id', 'file', base_text)),
261
 
            ], revision_id='rev-base')
262
 
        builder.build_snapshot(['rev-base'], [
263
 
            ('modify', ('file-id', a_text))],
264
 
            revision_id='rev-A')
265
 
        builder.build_snapshot(['rev-base'], [
266
 
            ('modify', ('file-id', b_text))],
267
 
            revision_id='rev-B')
268
 
        builder.build_snapshot(['rev-A'], [
269
 
            ('modify', ('file-id', c_text))],
270
 
            revision_id='rev-C')
271
 
        builder.build_snapshot(['rev-B', 'rev-A'], [
272
 
            ('modify', ('file-id', d_text))],
273
 
            revision_id='rev-D')
274
 
        builder.build_snapshot(['rev-C', 'rev-D'], [
275
 
            ('modify', ('file-id', e_text))],
276
 
            revision_id='rev-E')
 
258
            ('add', ('', b'root-id', 'directory', None)),
 
259
            ('add', ('file', b'file-id', 'file', base_text)),
 
260
            ], revision_id=b'rev-base')
 
261
        builder.build_snapshot([b'rev-base'], [
 
262
            ('modify', ('file', a_text))],
 
263
            revision_id=b'rev-A')
 
264
        builder.build_snapshot([b'rev-base'], [
 
265
            ('modify', ('file', b_text))],
 
266
            revision_id=b'rev-B')
 
267
        builder.build_snapshot([b'rev-A'], [
 
268
            ('modify', ('file', c_text))],
 
269
            revision_id=b'rev-C')
 
270
        builder.build_snapshot([b'rev-B', b'rev-A'], [
 
271
            ('modify', ('file', d_text))],
 
272
            revision_id=b'rev-D')
 
273
        builder.build_snapshot([b'rev-C', b'rev-D'], [
 
274
            ('modify', ('file', e_text))],
 
275
            revision_id=b'rev-E')
277
276
        return builder
278
277
 
279
278
    def assertAnnotateEqualDiff(self, actual, expected):
284
283
                                 ''.join('\t'.join(l) for l in actual))
285
284
 
286
285
    def assertBranchAnnotate(self, expected, branch, path, revision_id,
287
 
            verbose=False, full=False, show_ids=False):
 
286
                             verbose=False, full=False, show_ids=False):
288
287
        tree = branch.repository.revision_tree(revision_id)
289
 
        to_file = BytesIO()
 
288
        to_file = StringIO()
290
289
        annotate.annotate_file_tree(tree, path, to_file,
291
 
            verbose=verbose, full=full, show_ids=show_ids, branch=branch)
 
290
                                    verbose=verbose, full=full, show_ids=show_ids, branch=branch)
292
291
        self.assertAnnotateEqualDiff(to_file.getvalue(), expected)
293
292
 
294
293
    def assertRepoAnnotate(self, expected, repo, path, revision_id):
302
301
        repo = builder.get_branch().repository
303
302
        repo.lock_read()
304
303
        self.addCleanup(repo.unlock)
305
 
        self.assertRepoAnnotate(duplicate_base, repo, 'file', 'rev-base')
306
 
        self.assertRepoAnnotate(duplicate_A, repo, 'file', 'rev-A')
307
 
        self.assertRepoAnnotate(duplicate_B, repo, 'file', 'rev-B')
308
 
        self.assertRepoAnnotate(duplicate_C, repo, 'file', 'rev-C')
309
 
        self.assertRepoAnnotate(duplicate_D, repo, 'file', 'rev-D')
310
 
        self.assertRepoAnnotate(duplicate_E, repo, 'file', 'rev-E')
 
304
        self.assertRepoAnnotate(duplicate_base, repo, 'file', b'rev-base')
 
305
        self.assertRepoAnnotate(duplicate_A, repo, 'file', b'rev-A')
 
306
        self.assertRepoAnnotate(duplicate_B, repo, 'file', b'rev-B')
 
307
        self.assertRepoAnnotate(duplicate_C, repo, 'file', b'rev-C')
 
308
        self.assertRepoAnnotate(duplicate_D, repo, 'file', b'rev-D')
 
309
        self.assertRepoAnnotate(duplicate_E, repo, 'file', b'rev-E')
311
310
 
312
311
    def test_annotate_shows_dotted_revnos(self):
313
312
        builder = self.create_merged_trees()
315
314
        self.assertBranchAnnotate('1     joe@foo | first\n'
316
315
                                  '2     joe@foo | second\n'
317
316
                                  '1.1.1 barry@f | third\n',
318
 
                                  builder.get_branch(), 'a', 'rev-3')
 
317
                                  builder.get_branch(), 'a', b'rev-3')
319
318
 
320
319
    def test_annotate_limits_dotted_revnos(self):
321
320
        """Annotate should limit dotted revnos to a depth of 12"""
327
326
                                  '1.2.1 jerry@f | fourth\n'
328
327
                                  '1.3.1 george@ | fifth\n'
329
328
                                  '              | sixth\n',
330
 
                                  builder.get_branch(), 'a', 'rev-6',
 
329
                                  builder.get_branch(), 'a', b'rev-6',
331
330
                                  verbose=False, full=False)
332
331
 
333
332
        self.assertBranchAnnotate('1     joe@foo | first\n'
336
335
                                  '1.2.1 jerry@f | fourth\n'
337
336
                                  '1.3.1 george@ | fifth\n'
338
337
                                  '1.3.1 george@ | sixth\n',
339
 
                                  builder.get_branch(), 'a', 'rev-6',
 
338
                                  builder.get_branch(), 'a', b'rev-6',
340
339
                                  verbose=False, full=True)
341
340
 
342
341
        # verbose=True shows everything, the full revno, user id, and date
346
345
                                  '1.2.1 jerry@foo.com  20061213 | fourth\n'
347
346
                                  '1.3.1 george@foo.com 20061213 | fifth\n'
348
347
                                  '                              | sixth\n',
349
 
                                  builder.get_branch(), 'a', 'rev-6',
 
348
                                  builder.get_branch(), 'a', b'rev-6',
350
349
                                  verbose=True, full=False)
351
350
 
352
351
        self.assertBranchAnnotate('1     joe@foo.com    20061213 | first\n'
355
354
                                  '1.2.1 jerry@foo.com  20061213 | fourth\n'
356
355
                                  '1.3.1 george@foo.com 20061213 | fifth\n'
357
356
                                  '1.3.1 george@foo.com 20061213 | sixth\n',
358
 
                                  builder.get_branch(), 'a', 'rev-6',
 
357
                                  builder.get_branch(), 'a', b'rev-6',
359
358
                                  verbose=True, full=True)
360
359
 
361
360
    def test_annotate_uses_branch_context(self):
371
370
                                  '1.2.1 jerry@f | fourth\n'
372
371
                                  '1.3.1 george@ | fifth\n'
373
372
                                  '              | sixth\n',
374
 
                                  builder.get_branch(), 'a', 'rev-1_3_1',
 
373
                                  builder.get_branch(), 'a', b'rev-1_3_1',
375
374
                                  verbose=False, full=False)
376
375
 
377
376
    def test_annotate_show_ids(self):
384
383
                                  'rev-1_2_1 | fourth\n'
385
384
                                  'rev-1_3_1 | fifth\n'
386
385
                                  '          | sixth\n',
387
 
                                  builder.get_branch(), 'a', 'rev-6',
 
386
                                  builder.get_branch(), 'a', b'rev-6',
388
387
                                  show_ids=True, full=False)
389
388
 
390
389
        self.assertBranchAnnotate('    rev-1 | first\n'
393
392
                                  'rev-1_2_1 | fourth\n'
394
393
                                  'rev-1_3_1 | fifth\n'
395
394
                                  'rev-1_3_1 | sixth\n',
396
 
                                  builder.get_branch(), 'a', 'rev-6',
 
395
                                  builder.get_branch(), 'a', b'rev-6',
397
396
                                  show_ids=True, full=True)
398
397
 
399
398
    def test_annotate_unicode_author(self):
400
399
        tree1 = self.make_branch_and_tree('tree1')
401
400
 
402
 
        self.build_tree_contents([('tree1/a', 'adi\xc3\xb3s')])
403
 
        tree1.add(['a'], ['a-id'])
404
 
        tree1.commit('a', rev_id='rev-1',
 
401
        self.build_tree_contents([('tree1/a', b'adi\xc3\xb3s')])
 
402
        tree1.add(['a'], [b'a-id'])
 
403
        tree1.commit('a', rev_id=b'rev-1',
405
404
                     committer=u'Pepe P\xe9rez <pperez@ejemplo.com>',
406
405
                     timestamp=1166046000.00, timezone=0)
407
406
 
408
 
        self.build_tree_contents([('tree1/b', 'bye')])
409
 
        tree1.add(['b'], ['b-id'])
410
 
        tree1.commit('b', rev_id='rev-2',
 
407
        self.build_tree_contents([('tree1/b', b'bye')])
 
408
        tree1.add(['b'], [b'b-id'])
 
409
        tree1.commit('b', rev_id=b'rev-2',
411
410
                     committer=u'p\xe9rez',
412
411
                     timestamp=1166046000.00, timezone=0)
413
412
 
414
413
        tree1.lock_read()
415
414
        self.addCleanup(tree1.unlock)
416
415
 
417
 
        revtree_1 = tree1.branch.repository.revision_tree('rev-1')
418
 
        revtree_2 = tree1.branch.repository.revision_tree('rev-2')
 
416
        revtree_1 = tree1.branch.repository.revision_tree(b'rev-1')
 
417
        revtree_2 = tree1.branch.repository.revision_tree(b'rev-2')
419
418
 
420
419
        # this passes if no exception is raised
421
 
        to_file = BytesIO()
 
420
        to_file = StringIO()
422
421
        annotate.annotate_file_tree(revtree_1, 'a',
423
 
            to_file=to_file, branch=tree1.branch)
 
422
                                    to_file=to_file, branch=tree1.branch)
424
423
 
425
424
        sio = BytesIO()
426
425
        to_file = codecs.getwriter('ascii')(sio, 'replace')
427
426
        annotate.annotate_file_tree(revtree_2, 'b',
428
 
            to_file=to_file, branch=tree1.branch)
429
 
        self.assertEqualDiff('2   p?rez   | bye\n', sio.getvalue())
 
427
                                    to_file=to_file, branch=tree1.branch)
 
428
        self.assertEqualDiff(b'2   p?rez   | bye\n', sio.getvalue())
430
429
 
431
430
        # test now with unicode file-like
432
431
        to_file = StringIOWithEncoding()
433
432
        annotate.annotate_file_tree(revtree_2, 'b',
434
 
            to_file=to_file, branch=tree1.branch)
 
433
                                    to_file=to_file, branch=tree1.branch)
435
434
        self.assertContainsRe(u'2   p\xe9rez   | bye\n', to_file.getvalue())
436
435
 
437
436
    def test_annotate_author_or_committer(self):
438
437
        tree1 = self.make_branch_and_tree('tree1')
439
438
 
440
 
        self.build_tree_contents([('tree1/a', 'hello')])
441
 
        tree1.add(['a'], ['a-id'])
442
 
        tree1.commit('a', rev_id='rev-1',
 
439
        self.build_tree_contents([('tree1/a', b'hello')])
 
440
        tree1.add(['a'], [b'a-id'])
 
441
        tree1.commit('a', rev_id=b'rev-1',
443
442
                     committer='Committer <committer@example.com>',
444
443
                     timestamp=1166046000.00, timezone=0)
445
444
 
446
 
        self.build_tree_contents([('tree1/b', 'bye')])
447
 
        tree1.add(['b'], ['b-id'])
448
 
        tree1.commit('b', rev_id='rev-2',
 
445
        self.build_tree_contents([('tree1/b', b'bye')])
 
446
        tree1.add(['b'], [b'b-id'])
 
447
        tree1.commit('b', rev_id=b'rev-2',
449
448
                     committer='Committer <committer@example.com>',
450
449
                     authors=['Author <author@example.com>'],
451
450
                     timestamp=1166046000.00, timezone=0)
454
453
        self.addCleanup(tree1.unlock)
455
454
 
456
455
        self.assertBranchAnnotate('1   committ | hello\n', tree1.branch,
457
 
            'a', 'rev-1')
 
456
                                  'a', b'rev-1')
458
457
 
459
 
        to_file = BytesIO()
460
458
        self.assertBranchAnnotate('2   author@ | bye\n', tree1.branch,
461
 
            'b', 'rev-2')
 
459
                                  'b', b'rev-2')
462
460
 
463
461
 
464
462
class TestReannotate(tests.TestCase):
466
464
    def annotateEqual(self, expected, parents, newlines, revision_id,
467
465
                      blocks=None):
468
466
        annotate_list = list(annotate.reannotate(parents, newlines,
469
 
                             revision_id, blocks))
 
467
                                                 revision_id, blocks))
470
468
        self.assertEqual(len(expected), len(annotate_list))
471
469
        for e, a in zip(expected, annotate_list):
472
470
            self.assertEqual(e, a)
473
471
 
474
472
    def test_reannotate(self):
475
 
        self.annotateEqual(parent_1, [parent_1], new_1, 'blahblah')
476
 
        self.annotateEqual(expected_2_1, [parent_2], new_1, 'blahblah')
 
473
        self.annotateEqual(parent_1, [parent_1], new_1, b'blahblah')
 
474
        self.annotateEqual(expected_2_1, [parent_2], new_1, b'blahblah')
477
475
        self.annotateEqual(expected_1_2_2, [parent_1, parent_2], new_2,
478
 
                           'blahblah')
 
476
                           b'blahblah')
479
477
 
480
478
    def test_reannotate_no_parents(self):
481
 
        self.annotateEqual(expected_1, [], new_1, 'blahblah')
 
479
        self.annotateEqual(expected_1, [], new_1, b'blahblah')
482
480
 
483
481
    def test_reannotate_left_matching_blocks(self):
484
482
        """Ensure that left_matching_blocks has an impact.
486
484
        In this case, the annotation is ambiguous, so the hint isn't actually
487
485
        lying.
488
486
        """
489
 
        parent = [('rev1', 'a\n')]
490
 
        new_text = ['a\n', 'a\n']
 
487
        parent = [(b'rev1', b'a\n')]
 
488
        new_text = [b'a\n', b'a\n']
491
489
        blocks = [(0, 0, 1), (1, 2, 0)]
492
 
        self.annotateEqual([('rev1', 'a\n'), ('rev2', 'a\n')], [parent],
493
 
                           new_text, 'rev2', blocks)
 
490
        self.annotateEqual([(b'rev1', b'a\n'), (b'rev2', b'a\n')], [parent],
 
491
                           new_text, b'rev2', blocks)
494
492
        blocks = [(0, 1, 1), (1, 2, 0)]
495
 
        self.annotateEqual([('rev2', 'a\n'), ('rev1', 'a\n')], [parent],
496
 
                           new_text, 'rev2', blocks)
 
493
        self.annotateEqual([(b'rev2', b'a\n'), (b'rev1', b'a\n')], [parent],
 
494
                           new_text, b'rev2', blocks)