183
186
tree1.commit('noop merge', rev_id='rev-4')
185
188
self.build_tree_contents([('tree3/a', 'first\nthird\nfourth\n')])
186
tree3.commit('four', rev_id='rev-1_1_1_1_1',
189
tree3.commit('four', rev_id='rev-1_2_1',
187
190
committer='jerry@foo.com',
188
191
timestamp=1166046003.00, timezone=0)
190
193
tree4 = tree3.bzrdir.clone('tree4').open_workingtree()
192
tree3.commit('noop', rev_id='rev-1_1_1_1_2',
195
tree3.commit('noop', rev_id='rev-1_2_2',
193
196
committer='jerry@foo.com',
194
197
timestamp=1166046004.00, timezone=0)
195
198
self.assertEqual(0, tree1.merge_from_branch(tree3.branch))
198
201
self.build_tree_contents([('tree4/a',
199
202
'first\nthird\nfourth\nfifth\nsixth\n')])
200
tree4.commit('five and six', rev_id='rev-1_1_1_1_1_1_1',
203
tree4.commit('five and six', rev_id='rev-1_3_1',
201
204
committer='george@foo.com',
202
205
timestamp=1166046005.00, timezone=0)
203
206
self.assertEqual(0, tree1.merge_from_branch(tree4.branch))
204
207
tree1.commit('merge five and six', rev_id='rev-6')
207
211
def test_annotate_shows_dotted_revnos(self):
223
227
annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
224
228
to_file=sio, verbose=False, full=False)
225
self.assertEqualDiff('1 joe@foo | first\n'
226
'2 joe@foo | second\n'
227
'1.1.1 barry@f | third\n'
228
'1.1.1.1.1 jerry@f | fourth\n'
229
'1.1.1.1.1.1> george@ | fifth\n'
229
self.assertEqualDiff('1 joe@foo | first\n'
230
'2 joe@foo | second\n'
231
'1.1.1 barry@f | third\n'
232
'1.2.1 jerry@f | fourth\n'
233
'1.3.1 george@ | fifth\n'
234
238
annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
235
239
to_file=sio, verbose=False, full=True)
236
self.assertEqualDiff('1 joe@foo | first\n'
237
'2 joe@foo | second\n'
238
'1.1.1 barry@f | third\n'
239
'1.1.1.1.1 jerry@f | fourth\n'
240
'1.1.1.1.1.1> george@ | fifth\n'
241
'1.1.1.1.1.1> george@ | sixth\n',
240
self.assertEqualDiff('1 joe@foo | first\n'
241
'2 joe@foo | second\n'
242
'1.1.1 barry@f | third\n'
243
'1.2.1 jerry@f | fourth\n'
244
'1.3.1 george@ | fifth\n'
245
'1.3.1 george@ | sixth\n',
244
248
# verbose=True shows everything, the full revno, user id, and date
246
250
annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
247
251
to_file=sio, verbose=True, full=False)
248
self.assertEqualDiff('1 joe@foo.com 20061213 | first\n'
249
'2 joe@foo.com 20061213 | second\n'
250
'1.1.1 barry@foo.com 20061213 | third\n'
251
'1.1.1.1.1 jerry@foo.com 20061213 | fourth\n'
252
'1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
252
self.assertEqualDiff('1 joe@foo.com 20061213 | first\n'
253
'2 joe@foo.com 20061213 | second\n'
254
'1.1.1 barry@foo.com 20061213 | third\n'
255
'1.2.1 jerry@foo.com 20061213 | fourth\n'
256
'1.3.1 george@foo.com 20061213 | fifth\n'
257
261
annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
258
262
to_file=sio, verbose=True, full=True)
259
self.assertEqualDiff('1 joe@foo.com 20061213 | first\n'
260
'2 joe@foo.com 20061213 | second\n'
261
'1.1.1 barry@foo.com 20061213 | third\n'
262
'1.1.1.1.1 jerry@foo.com 20061213 | fourth\n'
263
'1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
264
'1.1.1.1.1.1.1 george@foo.com 20061213 | sixth\n',
263
self.assertEqualDiff('1 joe@foo.com 20061213 | first\n'
264
'2 joe@foo.com 20061213 | second\n'
265
'1.1.1 barry@foo.com 20061213 | third\n'
266
'1.2.1 jerry@foo.com 20061213 | fourth\n'
267
'1.3.1 george@foo.com 20061213 | fifth\n'
268
'1.3.1 george@foo.com 20061213 | sixth\n',
267
271
def test_annotate_uses_branch_context(self):
273
277
tree1 = self.create_deeply_merged_trees()
276
annotate.annotate_file(tree1.branch, 'rev-1_1_1_1_1_1_1', 'a-id',
280
annotate.annotate_file(tree1.branch, 'rev-1_3_1', 'a-id',
277
281
to_file=sio, verbose=False, full=False)
278
self.assertEqualDiff('1 joe@foo | first\n'
279
'1.1.1 barry@f | third\n'
280
'1.1.1.1.1 jerry@f | fourth\n'
281
'1.1.1.1.1.1> george@ | fifth\n'
282
self.assertEqualDiff('1 joe@foo | first\n'
283
'1.1.1 barry@f | third\n'
284
'1.2.1 jerry@f | fourth\n'
285
'1.3.1 george@ | fifth\n'
285
289
def test_annotate_show_ids(self):
290
294
to_file=sio, show_ids=True, full=False)
292
296
# It looks better with real revision ids :)
293
self.assertEqualDiff(' rev-1 | first\n'
295
' rev-1_1_1 | third\n'
296
' rev-1_1_1_1_1 | fourth\n'
297
'rev-1_1_1_1_1_1_1 | fifth\n'
297
self.assertEqualDiff(' rev-1 | first\n'
299
'rev-1_1_1 | third\n'
300
'rev-1_2_1 | fourth\n'
301
'rev-1_3_1 | fifth\n'
302
306
annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
303
307
to_file=sio, show_ids=True, full=True)
305
self.assertEqualDiff(' rev-1 | first\n'
307
' rev-1_1_1 | third\n'
308
' rev-1_1_1_1_1 | fourth\n'
309
'rev-1_1_1_1_1_1_1 | fifth\n'
310
'rev-1_1_1_1_1_1_1 | sixth\n',
309
self.assertEqualDiff(' rev-1 | first\n'
311
'rev-1_1_1 | third\n'
312
'rev-1_2_1 | fourth\n'
313
'rev-1_3_1 | fifth\n'
314
'rev-1_3_1 | sixth\n',
313
317
def test_annotate_unicode_author(self):