~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_log.py

[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
            self.assertEquals(expected, got)
66
66
 
67
67
    def test_cur_revno(self):
68
 
        b = Branch('.', init=True)
 
68
        b = Branch(u'.', init=True)
69
69
 
70
70
        lf = LogCatcher()
71
71
        b.working_tree().commit('empty commit')
84
84
                          start_revision=1, end_revision=-1) 
85
85
 
86
86
    def test_cur_revno(self):
87
 
        b = Branch.initialize('.')
 
87
        b = Branch.initialize(u'.')
88
88
 
89
89
        lf = LogCatcher()
90
90
        b.working_tree().commit('empty commit')
105
105
    def test_simple_log(self):
106
106
        eq = self.assertEquals
107
107
        
108
 
        b = Branch.initialize('.')
 
108
        b = Branch.initialize(u'.')
109
109
 
110
110
        lf = LogCatcher()
111
111
        show_log(b, lf)
123
123
        self.checkDelta(d)
124
124
 
125
125
        self.build_tree(['hello'])
126
 
        b.add('hello')
 
126
        b.working_tree().add('hello')
127
127
        b.working_tree().commit('add one file')
128
128
 
129
129
        lf = StringIO()
175
175
        self.assert_(msg == committed_msg)
176
176
 
177
177
    def test_trailing_newlines(self):
178
 
        b = Branch.initialize('.')
 
178
        b = Branch.initialize(u'.')
179
179
        b.nick='test'
180
180
        wt = b.working_tree()
181
181
        open('a', 'wb').write('hello moto\n')
182
 
        b.add('a')
 
182
        wt.add('a')
183
183
        wt.commit('simple log message', rev_id='a1'
184
184
                , timestamp=1132586655.459960938, timezone=-6*3600
185
185
                , committer='Joe Foo <joe@foo.com>')
186
186
        open('b', 'wb').write('goodbye\n')
187
 
        b.add('b')
 
187
        wt.add('b')
188
188
        wt.commit('multiline\nlog\nmessage\n', rev_id='a2'
189
189
                , timestamp=1132586842.411175966, timezone=-6*3600
190
190
                , committer='Joe Foo <joe@foo.com>')
191
191
 
192
192
        open('c', 'wb').write('just another manic monday\n')
193
 
        b.add('c')
 
193
        wt.add('c')
194
194
        wt.commit('single line with trailing newline\n', rev_id='a3'
195
195
                , timestamp=1132587176.835228920, timezone=-6*3600
196
196
                , committer = 'Joe Foo <joe@foo.com>')
241
241
  simple log message
242
242
""")
243
243
        
 
244
    def test_verbose_log(self):
 
245
        """Verbose log includes changed files
 
246
        
 
247
        bug #4676
 
248
        """
 
249
        b = Branch.initialize(u'.')
 
250
        self.build_tree(['a'])
 
251
        wt = b.working_tree()
 
252
        wt.add('a')
 
253
        # XXX: why does a longer nick show up?
 
254
        b.nick = 'test_verbose_log'
 
255
        wt.commit(message='add a', 
 
256
                  timestamp=1132711707, 
 
257
                  timezone=36000,
 
258
                  committer='Lorem Ipsum <test@example.com>')
 
259
        logfile = file('out.tmp', 'w+')
 
260
        formatter = LongLogFormatter(to_file=logfile)
 
261
        show_log(b, formatter, verbose=True)
 
262
        logfile.flush()
 
263
        logfile.seek(0)
 
264
        log_contents = logfile.read()
 
265
        self.assertEqualDiff(log_contents, '''\
 
266
------------------------------------------------------------
 
267
revno: 1
 
268
committer: Lorem Ipsum <test@example.com>
 
269
branch nick: test_verbose_log
 
270
timestamp: Wed 2005-11-23 12:08:27 +1000
 
271
message:
 
272
  add a
 
273
added:
 
274
  a
 
275
''')