1
# Copyright (C) 2005 by Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
"""Tests of status command.
20
Most of these depend on the particular formatting used.
24
from bzrlib.selftest import TestCaseInTempDir
25
from bzrlib.revisionspec import RevisionSpec
27
class BranchStatus(TestCaseInTempDir):
29
def test_branch_status(self):
30
"""Basic 'bzr mkdir' operation"""
31
from cStringIO import StringIO
32
from bzrlib.status import show_status
33
from bzrlib.branch import Branch
35
b = Branch.initialize('.')
39
show_status(b, to_file=tof)
40
self.assertEquals(tof.getvalue(), "")
43
self.build_tree(['hello.c', 'bye.c'])
44
b.add_pending_merge('pending@pending-0-0')
45
show_status(b, to_file=tof)
47
self.assertEquals(tof.readlines(),
52
' pending@pending-0-0\n'
55
def test_branch_status_revisions(self):
56
"""Tests branch status with revisions"""
57
from cStringIO import StringIO
58
from bzrlib.status import show_status
59
from bzrlib.branch import Branch
61
b = Branch.initialize('.')
64
self.build_tree(['hello.c', 'bye.c'])
67
b.commit('Test message')
71
revs.append(RevisionSpec(0))
73
show_status(b, to_file=tof, revision=revs)
76
self.assertEquals(tof.readlines(),
81
self.build_tree(['more.c'])
83
b.commit('Another test message')
86
revs.append(RevisionSpec(1))
88
show_status(b, to_file=tof, revision=revs)
91
self.assertEquals(tof.readlines(),