24
from bzrlib.selftest import InTempDir
24
from bzrlib.selftest import TestCaseInTempDir
25
from bzrlib.revisionspec import RevisionSpec
26
class BranchStatus(InTempDir):
28
"""Basic 'bzr mkdir' operation"""
27
class BranchStatus(TestCaseInTempDir):
29
def test_branch_status(self):
30
"""Test basic branch status"""
29
31
from cStringIO import StringIO
30
32
from bzrlib.status import show_status
31
33
from bzrlib.branch import Branch
33
b = Branch('.', init=True)
35
b = Branch.initialize('.')
35
37
# status with nothing
41
43
self.build_tree(['hello.c', 'bye.c'])
44
b.add_pending_merge('pending@pending-0-0')
42
45
show_status(b, to_file=tof)
44
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(),
96
def test_branch_status_specific_files(self):
97
"""Tests branch status with given specific files"""
98
from cStringIO import StringIO
99
from bzrlib.status import show_status
100
from bzrlib.branch import Branch
102
b = Branch.initialize('.')
104
self.build_tree(['directory/','directory/hello.c', 'bye.c','test.c','dir2/'])
110
show_status(b, to_file=tof)
112
self.assertEquals(tof.readlines(),
116
' directory/hello.c\n'
120
show_status(b, specific_files=['bye.c','test.c','absent.c'], to_file=tof)
122
self.assertEquals(tof.readlines(),
128
show_status(b, specific_files=['directory'], to_file=tof)
130
self.assertEquals(tof.readlines(),
132
' directory/hello.c\n'
135
show_status(b, specific_files=['dir2'], to_file=tof)
137
self.assertEquals(tof.readlines(),