~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testlog.py

  • Committer: Martin Pool
  • Date: 2005-09-01 02:34:38 UTC
  • Revision ID: mbp@sourcefrog.net-20050901023437-bf791a0ef5edae8d
- old docs: clarify that this is not mainly descended from arch anymore

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib.selftest import BzrTestBase, TestCaseInTempDir
21
21
from bzrlib.log import LogFormatter, show_log, LongLogFormatter
22
22
from bzrlib.branch import Branch
23
 
from bzrlib.errors import InvalidRevisionNumber
24
23
 
25
24
class _LogEntry(object):
26
25
    # should probably move into bzrlib.log?
64
63
            got = [x[0] for x in getattr(delta, n)]
65
64
            self.assertEquals(expected, got)
66
65
 
67
 
    def test_cur_revno(self):
68
 
        b = Branch('.', init=True)
69
 
 
70
 
        lf = LogCatcher()
71
 
        b.commit('empty commit')
72
 
        show_log(b, lf, verbose=True, start_revision=1, end_revision=1)
73
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
74
 
                          start_revision=2, end_revision=1) 
75
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
76
 
                          start_revision=1, end_revision=2) 
77
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
78
 
                          start_revision=0, end_revision=2) 
79
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
80
 
                          start_revision=1, end_revision=0) 
81
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
82
 
                          start_revision=-1, end_revision=1) 
83
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
84
 
                          start_revision=1, end_revision=-1) 
85
 
 
86
 
    def test_cur_revno(self):
87
 
        b = Branch.initialize('.')
88
 
 
89
 
        lf = LogCatcher()
90
 
        b.commit('empty commit')
91
 
        show_log(b, lf, verbose=True, start_revision=1, end_revision=1)
92
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
93
 
                          start_revision=2, end_revision=1) 
94
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
95
 
                          start_revision=1, end_revision=2) 
96
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
97
 
                          start_revision=0, end_revision=2) 
98
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
99
 
                          start_revision=1, end_revision=0) 
100
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
101
 
                          start_revision=-1, end_revision=1) 
102
 
        self.assertRaises(InvalidRevisionNumber, show_log, b, lf,
103
 
                          start_revision=1, end_revision=-1) 
104
 
 
105
66
    def test_simple_log(self):
106
67
        eq = self.assertEquals
107
68
        
108
 
        b = Branch.initialize('.')
 
69
        b = Branch('.', init=True)
109
70
 
110
71
        lf = LogCatcher()
111
72
        show_log(b, lf)
151
112
        self.log('log 2 delta: %r' % d)
152
113
        # self.checkDelta(d, added=['hello'])
153
114
        
154
 
        # commit a log message with control characters
155
 
        msg = "All 8-bit chars: " +  ''.join([unichr(x) for x in range(256)])
156
 
        b.commit(msg)
157
 
        lf = LogCatcher()
158
 
        show_log(b, lf, verbose=True)
159
 
        committed_msg = lf.logs[0].rev.message
160
 
        self.log("escaped commit message: %r", committed_msg)
161
 
        self.assert_(msg != committed_msg)
162
 
        self.assert_(len(committed_msg) > len(msg))