24
from bzrlib import tests
25
from bzrlib.transport import memory
28
class TestCat(tests.TestCaseWithTransport):
25
from bzrlib.tests.blackbox import TestCaseWithTransport
27
class TestCat(TestCaseWithTransport):
30
29
def test_cat(self):
31
30
tree = self.make_branch_and_tree('branch')
70
69
def test_cat_different_id(self):
71
70
"""'cat' works with old and new files"""
72
self.disable_missing_extensions_warning()
73
71
tree = self.make_branch_and_tree('.')
74
72
# the files are named after their path in the revision and
75
73
# current trees later in the test case
128
126
out, err = self.run_bzr_subprocess(['cat', url])
129
127
self.assertEqual('contents of README\n', out)
131
def test_cat_branch_revspec(self):
132
wt = self.make_branch_and_tree('a')
133
self.build_tree(['a/README'])
135
wt.commit('Making sure there is a basis_tree available')
136
wt = self.make_branch_and_tree('b')
139
out, err = self.run_bzr_subprocess(
140
['cat', '-r', 'branch:../a', 'README'])
141
self.assertEqual('contents of a/README\n', out)
143
129
def test_cat_filters(self):
144
130
wt = self.make_branch_and_tree('.')
145
131
self.build_tree(['README'])
196
182
self.assertEqual('contents of README\n', out)
198
184
def test_cat_nonexistent_branch(self):
199
self.vfs_transport_factory = memory.MemoryServer
200
self.run_bzr_error(['^bzr: ERROR: Not a branch'],
201
['cat', self.get_url()])
203
def test_cat_directory(self):
204
wt = self.make_branch_and_tree('a')
205
self.build_tree(['a/README'])
207
wt.commit('Making sure there is a basis_tree available')
209
out, err = self.run_bzr_subprocess(['cat', '--directory=a', 'README'])
210
self.assertEqual('contents of a/README\n', out)
212
def test_cat_remote_directory(self):
213
wt = self.make_branch_and_tree('a')
214
self.build_tree(['a/README'])
216
wt.commit('Making sure there is a basis_tree available')
218
url = self.get_readonly_url() + '/a'
219
out, err = self.run_bzr_subprocess(['cat', '-d', url, 'README'])
220
self.assertEqual('contents of a/README\n', out)
185
if sys.platform == "win32":
186
location = "C:/i/do/not/exist"
188
location = "/i/do/not/exist"
189
self.run_bzr_error(['^bzr: ERROR: Not a branch'], ['cat', location])