1
# Copyright (C) 2005 by Canonical Ltd
2
# -*- coding: utf-8 -*-
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
"""Black-box tests for bzr log.
23
from bzrlib.tests.blackbox import ExternalBase
26
class TestLog(ExternalBase):
30
self.build_tree(['hello.txt', 'goodbye.txt', 'meep.txt'])
31
self.runbzr("add hello.txt")
32
self.runbzr("commit -m message1 hello.txt")
33
self.runbzr("add goodbye.txt")
34
self.runbzr("commit -m message2 goodbye.txt")
35
self.runbzr("add meep.txt")
36
self.runbzr("commit -m message3 meep.txt")
37
self.full_log = self.runbzr("log")[0]
39
def test_log_null_end_revspec(self):
41
self.assertTrue('revno: 1\n' in self.full_log)
42
self.assertTrue('revno: 2\n' in self.full_log)
43
self.assertTrue('revno: 3\n' in self.full_log)
44
self.assertTrue('message:\n message1\n' in self.full_log)
45
self.assertTrue('message:\n message2\n' in self.full_log)
46
self.assertTrue('message:\n message3\n' in self.full_log)
48
log = self.runbzr("log -r 1..")[0]
49
self.assertEquals(log, self.full_log)
51
def test_log_null_begin_revspec(self):
53
log = self.runbzr("log -r ..3")[0]
54
self.assertEquals(self.full_log, log)
56
def test_log_null_both_revspecs(self):
58
log = self.runbzr("log -r ..")[0]
59
self.assertEquals(self.full_log, log)
61
def test_log_negative_begin_revspec_full_log(self):
63
log = self.runbzr("log -r -3..")[0]
64
self.assertEquals(self.full_log, log)
66
def test_log_negative_both_revspec_full_log(self):
68
log = self.runbzr("log -r -3..-1")[0]
69
self.assertEquals(self.full_log, log)
71
def test_log_negative_both_revspec_partial(self):
73
log = self.runbzr("log -r -3..-2")[0]
74
self.assertTrue('revno: 1\n' in log)
75
self.assertTrue('revno: 2\n' in log)
76
self.assertTrue('revno: 3\n' not in log)
78
def test_log_negative_begin_revspec(self):
80
log = self.runbzr("log -r -2..")[0]
81
self.assertTrue('revno: 1\n' not in log)
82
self.assertTrue('revno: 2\n' in log)
83
self.assertTrue('revno: 3\n' in log)
85
def test_log_postive_revspecs(self):
87
log = self.runbzr("log -r 1..3")[0]
88
self.assertEquals(self.full_log, log)