~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_log.py

  • Committer: Martin Pool
  • Date: 2006-05-18 06:19:10 UTC
  • mto: This revision was merged to the branch mainline in revision 1717.
  • Revision ID: mbp@sourcefrog.net-20060518061910-cbcb6b00b5dcd2f5
log --line shows revision numbers (Alexander)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from cStringIO import StringIO
19
19
 
20
20
from bzrlib.tests import BzrTestBase, TestCaseWithTransport
21
 
from bzrlib.log import LogFormatter, show_log, LongLogFormatter, ShortLogFormatter
 
21
from bzrlib.log import (LogFormatter, show_log, LongLogFormatter,
 
22
                        ShortLogFormatter, LineLogFormatter)
22
23
from bzrlib.branch import Branch
23
24
from bzrlib.errors import InvalidRevisionNumber
24
25
 
39
40
    def __init__(self):
40
41
        super(LogCatcher, self).__init__(to_file=None)
41
42
        self.logs = []
42
 
        
43
 
        
 
43
 
44
44
    def show(self, revno, rev, delta):
45
45
        le = _LogEntry()
46
46
        le.revno = revno
276
276
added:
277
277
  a
278
278
''')
 
279
 
 
280
    def test_line_log(self):
 
281
        """Line log should show revno
 
282
        
 
283
        bug #5162
 
284
        """
 
285
        wt = self.make_branch_and_tree('.')
 
286
        b = wt.branch
 
287
        self.build_tree(['a'])
 
288
        wt.add('a')
 
289
        b.nick = 'test-line-log'
 
290
        wt.commit(message='add a', 
 
291
                  timestamp=1132711707, 
 
292
                  timezone=36000,
 
293
                  committer='Line-Log-Formatter Tester <test@line.log>')
 
294
        logfile = file('out.tmp', 'w+')
 
295
        formatter = LineLogFormatter(to_file=logfile)
 
296
        show_log(b, formatter)
 
297
        logfile.flush()
 
298
        logfile.seek(0)
 
299
        log_contents = logfile.read()
 
300
        self.assertEqualDiff(log_contents, '1: Line-Log-Formatte... 2005-11-23 add a\n')