~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/blackbox.py

  • Committer: Aaron Bentley
  • Date: 2008-03-20 15:36:35 UTC
  • Revision ID: aaron@aaronbentley.com-20080320153635-ywgk5968qpopub9y
cbranch creates parent directories as needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from bzrlib.config import LocationConfig
7
7
from bzrlib.transport import get_transport
8
8
from bzrlib.tests import TestCaseWithTransport, HardlinkFeature
9
 
from bzrlib.plugins.bzrtools import command
10
9
 
11
10
 
12
11
class TestBzrTools(TestCaseWithTransport):
13
 
 
14
 
    def setUp(self):
15
 
        TestCaseWithTransport.setUp(self)
16
 
        command._testing = True
17
 
        self.addCleanup(command._stop_testing)
18
 
 
19
12
    @staticmethod
20
13
    def touch(filename):
21
14
        file(filename, 'wb').write('')
22
15
 
 
16
    def test_clean_tree(self):
 
17
        self.run_bzr('init')
 
18
        self.run_bzr('ignore *~')
 
19
        self.run_bzr('ignore *.pyc')
 
20
        self.touch('name')
 
21
        self.touch('name~')
 
22
        assert os.path.lexists('name~')
 
23
        self.touch('name.pyc')
 
24
        self.run_bzr('clean-tree')
 
25
        assert os.path.lexists('name~')
 
26
        assert not os.path.lexists('name')
 
27
        self.touch('name')
 
28
        self.run_bzr('clean-tree --detritus')
 
29
        assert os.path.lexists('name')
 
30
        assert not os.path.lexists('name~')
 
31
        assert os.path.lexists('name.pyc')
 
32
        self.run_bzr('clean-tree --ignored')
 
33
        assert os.path.lexists('name')
 
34
        assert not os.path.lexists('name.pyc')
 
35
        self.run_bzr('clean-tree --unknown')
 
36
        assert not os.path.lexists('name')
 
37
        self.touch('name')
 
38
        self.touch('name~')
 
39
        self.touch('name.pyc')
 
40
        self.run_bzr('clean-tree --unknown --ignored')
 
41
        assert not os.path.lexists('name')
 
42
        assert not os.path.lexists('name~')
 
43
        assert not os.path.lexists('name.pyc')
 
44
 
23
45
    def test_shelve(self):
24
46
        self.run_bzr('init')
25
47
        self.run_bzr('commit -m uc --unchanged')
26
 
        self.run_bzr('shelve1 -r 1 -m foo --all', retcode=3)
 
48
        self.run_bzr('shelve -r 1 -m foo --all', retcode=3)
27
49
        file('foo', 'wb').write('foo')
28
50
        self.run_bzr('add foo')
29
51
        self.run_bzr('commit -m foo')
30
 
        self.run_bzr('shelve1 -r 1 -m foo --all', retcode=0)
 
52
        self.run_bzr('shelve -r 1 -m foo --all', retcode=0)
31
53
 
32
54
    def test_fetch_ghosts(self):
33
55
        self.run_bzr('init')
34
56
        self.run_bzr('fetch-ghosts .')
35
57
 
36
 
    def test_fetch_ghosts_with_saved(self):
37
 
        wt = self.make_branch_and_tree('.')
38
 
        wt.branch.set_parent('.')
39
 
        self.run_bzr('fetch-ghosts')
40
 
 
41
58
    def test_patch(self):
42
59
        self.run_bzr('init')
43
60
        file('myfile', 'wb').write('hello')
164
181
 
165
182
    def test_cbranch_hardlink(self):
166
183
        self.requireFeature(HardlinkFeature)
167
 
        # Later formats don't support hardlinks.  Boo!
168
 
        source = self.make_branch_and_tree('source', format='1.9')
 
184
        source = self.make_branch_and_tree('source')
169
185
        self.build_tree(['source/file'])
170
186
        source.add('file')
171
187
        source.commit('added file')
182
198
        self.assertEqual(os.lstat(checkout2.abspath('file')).st_ino,
183
199
                         os.lstat(source.abspath('file')).st_ino)
184
200
 
185
 
    def test_create_mirror(self):
186
 
        source = self.make_branch_and_tree('source')
187
 
        source.commit('message')
188
 
        self.run_bzr('create-mirror source target')
189
 
        target = branch.Branch.open('target')
190
 
        self.assertEqual(source.last_revision(), target.last_revision())
191
 
        self.assertEqual(source.branch.base, target.get_public_branch())
192
 
 
193
201
 
194
202
def test_suite():
195
203
    return makeSuite(TestBzrTools)