~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/blackbox.py

  • Committer: Aaron Bentley
  • Date: 2007-12-21 04:23:49 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20071221042349-9sfpmuzu1g1rdshe
Rename from-files to files-from, to match bzr proper

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import os.path
3
3
from unittest import makeSuite
4
4
 
5
 
from bzrlib import branch, osutils, workingtree
6
 
from bzrlib.config import LocationConfig
7
 
from bzrlib.transport import get_transport
8
 
from bzrlib.tests import TestCaseWithTransport, HardlinkFeature
 
5
from bzrlib import branch
 
6
from bzrlib.tests import TestCaseWithTransport
9
7
 
10
8
 
11
9
class TestBzrTools(TestCaseWithTransport):
21
19
        self.touch('name~')
22
20
        assert os.path.lexists('name~')
23
21
        self.touch('name.pyc')
24
 
        self.run_bzr('clean-tree --force')
 
22
        self.run_bzr('clean-tree')
25
23
        assert os.path.lexists('name~')
26
24
        assert not os.path.lexists('name')
27
25
        self.touch('name')
28
 
        self.run_bzr('clean-tree --detritus --force')
 
26
        self.run_bzr('clean-tree --detritus')
29
27
        assert os.path.lexists('name')
30
28
        assert not os.path.lexists('name~')
31
29
        assert os.path.lexists('name.pyc')
32
 
        self.run_bzr('clean-tree --ignored --force')
 
30
        self.run_bzr('clean-tree --ignored')
33
31
        assert os.path.lexists('name')
34
32
        assert not os.path.lexists('name.pyc')
35
 
        self.run_bzr('clean-tree --unknown --force')
 
33
        self.run_bzr('clean-tree --unknown')
36
34
        assert not os.path.lexists('name')
37
35
        self.touch('name')
38
36
        self.touch('name~')
39
37
        self.touch('name.pyc')
40
 
        self.run_bzr('clean-tree --unknown --ignored --force')
 
38
        self.run_bzr('clean-tree --unknown --ignored')
41
39
        assert not os.path.lexists('name')
42
40
        assert not os.path.lexists('name~')
43
41
        assert not os.path.lexists('name.pyc')
134
132
        self.assertIs(True, 'source/subsource' in lines)
135
133
        self.assertIs(True, 'checkout/subcheckout' in lines)
136
134
        self.assertIs(True, 'checkout' not in lines)
 
135
        self.assertIs(True, 'checkout/.bzr/subcheckout' not in lines)
137
136
 
138
137
    def test_import_upstream(self):
139
138
        self.run_bzr('init source')
166
165
        self.run_bzr('import source-0.1 import5')
167
166
        self.failUnlessExists('import5/src/myfile')
168
167
 
169
 
    def test_cbranch(self):
170
 
        source = self.make_branch_and_tree('source')
171
 
        config = LocationConfig(osutils.abspath('target'))
172
 
        config.set_user_option('cbranch_target', 'target_branch')
173
 
        self.run_bzr('cbranch source target')
174
 
        checkout = workingtree.WorkingTree.open('target')
175
 
        self.assertEqual(checkout.branch.base,
176
 
                         get_transport('target').base)
177
 
        self.assertEqual(checkout.branch.get_master_branch().base,
178
 
                         get_transport('target_branch').base)
179
 
        self.assertEqual(checkout.branch.get_master_branch().get_parent(),
180
 
                         get_transport('source').base)
181
 
 
182
 
    def test_cbranch_hardlink(self):
183
 
        self.requireFeature(HardlinkFeature)
184
 
        source = self.make_branch_and_tree('source')
185
 
        self.build_tree(['source/file'])
186
 
        source.add('file')
187
 
        source.commit('added file')
188
 
        config = LocationConfig(osutils.abspath('target'))
189
 
        config.set_user_option('cbranch_target', 'target_branch')
190
 
        self.run_bzr('cbranch source target --lightweight')
191
 
        checkout = workingtree.WorkingTree.open('target')
192
 
        self.assertNotEqual(os.lstat(checkout.abspath('file')).st_ino,
193
 
                            os.lstat(source.abspath('file')).st_ino)
194
 
        config = LocationConfig(osutils.abspath('target2'))
195
 
        config.set_user_option('cbranch_target', 'target_branch2')
196
 
        self.run_bzr('cbranch source target2 --lightweight --hardlink')
197
 
        checkout2 = workingtree.WorkingTree.open('target2')
198
 
        self.assertEqual(os.lstat(checkout2.abspath('file')).st_ino,
199
 
                         os.lstat(source.abspath('file')).st_ino)
200
 
 
201
 
 
202
168
def test_suite():
203
169
    return makeSuite(TestBzrTools)