~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_cat.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 21:42:11 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309214211-iqh42x6qcikgd9p3
Reverted now-useless TODO list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
20
20
"""
21
21
 
22
22
import os
23
 
 
24
 
from bzrlib import tests
25
 
from bzrlib.transport import memory
26
 
 
27
 
 
28
 
class TestCat(tests.TestCaseWithTransport):
 
23
import sys
 
24
 
 
25
from bzrlib.tests.blackbox import TestCaseWithTransport
 
26
 
 
27
class TestCat(TestCaseWithTransport):
29
28
 
30
29
    def test_cat(self):
31
30
        tree = self.make_branch_and_tree('branch')
69
68
 
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)
130
128
 
131
 
    def test_cat_branch_revspec(self):
132
 
        wt = self.make_branch_and_tree('a')
133
 
        self.build_tree(['a/README'])
134
 
        wt.add('README')
135
 
        wt.commit('Making sure there is a basis_tree available')
136
 
        wt = self.make_branch_and_tree('b')
137
 
        os.chdir('b')
138
 
 
139
 
        out, err = self.run_bzr_subprocess(
140
 
            ['cat', '-r', 'branch:../a', 'README'])
141
 
        self.assertEqual('contents of a/README\n', out)
142
 
 
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)
197
183
 
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()])
202
 
 
203
 
    def test_cat_directory(self):
204
 
        wt = self.make_branch_and_tree('a')
205
 
        self.build_tree(['a/README'])
206
 
        wt.add('README')
207
 
        wt.commit('Making sure there is a basis_tree available')
208
 
 
209
 
        out, err = self.run_bzr_subprocess(['cat', '--directory=a', 'README'])
210
 
        self.assertEqual('contents of a/README\n', out)
211
 
 
212
 
    def test_cat_remote_directory(self):
213
 
        wt = self.make_branch_and_tree('a')
214
 
        self.build_tree(['a/README'])
215
 
        wt.add('README')
216
 
        wt.commit('Making sure there is a basis_tree available')
217
 
 
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"
 
187
        else:
 
188
            location = "/i/do/not/exist"
 
189
        self.run_bzr_error(['^bzr: ERROR: Not a branch'], ['cat', location])