~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to blackbox.py

  • Committer: Aaron Bentley
  • Date: 2006-03-18 17:00:37 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20060318170037-6e2b7eeba66a92f7
Lock repo for branch-history

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
    def test_clean_tree(self):
10
10
        self.runbzr('init')
11
 
        self.runbzr('ignore *~')
12
 
        self.runbzr('ignore *.pyc')
13
11
        self.touch('name')
14
12
        self.touch('name~')
15
13
        assert os.path.lexists('name~')
17
15
        self.runbzr('clean-tree')
18
16
        assert os.path.lexists('name~')
19
17
        assert not os.path.lexists('name')
20
 
        self.touch('name')
21
18
        self.runbzr('clean-tree --detritus')
22
 
        assert os.path.lexists('name')
23
19
        assert not os.path.lexists('name~')
24
20
        assert os.path.lexists('name.pyc')
25
21
        self.runbzr('clean-tree --ignored')
26
 
        assert os.path.lexists('name')
27
 
        assert not os.path.lexists('name.pyc')
28
 
        self.runbzr('clean-tree --unknown')
29
 
        assert not os.path.lexists('name')
30
 
        self.touch('name')
31
 
        self.touch('name~')
32
 
        self.touch('name.pyc')
33
 
        self.runbzr('clean-tree --unknown --ignored')
34
 
        assert not os.path.lexists('name')
35
 
        assert not os.path.lexists('name~')
36
22
        assert not os.path.lexists('name.pyc')
37
23
 
38
24
    def test_shelve(self):
39
25
        self.runbzr('init')
40
26
        self.runbzr('commit -m uc --unchanged')
41
 
        self.runbzr('shelve -r 1 -m foo --all', retcode=3)
42
 
        file('foo', 'wb').write('foo')
 
27
        self.runbzr('shelve -r 1 -m foo', retcode=3)
 
28
        file('foo').write('foo')
43
29
        self.runbzr('add foo')
44
30
        self.runbzr('commit -m foo')
45
 
        self.runbzr('shelve -r 1 -m foo --all', retcode=0)
 
31
        self.runbzr('shelve -r 1 -m foo', retcode=0)
46
32
 
47
33
    def test_fetch_ghosts(self):
48
34
        self.runbzr('init')
84
70
        self.runbzr('branch . my_branch')
85
71
        self.runbzr('fetch-ghosts my_branch')
86
72
 
87
 
    def test_zap(self):
88
 
        self.runbzr('init source')
89
 
        self.runbzr('checkout --lightweight source checkout')
90
 
        self.runbzr('zap checkout')
91
 
        self.assertIs(False, os.path.exists('checkout'))
92
 
        self.assertIs(True, os.path.exists('source'))
93
 
 
94
 
    def test_zap_branch(self):
95
 
        self.runbzr('init source')
96
 
        self.runbzr('checkout --lightweight source checkout')
97
 
        self.runbzr('zap --branch checkout', retcode=3)
98
 
        self.assertIs(True, os.path.exists('checkout'))
99
 
        self.assertIs(True, os.path.exists('source'))
100
 
        self.runbzr('branch source source2')
101
 
        self.runbzr('checkout --lightweight source2 checkout2')
102
 
        self.runbzr('zap --branch checkout2')
103
 
        self.assertIs(False, os.path.exists('checkout2'))
104
 
        self.assertIs(False, os.path.exists('source2'))
105
 
 
106
 
    def test_branches(self):
107
 
        self.runbzr('init source')
108
 
        self.runbzr('init source/subsource')
109
 
        self.runbzr('checkout --lightweight source checkout')
110
 
        self.runbzr('init checkout/subcheckout')
111
 
        self.runbzr('init checkout/.bzr/subcheckout')
112
 
        out = self.capture('branches')
113
 
        lines = out.split('\n')
114
 
        self.assertIs(True, 'source' in lines)
115
 
        self.assertIs(True, 'source/subsource' in lines)
116
 
        self.assertIs(True, 'checkout/subcheckout' in lines)
117
 
        self.assertIs(True, 'checkout' not in lines)
118
 
        self.assertIs(True, 'checkout/.bzr/subcheckout' not in lines)
119
 
 
120
 
    def test_import_upstream(self):
121
 
        self.runbzr('init source')
122
 
        os.mkdir('source/src')
123
 
        f = file('source/src/myfile', 'wb')
124
 
        f.write('hello?')
125
 
        f.close()
126
 
        os.chdir('source')
127
 
        self.runbzr('add')
128
 
        self.runbzr('commit -m hello')
129
 
        self.runbzr('export ../source-0.1.tar.gz')
130
 
        self.runbzr('export ../source-0.1.tar.bz2')
131
 
        self.runbzr('init ../import')
132
 
        os.chdir('../import')
133
 
        self.runbzr('import ../source-0.1.tar.gz')
134
 
        self.failUnlessExists('src/myfile')
135
 
        result = self.runbzr('import ../source-0.1.tar.gz', retcode=3)[1]
136
 
        self.assertContainsRe(result, 'Working tree has uncommitted changes')
137
 
        self.runbzr('commit -m commit')
138
 
        self.runbzr('import ../source-0.1.tar.gz')
139
 
        os.chdir('..')
140
 
        self.runbzr('init import2')
141
 
        self.runbzr('import source-0.1.tar.gz import2')
142
 
        self.failUnlessExists('import2/src/myfile')
143
 
        self.runbzr('import source-0.1.tar.gz import3')
144
 
        self.failUnlessExists('import3/src/myfile')
145
 
        self.runbzr('import source-0.1.tar.bz2 import4')
146
 
        self.failUnlessExists('import4/src/myfile')
147
 
 
148
73
def test_suite():
149
74
    return makeSuite(TestBzrTools)