~toddy/bzr/bzr.i18n

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_annotate.py

  • Committer: Tobias Toedter
  • Date: 2008-02-10 08:01:48 UTC
  • mfrom: (2438.1.783 +trunk)
  • Revision ID: t.toedter@gmx.net-20080210080148-bg5rh61oq2zk2xw3
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
162
162
         |      |          |
163
163
         +------+          |
164
164
         |      |          |
165
 
        rev-3  rev-1_1_2  rev-1_1_1_1_1 --+
 
165
        rev-3  rev-1_1_2  rev-1_2_1 ------+
166
166
         |      |          |              |
167
167
         +------+          |              |
168
168
         |                 |              |
169
 
        rev-4             rev-1_1_1_1_2  rev-1_1_1_1_1_1_1
 
169
        rev-4             rev-1_2_2  rev-1_3_1
170
170
         |                 |              |
171
171
         +-----------------+              |
172
172
         |                                |
186
186
        tree1.commit('noop merge', rev_id='rev-4')
187
187
 
188
188
        self.build_tree_contents([('tree3/a', 'first\nthird\nfourth\n')])
189
 
        tree3.commit('four', rev_id='rev-1_1_1_1_1',
 
189
        tree3.commit('four', rev_id='rev-1_2_1',
190
190
                     committer='jerry@foo.com',
191
191
                     timestamp=1166046003.00, timezone=0)
192
192
 
193
193
        tree4 = tree3.bzrdir.clone('tree4').open_workingtree()
194
194
 
195
 
        tree3.commit('noop', rev_id='rev-1_1_1_1_2',
 
195
        tree3.commit('noop', rev_id='rev-1_2_2',
196
196
                     committer='jerry@foo.com',
197
197
                     timestamp=1166046004.00, timezone=0)
198
198
        self.assertEqual(0, tree1.merge_from_branch(tree3.branch))
200
200
 
201
201
        self.build_tree_contents([('tree4/a',
202
202
                                   'first\nthird\nfourth\nfifth\nsixth\n')])
203
 
        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',
204
204
                     committer='george@foo.com',
205
205
                     timestamp=1166046005.00, timezone=0)
206
206
        self.assertEqual(0, tree1.merge_from_branch(tree4.branch))
226
226
        sio = StringIO()
227
227
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
228
228
                               to_file=sio, verbose=False, full=False)
229
 
        self.assertEqualDiff('1            joe@foo | first\n'
230
 
                             '2            joe@foo | second\n'
231
 
                             '1.1.1        barry@f | third\n'
232
 
                             '1.1.1.1.1    jerry@f | fourth\n'
233
 
                             '1.1.1.1.1.1> george@ | fifth\n'
234
 
                             '                     | sixth\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
                             '              | sixth\n',
235
235
                             sio.getvalue())
236
236
 
237
237
        sio = StringIO()
238
238
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
239
239
                               to_file=sio, verbose=False, full=True)
240
 
        self.assertEqualDiff('1            joe@foo | first\n'
241
 
                             '2            joe@foo | second\n'
242
 
                             '1.1.1        barry@f | third\n'
243
 
                             '1.1.1.1.1    jerry@f | fourth\n'
244
 
                             '1.1.1.1.1.1> george@ | fifth\n'
245
 
                             '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',
246
246
                             sio.getvalue())
247
247
 
248
248
        # verbose=True shows everything, the full revno, user id, and date
249
249
        sio = StringIO()
250
250
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
251
251
                               to_file=sio, verbose=True, full=False)
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.1.1.1.1     jerry@foo.com  20061213 | fourth\n'
256
 
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
257
 
                             '                                      | sixth\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
                             '                              | sixth\n',
258
258
                             sio.getvalue())
259
259
 
260
260
        sio = StringIO()
261
261
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
262
262
                               to_file=sio, verbose=True, full=True)
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.1.1.1.1     jerry@foo.com  20061213 | fourth\n'
267
 
                             '1.1.1.1.1.1.1 george@foo.com 20061213 | fifth\n'
268
 
                             '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',
269
269
                             sio.getvalue())
270
270
 
271
271
    def test_annotate_uses_branch_context(self):
277
277
        tree1 = self.create_deeply_merged_trees()
278
278
 
279
279
        sio = StringIO()
280
 
        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',
281
281
                               to_file=sio, verbose=False, full=False)
282
 
        self.assertEqualDiff('1            joe@foo | first\n'
283
 
                             '1.1.1        barry@f | third\n'
284
 
                             '1.1.1.1.1    jerry@f | fourth\n'
285
 
                             '1.1.1.1.1.1> george@ | fifth\n'
286
 
                             '                     | sixth\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'
 
286
                             '              | sixth\n',
287
287
                             sio.getvalue())
288
288
 
289
289
    def test_annotate_show_ids(self):
294
294
                               to_file=sio, show_ids=True, full=False)
295
295
 
296
296
        # It looks better with real revision ids :)
297
 
        self.assertEqualDiff('            rev-1 | first\n'
298
 
                             '            rev-2 | second\n'
299
 
                             '        rev-1_1_1 | third\n'
300
 
                             '    rev-1_1_1_1_1 | fourth\n'
301
 
                             'rev-1_1_1_1_1_1_1 | fifth\n'
302
 
                             '                  | sixth\n',
 
297
        self.assertEqualDiff('    rev-1 | first\n'
 
298
                             '    rev-2 | second\n'
 
299
                             'rev-1_1_1 | third\n'
 
300
                             'rev-1_2_1 | fourth\n'
 
301
                             'rev-1_3_1 | fifth\n'
 
302
                             '          | sixth\n',
303
303
                             sio.getvalue())
304
304
 
305
305
        sio = StringIO()
306
306
        annotate.annotate_file(tree1.branch, 'rev-6', 'a-id',
307
307
                               to_file=sio, show_ids=True, full=True)
308
308
 
309
 
        self.assertEqualDiff('            rev-1 | first\n'
310
 
                             '            rev-2 | second\n'
311
 
                             '        rev-1_1_1 | third\n'
312
 
                             '    rev-1_1_1_1_1 | fourth\n'
313
 
                             'rev-1_1_1_1_1_1_1 | fifth\n'
314
 
                             'rev-1_1_1_1_1_1_1 | sixth\n',
 
309
        self.assertEqualDiff('    rev-1 | first\n'
 
310
                             '    rev-2 | second\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',
315
315
                             sio.getvalue())
316
316
 
317
317
    def test_annotate_unicode_author(self):