199
199
open('a', 'wb').write('hello moto\n')
201
wt.commit('simple log message', rev_id='a1'
202
, timestamp=1132586655.459960938, timezone=-6*3600
203
, committer='Joe Foo <joe@foo.com>')
201
wt.commit('simple log message', rev_id='a1',
202
timestamp=1132586655.459960938, timezone=-6*3600,
203
committer='Joe Foo <joe@foo.com>')
204
204
open('b', 'wb').write('goodbye\n')
206
wt.commit('multiline\nlog\nmessage\n', rev_id='a2'
207
, timestamp=1132586842.411175966, timezone=-6*3600
208
, committer='Joe Foo <joe@foo.com>')
206
wt.commit('multiline\nlog\nmessage\n', rev_id='a2',
207
timestamp=1132586842.411175966, timezone=-6*3600,
208
committer='Joe Foo <joe@foo.com>',
209
author='Joe Bar <joe@bar.com>')
210
211
open('c', 'wb').write('just another manic monday\n')
212
wt.commit('single line with trailing newline\n', rev_id='a3'
213
, timestamp=1132587176.835228920, timezone=-6*3600
214
, committer = 'Joe Foo <joe@foo.com>')
213
wt.commit('single line with trailing newline\n', rev_id='a3',
214
timestamp=1132587176.835228920, timezone=-6*3600,
215
committer = 'Joe Foo <joe@foo.com>')
243
244
def normalize_log(self,log):
244
245
"""Replaces the variable lines of logs with fixed lines"""
245
committer = 'committer: Lorem Ipsum <test@example.com>'
246
author = 'author: Lorem Ipsum <test@example.com>'
247
committer = 'committer: Lorem Ipsum 2 <test2@example.com>'
246
248
lines = log.splitlines(True)
247
249
for idx,line in enumerate(lines):
248
250
stripped_line = line.lstrip()
249
251
indent = ' ' * (len(line) - len(stripped_line))
250
if stripped_line.startswith('committer:'):
252
if stripped_line.startswith('author:'):
253
lines[idx] = indent + author + '\n'
254
elif stripped_line.startswith('committer:'):
251
255
lines[idx] = indent + committer + '\n'
252
if stripped_line.startswith('timestamp:'):
256
elif stripped_line.startswith('timestamp:'):
253
257
lines[idx] = indent + 'timestamp: Just now\n'
254
258
return ''.join(lines)
277
281
self.assertEqualDiff(log_contents, '''\
278
282
------------------------------------------------------------
280
committer: Lorem Ipsum <test@example.com>
284
author: Lorem Ipsum <test@example.com>
281
285
branch nick: test_verbose_log
282
286
timestamp: Wed 2005-11-23 12:08:27 +1000
308
312
self.assertEqualDiff("""\
309
313
------------------------------------------------------------
311
committer: Lorem Ipsum <test@example.com>
315
author: Lorem Ipsum <test@example.com>
312
316
branch nick: parent
313
317
timestamp: Just now
316
320
------------------------------------------------------------
318
committer: Lorem Ipsum <test@example.com>
322
author: Lorem Ipsum <test@example.com>
319
323
branch nick: child
320
324
timestamp: Just now
323
327
------------------------------------------------------------
325
committer: Lorem Ipsum <test@example.com>
329
author: Lorem Ipsum <test@example.com>
326
330
branch nick: smallerchild
327
331
timestamp: Just now
330
334
------------------------------------------------------------
332
committer: Lorem Ipsum <test@example.com>
336
author: Lorem Ipsum <test@example.com>
333
337
branch nick: child
334
338
timestamp: Just now
337
341
------------------------------------------------------------
339
committer: Lorem Ipsum <test@example.com>
343
author: Lorem Ipsum <test@example.com>
340
344
branch nick: parent
341
345
timestamp: Just now
405
409
self.assertEqualDiff(sio.getvalue(), """\
406
410
------------------------------------------------------------
408
committer: Joe Foo <joe@foo.com>
412
author: Joe Foo <joe@foo.com>
409
413
branch nick: test
410
414
timestamp: Mon 2005-11-21 09:32:56 -0600
412
416
single line with trailing newline
413
417
------------------------------------------------------------
419
author: Joe Bar <joe@bar.com>
415
420
committer: Joe Foo <joe@foo.com>
416
421
branch nick: test
417
422
timestamp: Mon 2005-11-21 09:27:22 -0600
422
427
------------------------------------------------------------
424
committer: Joe Foo <joe@foo.com>
429
author: Joe Foo <joe@foo.com>
425
430
branch nick: test
426
431
timestamp: Mon 2005-11-21 09:24:15 -0600
428
433
simple log message
431
def test_author_in_log(self):
432
"""Log includes the author name if it's set in
433
the revision properties
436
def test_committer_in_log(self):
437
"""Log includes the committer's name if it's
438
different from the author.
435
440
wt = self.make_branch_and_tree('.')
443
448
committer='Lorem Ipsum <test@example.com>',
444
449
author='John Doe <jdoe@example.com>')
450
wt.commit(message='foo',
451
timestamp=1132712707,
453
committer='Lorem Ipsum <test@example.com>',
454
author='Lorem Ipsum <test@example.com>')
446
456
formatter = LongLogFormatter(to_file=sio)
447
457
show_log(b, formatter)
448
458
self.assertEqualDiff(sio.getvalue(), '''\
449
459
------------------------------------------------------------
461
author: Lorem Ipsum <test@example.com>
462
branch nick: test_author_log
463
timestamp: Wed 2005-11-23 12:25:07 +1000
466
------------------------------------------------------------
451
committer: Lorem Ipsum <test@example.com>
452
468
author: John Doe <jdoe@example.com>
469
committer: Lorem Ipsum <test@example.com>
453
470
branch nick: test_author_log
454
471
timestamp: Wed 2005-11-23 12:08:27 +1000
522
539
self.assertEqualDiff(sio.getvalue(), """\
523
540
3: Joe Foo 2005-11-21 single line with trailing newline
524
2: Joe Foo 2005-11-21 multiline
541
2: Joe Bar 2005-11-21 multiline
525
542
1: Joe Foo 2005-11-21 simple log message