~ubuntu-branches/ubuntu/lucid/bzr/lucid-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_log.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeff Bailey
  • Date: 2006-03-20 08:31:00 UTC
  • mfrom: (1.1.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060320083100-ovdi2ssuw0epcx8s
Tags: 0.8~200603200831-0ubuntu1
* Snapshot uploaded to Dapper at Martin Pool's request.

* Disable testsuite for upload.  Fakeroot and the testsuite don't
  play along.

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)
112
115
        # no entries yet
113
116
        eq(lf.logs, [])
114
117
 
115
 
        b.working_tree().commit('empty commit')
 
118
        wt.commit('empty commit')
116
119
        lf = LogCatcher()
117
120
        show_log(b, lf, verbose=True)
118
121
        eq(len(lf.logs), 1)
123
126
        self.checkDelta(d)
124
127
 
125
128
        self.build_tree(['hello'])
126
 
        b.working_tree().add('hello')
127
 
        b.working_tree().commit('add one file')
 
129
        wt.add('hello')
 
130
        wt.commit('add one file')
128
131
 
129
132
        lf = StringIO()
130
133
        # log using regular thing
152
155
        # commit a log message with control characters
153
156
        msg = "All 8-bit chars: " +  ''.join([unichr(x) for x in range(256)])
154
157
        self.log("original commit message: %r", msg)
155
 
        b.working_tree().commit(msg)
 
158
        wt.commit(msg)
156
159
        lf = LogCatcher()
157
160
        show_log(b, lf, verbose=True)
158
161
        committed_msg = lf.logs[0].rev.message
167
170
        # valid XML 1.0 characters.
168
171
        msg = "\x09" + ''.join([unichr(x) for x in range(0x20, 256)])
169
172
        self.log("original commit message: %r", msg)
170
 
        b.working_tree().commit(msg)
 
173
        wt.commit(msg)
171
174
        lf = LogCatcher()
172
175
        show_log(b, lf, verbose=True)
173
176
        committed_msg = lf.logs[0].rev.message
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
 
        wt = b.working_tree()
181
184
        open('a', 'wb').write('hello moto\n')
182
185
        wt.add('a')
183
186
        wt.commit('simple log message', rev_id='a1'
246
249
        
247
250
        bug #4676
248
251
        """
249
 
        b = Branch.initialize(u'.')
 
252
        wt = self.make_branch_and_tree('.')
 
253
        b = wt.branch
250
254
        self.build_tree(['a'])
251
 
        wt = b.working_tree()
252
255
        wt.add('a')
253
256
        # XXX: why does a longer nick show up?
254
257
        b.nick = 'test_verbose_log'