~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_log.py

[merge] update from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import os
18
18
from cStringIO import StringIO
19
19
 
20
 
from bzrlib.tests import BzrTestBase, TestCaseInTempDir
 
20
from bzrlib.tests import BzrTestBase, TestCaseWithTransport
21
21
from bzrlib.log import LogFormatter, show_log, LongLogFormatter, ShortLogFormatter
22
22
from bzrlib.branch import Branch
23
23
from bzrlib.errors import InvalidRevisionNumber
49
49
        self.logs.append(le)
50
50
 
51
51
 
52
 
class SimpleLogTest(TestCaseInTempDir):
 
52
class SimpleLogTest(TestCaseWithTransport):
53
53
 
54
54
    def checkDelta(self, delta, **kw):
55
55
        """Check the filenames touched by a delta are as expected."""
65
65
            self.assertEquals(expected, got)
66
66
 
67
67
    def test_cur_revno(self):
68
 
        b = Branch(u'.', init=True)
 
68
        wt = self.make_branch_and_tree('.')
 
69
        b = wt.branch
69
70
 
70
71
        lf = LogCatcher()
71
 
        b.working_tree().commit('empty commit')
 
72
        wt.commit('empty commit')
72
73
        show_log(b, lf, verbose=True, start_revision=1, end_revision=1)
73
74
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
74
75
                          start_revision=2, end_revision=1) 
84
85
                          start_revision=1, end_revision=-1) 
85
86
 
86
87
    def test_cur_revno(self):
87
 
        b = Branch.initialize(u'.')
 
88
        wt = self.make_branch_and_tree('.')
 
89
        b = wt.branch
88
90
 
89
91
        lf = LogCatcher()
90
 
        b.working_tree().commit('empty commit')
 
92
        wt.commit('empty commit')
91
93
        show_log(b, lf, verbose=True, start_revision=1, end_revision=1)
92
94
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
93
95
                          start_revision=2, end_revision=1) 
105
107
    def test_simple_log(self):
106
108
        eq = self.assertEquals
107
109
        
108
 
        b = Branch.initialize(u'.')
 
110
        wt = self.make_branch_and_tree('.')
 
111
        b = wt.branch
109
112
 
110
113
        lf = LogCatcher()
111
114
        show_log(b, lf)
175
178
        self.assert_(msg == committed_msg)
176
179
 
177
180
    def test_trailing_newlines(self):
178
 
        b = Branch.initialize(u'.')
 
181
        wt = self.make_branch_and_tree('.')
 
182
        b = wt.branch
179
183
        b.nick='test'
180
184
        wt = b.working_tree()
181
185
        open('a', 'wb').write('hello moto\n')
246
250
        
247
251
        bug #4676
248
252
        """
249
 
        b = Branch.initialize(u'.')
 
253
        wt = self.make_branch_and_tree('.')
 
254
        b = wt.branch
250
255
        self.build_tree(['a'])
251
 
        wt = b.working_tree()
252
256
        wt.add('a')
253
257
        # XXX: why does a longer nick show up?
254
258
        b.nick = 'test_verbose_log'