bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
1  | 
# Copyright (C) 2005 by Canonical Ltd
 | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
2  | 
# -*- coding: utf-8 -*-
 | 
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
3  | 
|
4  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
5  | 
# it under the terms of the GNU General Public License as published by
 | 
|
6  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
7  | 
# (at your option) any later version.
 | 
|
8  | 
||
9  | 
# This program is distributed in the hope that it will be useful,
 | 
|
10  | 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|
11  | 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|
12  | 
# GNU General Public License for more details.
 | 
|
13  | 
||
14  | 
# You should have received a copy of the GNU General Public License
 | 
|
15  | 
# along with this program; if not, write to the Free Software
 | 
|
16  | 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 | 
|
17  | 
||
18  | 
||
19  | 
"""Black-box tests for bzr.
 | 
|
20  | 
||
21  | 
These check that it behaves properly when it's invoked through the regular
 | 
|
22  | 
command-line interface.
 | 
|
| 
725
by Martin Pool
 doc  | 
23  | 
|
24  | 
This always reinvokes bzr through a new Python interpreter, which is a
 | 
|
25  | 
bit inefficient but arguably tests in a way more representative of how
 | 
|
26  | 
it's normally invoked.
 | 
|
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
27  | 
"""
 | 
28  | 
||
| 
986
by Martin Pool
 - Factor away _parse_master_args, which seems a bit overcomplicated.  | 
29  | 
import sys  | 
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
30  | 
|
| 
986
by Martin Pool
 - Factor away _parse_master_args, which seems a bit overcomplicated.  | 
31  | 
from bzrlib.selftest import TestBase, InTempDir, BzrTestBase  | 
| 
721
by Martin Pool
 - framework for running external commands from unittest suite  | 
32  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
33  | 
|
34  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
35  | 
class ExternalBase(InTempDir):  | 
36  | 
def runbzr(self, args, retcode=0):  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
37  | 
try:  | 
38  | 
import shutil  | 
|
39  | 
from subprocess import call  | 
|
40  | 
except ImportError, e:  | 
|
41  | 
_need_subprocess()  | 
|
42  | 
            raise
 | 
|
43  | 
||
44  | 
if isinstance(args, basestring):  | 
|
45  | 
args = args.split()  | 
|
46  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
47  | 
return self.runcmd(['python', self.BZRPATH,] + args,  | 
48  | 
retcode=retcode)  | 
|
49  | 
||
50  | 
||
51  | 
||
| 
986
by Martin Pool
 - Factor away _parse_master_args, which seems a bit overcomplicated.  | 
52  | 
class TestVersion(BzrTestBase):  | 
53  | 
"""Check output from version command and master option is reasonable"""  | 
|
| 
720
by Martin Pool
 - start moving external tests into the testsuite framework  | 
54  | 
def runTest(self):  | 
| 
721
by Martin Pool
 - framework for running external commands from unittest suite  | 
55  | 
        # output is intentionally passed through to stdout so that we
 | 
56  | 
        # can see the version being tested
 | 
|
| 
986
by Martin Pool
 - Factor away _parse_master_args, which seems a bit overcomplicated.  | 
57  | 
from cStringIO import StringIO  | 
58  | 
save_out = sys.stdout  | 
|
59  | 
try:  | 
|
60  | 
sys.stdout = tmp_out = StringIO()  | 
|
61  | 
||
62  | 
self.run_bzr('version')  | 
|
63  | 
finally:  | 
|
64  | 
sys.stdout = save_out  | 
|
65  | 
||
66  | 
output = tmp_out.getvalue()  | 
|
67  | 
self.log('bzr version output:')  | 
|
68  | 
self.log(output)  | 
|
69  | 
||
70  | 
self.assert_(output.startswith('bzr (bazaar-ng) '))  | 
|
71  | 
self.assertNotEqual(output.index('Canonical'), -1)  | 
|
72  | 
||
73  | 
        # make sure --version is consistent
 | 
|
74  | 
try:  | 
|
75  | 
sys.stdout = tmp_out = StringIO()  | 
|
76  | 
||
77  | 
self.run_bzr('--version')  | 
|
78  | 
finally:  | 
|
79  | 
sys.stdout = save_out  | 
|
80  | 
||
81  | 
self.log('bzr --version output:')  | 
|
82  | 
self.log(tmp_out.getvalue())  | 
|
83  | 
||
84  | 
self.assertEquals(output, tmp_out.getvalue())  | 
|
85  | 
||
86  | 
||
87  | 
||
| 
726
by Martin Pool
 - more rearrangement of blackbox tests  | 
88  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
89  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
90  | 
class HelpCommands(ExternalBase):  | 
| 
727
by Martin Pool
 - move more code to run external commands from testbzr to selftest  | 
91  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
92  | 
self.runbzr('--help')  | 
93  | 
self.runbzr('help')  | 
|
94  | 
self.runbzr('help commands')  | 
|
95  | 
self.runbzr('help help')  | 
|
96  | 
self.runbzr('commit -h')  | 
|
| 
727
by Martin Pool
 - move more code to run external commands from testbzr to selftest  | 
97  | 
|
98  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
99  | 
class InitBranch(ExternalBase):  | 
| 
726
by Martin Pool
 - more rearrangement of blackbox tests  | 
100  | 
def runTest(self):  | 
101  | 
import os  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
102  | 
self.runbzr(['init'])  | 
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
103  | 
|
104  | 
||
105  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
106  | 
class UserIdentity(ExternalBase):  | 
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
107  | 
def runTest(self):  | 
108  | 
        # this should always identify something, if only "john@localhost"
 | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
109  | 
self.runbzr("whoami")  | 
110  | 
self.runbzr("whoami --email")  | 
|
| 
732
by Martin Pool
 - move more tests into bzr selftest  | 
111  | 
self.assertEquals(self.backtick("bzr whoami --email").count('@'),  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
112  | 
1)  | 
113  | 
||
114  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
115  | 
class InvalidCommands(ExternalBase):  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
116  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
117  | 
self.runbzr("pants", retcode=1)  | 
118  | 
self.runbzr("--pants off", retcode=1)  | 
|
119  | 
self.runbzr("diff --message foo", retcode=1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
120  | 
|
121  | 
||
122  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
123  | 
class EmptyCommit(ExternalBase):  | 
| 
885
by Martin Pool
 - commit command refuses unless something is changed or --unchanged is given  | 
124  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
125  | 
self.runbzr("init")  | 
| 
885
by Martin Pool
 - commit command refuses unless something is changed or --unchanged is given  | 
126  | 
self.build_tree(['hello.txt'])  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
127  | 
self.runbzr("commit -m empty", retcode=1)  | 
128  | 
self.runbzr("add hello.txt")  | 
|
129  | 
self.runbzr("commit -m added")  | 
|
| 
885
by Martin Pool
 - commit command refuses unless something is changed or --unchanged is given  | 
130  | 
|
131  | 
||
132  | 
||
| 
906
by Martin Pool
 - split out black-box ignore commands  | 
133  | 
class IgnorePatterns(ExternalBase):  | 
134  | 
def runTest(self):  | 
|
135  | 
from bzrlib.branch import Branch  | 
|
136  | 
||
137  | 
b = Branch('.', init=True)  | 
|
138  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
139  | 
||
140  | 
file('foo.tmp', 'wt').write('tmp files are ignored')  | 
|
141  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
142  | 
assert self.backtick('bzr unknowns') == ''  | 
|
143  | 
||
144  | 
file('foo.c', 'wt').write('int main() {}')  | 
|
145  | 
self.assertEquals(list(b.unknowns()), ['foo.c'])  | 
|
146  | 
assert self.backtick('bzr unknowns') == 'foo.c\n'  | 
|
147  | 
||
148  | 
self.runbzr(['add', 'foo.c'])  | 
|
149  | 
assert self.backtick('bzr unknowns') == ''  | 
|
150  | 
||
151  | 
        # 'ignore' works when creating the .bzignore file
 | 
|
152  | 
file('foo.blah', 'wt').write('blah')  | 
|
153  | 
self.assertEquals(list(b.unknowns()), ['foo.blah'])  | 
|
154  | 
self.runbzr('ignore *.blah')  | 
|
155  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
156  | 
assert file('.bzrignore', 'rb').read() == '*.blah\n'  | 
|
157  | 
||
158  | 
        # 'ignore' works when then .bzrignore file already exists
 | 
|
159  | 
file('garh', 'wt').write('garh')  | 
|
160  | 
self.assertEquals(list(b.unknowns()), ['garh'])  | 
|
161  | 
assert self.backtick('bzr unknowns') == 'garh\n'  | 
|
162  | 
self.runbzr('ignore garh')  | 
|
163  | 
self.assertEquals(list(b.unknowns()), [])  | 
|
164  | 
assert file('.bzrignore', 'rb').read() == '*.blah\ngarh\n'  | 
|
165  | 
||
166  | 
||
167  | 
||
168  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
169  | 
class OldTests(ExternalBase):  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
170  | 
    # old tests moved from ./testbzr
 | 
171  | 
def runTest(self):  | 
|
172  | 
from os import chdir, mkdir  | 
|
173  | 
from os.path import exists  | 
|
174  | 
import os  | 
|
175  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
176  | 
runbzr = self.runbzr  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
177  | 
backtick = self.backtick  | 
178  | 
progress = self.log  | 
|
179  | 
||
180  | 
progress("basic branch creation")  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
181  | 
mkdir('branch1')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
182  | 
chdir('branch1')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
183  | 
runbzr('init')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
184  | 
|
185  | 
self.assertEquals(backtick('bzr root').rstrip(),  | 
|
186  | 
os.path.join(self.test_dir, 'branch1'))  | 
|
187  | 
||
188  | 
progress("status of new file")  | 
|
189  | 
||
190  | 
f = file('test.txt', 'wt')  | 
|
191  | 
f.write('hello world!\n')  | 
|
192  | 
f.close()  | 
|
193  | 
||
194  | 
out = backtick("bzr unknowns")  | 
|
| 
780
by Martin Pool
 - test message improvement  | 
195  | 
self.assertEquals(out, 'test.txt\n')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
196  | 
|
197  | 
out = backtick("bzr status")  | 
|
198  | 
assert out == 'unknown:\n test.txt\n'  | 
|
199  | 
||
200  | 
out = backtick("bzr status --all")  | 
|
201  | 
assert out == "unknown:\n test.txt\n"  | 
|
202  | 
||
203  | 
out = backtick("bzr status test.txt --all")  | 
|
204  | 
assert out == "unknown:\n test.txt\n"  | 
|
205  | 
||
206  | 
f = file('test2.txt', 'wt')  | 
|
207  | 
f.write('goodbye cruel world...\n')  | 
|
208  | 
f.close()  | 
|
209  | 
||
210  | 
out = backtick("bzr status test.txt")  | 
|
211  | 
assert out == "unknown:\n test.txt\n"  | 
|
212  | 
||
213  | 
out = backtick("bzr status")  | 
|
214  | 
assert out == ("unknown:\n"  | 
|
215  | 
" test.txt\n"  | 
|
216  | 
" test2.txt\n")  | 
|
217  | 
||
218  | 
os.unlink('test2.txt')  | 
|
219  | 
||
220  | 
progress("command aliases")  | 
|
221  | 
out = backtick("bzr st --all")  | 
|
222  | 
assert out == ("unknown:\n"  | 
|
223  | 
" test.txt\n")  | 
|
224  | 
||
225  | 
out = backtick("bzr stat")  | 
|
226  | 
assert out == ("unknown:\n"  | 
|
227  | 
" test.txt\n")  | 
|
228  | 
||
229  | 
progress("command help")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
230  | 
runbzr("help st")  | 
231  | 
runbzr("help")  | 
|
232  | 
runbzr("help commands")  | 
|
233  | 
runbzr("help slartibartfast", 1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
234  | 
|
235  | 
out = backtick("bzr help ci")  | 
|
236  | 
out.index('aliases: ')  | 
|
237  | 
||
238  | 
progress("can't rename unversioned file")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
239  | 
runbzr("rename test.txt new-test.txt", 1)  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
240  | 
|
241  | 
progress("adding a file")  | 
|
242  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
243  | 
runbzr("add test.txt")  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
244  | 
assert backtick("bzr unknowns") == ''  | 
245  | 
assert backtick("bzr status --all") == ("added:\n"  | 
|
246  | 
" test.txt\n")  | 
|
247  | 
||
248  | 
progress("rename newly-added file")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
249  | 
runbzr("rename test.txt hello.txt")  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
250  | 
assert os.path.exists("hello.txt")  | 
251  | 
assert not os.path.exists("test.txt")  | 
|
252  | 
||
253  | 
assert backtick("bzr revno") == '0\n'  | 
|
254  | 
||
255  | 
progress("add first revision")  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
256  | 
runbzr(['commit', '-m', 'add first revision'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
257  | 
|
258  | 
progress("more complex renames")  | 
|
259  | 
os.mkdir("sub1")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
260  | 
runbzr("rename hello.txt sub1", 1)  | 
261  | 
runbzr("rename hello.txt sub1/hello.txt", 1)  | 
|
262  | 
runbzr("move hello.txt sub1", 1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
263  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
264  | 
runbzr("add sub1")  | 
265  | 
runbzr("rename sub1 sub2")  | 
|
266  | 
runbzr("move hello.txt sub2")  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
267  | 
assert backtick("bzr relpath sub2/hello.txt") == os.path.join("sub2", "hello.txt\n")  | 
268  | 
||
269  | 
assert exists("sub2")  | 
|
270  | 
assert exists("sub2/hello.txt")  | 
|
271  | 
assert not exists("sub1")  | 
|
272  | 
assert not exists("hello.txt")  | 
|
273  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
274  | 
runbzr(['commit', '-m', 'commit with some things moved to subdirs'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
275  | 
|
276  | 
mkdir("sub1")  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
277  | 
runbzr('add sub1')  | 
278  | 
runbzr('move sub2/hello.txt sub1')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
279  | 
assert not exists('sub2/hello.txt')  | 
280  | 
assert exists('sub1/hello.txt')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
281  | 
runbzr('move sub2 sub1')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
282  | 
assert not exists('sub2')  | 
283  | 
assert exists('sub1/sub2')  | 
|
284  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
285  | 
runbzr(['commit', '-m', 'rename nested subdirectories'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
286  | 
|
287  | 
chdir('sub1/sub2')  | 
|
288  | 
self.assertEquals(backtick('bzr root')[:-1],  | 
|
289  | 
os.path.join(self.test_dir, 'branch1'))  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
290  | 
runbzr('move ../hello.txt .')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
291  | 
assert exists('./hello.txt')  | 
292  | 
assert backtick('bzr relpath hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')  | 
|
293  | 
assert backtick('bzr relpath ../../sub1/sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
294  | 
runbzr(['commit', '-m', 'move to parent directory'])  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
295  | 
chdir('..')  | 
296  | 
assert backtick('bzr relpath sub2/hello.txt') == os.path.join('sub1', 'sub2', 'hello.txt\n')  | 
|
297  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
298  | 
runbzr('move sub2/hello.txt .')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
299  | 
assert exists('hello.txt')  | 
300  | 
||
301  | 
f = file('hello.txt', 'wt')  | 
|
302  | 
f.write('some nice new content\n')  | 
|
303  | 
f.close()  | 
|
304  | 
||
305  | 
f = file('msg.tmp', 'wt')  | 
|
306  | 
f.write('this is my new commit\n')  | 
|
307  | 
f.close()  | 
|
308  | 
||
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
309  | 
runbzr('commit -F msg.tmp')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
310  | 
|
311  | 
assert backtick('bzr revno') == '5\n'  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
312  | 
runbzr('export -r 5 export-5.tmp')  | 
313  | 
runbzr('export export.tmp')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
314  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
315  | 
runbzr('log')  | 
316  | 
runbzr('log -v')  | 
|
| 
909.1.5
by Aaron Bentley
 Fixed log -v (mostly)  | 
317  | 
runbzr('log -v --forward')  | 
318  | 
runbzr('log -m', retcode=1)  | 
|
319  | 
log_out = backtick('bzr log -m commit')  | 
|
320  | 
assert "this is my new commit" in log_out  | 
|
321  | 
assert "rename nested" not in log_out  | 
|
322  | 
assert 'revision-id' not in log_out  | 
|
323  | 
assert 'revision-id' in backtick('bzr log --show-ids -m commit')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
324  | 
|
325  | 
||
326  | 
progress("file with spaces in name")  | 
|
327  | 
mkdir('sub directory')  | 
|
328  | 
file('sub directory/file with spaces ', 'wt').write('see how this works\n')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
329  | 
runbzr('add .')  | 
330  | 
runbzr('diff')  | 
|
331  | 
runbzr('commit -m add-spaces')  | 
|
332  | 
runbzr('check')  | 
|
333  | 
||
334  | 
runbzr('log')  | 
|
335  | 
runbzr('log --forward')  | 
|
336  | 
||
337  | 
runbzr('info')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
338  | 
|
339  | 
||
340  | 
||
341  | 
||
342  | 
||
343  | 
||
344  | 
chdir('..')  | 
|
345  | 
chdir('..')  | 
|
346  | 
progress('branch')  | 
|
| 
907
by Martin Pool
 - try to debug blackbox branch test failure  | 
347  | 
assert os.path.exists('branch1')  | 
348  | 
assert not os.path.exists('branch2')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
349  | 
        # Can't create a branch if it already exists
 | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
350  | 
runbzr('branch branch1', retcode=1)  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
351  | 
        # Can't create a branch if its parent doesn't exist
 | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
352  | 
runbzr('branch /unlikely/to/exist', retcode=1)  | 
353  | 
runbzr('branch branch1 branch2')  | 
|
| 
909.1.3
by aaron.bentley at utoronto
 Fixed branch's --revision argument  | 
354  | 
assert exists('branch2')  | 
355  | 
assert exists('branch2/sub1')  | 
|
356  | 
assert exists('branch2/sub1/hello.txt')  | 
|
357  | 
||
358  | 
runbzr('branch --revision 0 branch1 branch3')  | 
|
359  | 
assert not exists('branch3/sub1/hello.txt')  | 
|
360  | 
runbzr('branch --revision 0..3 branch1 branch4', retcode=1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
361  | 
|
362  | 
progress("pull")  | 
|
363  | 
chdir('branch1')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
364  | 
runbzr('pull', retcode=1)  | 
365  | 
runbzr('pull ../branch2')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
366  | 
chdir('.bzr')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
367  | 
runbzr('pull')  | 
368  | 
runbzr('commit --unchanged -m empty')  | 
|
369  | 
runbzr('pull')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
370  | 
chdir('../../branch2')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
371  | 
runbzr('pull')  | 
372  | 
runbzr('commit --unchanged -m empty')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
373  | 
chdir('../branch1')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
374  | 
runbzr('commit --unchanged -m empty')  | 
375  | 
runbzr('pull', retcode=1)  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
376  | 
chdir ('..')  | 
377  | 
||
378  | 
progress('status after remove')  | 
|
379  | 
mkdir('status-after-remove')  | 
|
380  | 
        # see mail from William Dodé, 2005-05-25
 | 
|
381  | 
        # $ bzr init; touch a; bzr add a; bzr commit -m "add a"
 | 
|
382  | 
        #     * looking for changes...
 | 
|
383  | 
        #     added a
 | 
|
384  | 
        #     * commited r1
 | 
|
385  | 
        #     $ bzr remove a
 | 
|
386  | 
        #     $ bzr status
 | 
|
387  | 
        #     bzr: local variable 'kind' referenced before assignment
 | 
|
388  | 
        #     at /vrac/python/bazaar-ng/bzrlib/diff.py:286 in compare_trees()
 | 
|
389  | 
        #     see ~/.bzr.log for debug information
 | 
|
390  | 
chdir('status-after-remove')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
391  | 
runbzr('init')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
392  | 
file('a', 'w').write('foo')  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
393  | 
runbzr('add a')  | 
394  | 
runbzr(['commit', '-m', 'add a'])  | 
|
395  | 
runbzr('remove a')  | 
|
396  | 
runbzr('status')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
397  | 
|
398  | 
chdir('..')  | 
|
399  | 
||
400  | 
||
401  | 
||
402  | 
progress("recursive and non-recursive add")  | 
|
403  | 
mkdir('no-recurse')  | 
|
404  | 
chdir('no-recurse')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
405  | 
runbzr('init')  | 
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
406  | 
mkdir('foo')  | 
407  | 
fp = os.path.join('foo', 'test.txt')  | 
|
408  | 
f = file(fp, 'w')  | 
|
409  | 
f.write('hello!\n')  | 
|
410  | 
f.close()  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
411  | 
runbzr('add --no-recurse foo')  | 
412  | 
runbzr('file-id foo')  | 
|
413  | 
runbzr('file-id ' + fp, 1) # not versioned yet  | 
|
414  | 
runbzr('commit -m add-dir-only')  | 
|
415  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
416  | 
self.runbzr('file-id ' + fp, 1) # still not versioned  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
417  | 
|
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
418  | 
self.runbzr('add foo')  | 
419  | 
self.runbzr('file-id ' + fp)  | 
|
420  | 
self.runbzr('commit -m add-sub-file')  | 
|
| 
736
by Martin Pool
 - move old blackbox code from testbzr into bzrlib.selftest.blackbox  | 
421  | 
|
422  | 
chdir('..')  | 
|
423  | 
||
424  | 
||
425  | 
||
| 
904
by Martin Pool
 - more selftest external-command fixes  | 
426  | 
class RevertCommand(ExternalBase):  | 
| 
785
by Martin Pool
 - add test for external revert command  | 
427  | 
def runTest(self):  | 
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
428  | 
self.runbzr('init')  | 
| 
785
by Martin Pool
 - add test for external revert command  | 
429  | 
|
430  | 
file('hello', 'wt').write('foo')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
431  | 
self.runbzr('add hello')  | 
432  | 
self.runbzr('commit -m setup hello')  | 
|
| 
785
by Martin Pool
 - add test for external revert command  | 
433  | 
|
434  | 
file('hello', 'wt').write('bar')  | 
|
| 
898
by Martin Pool
 - add new runbzr method for external tests  | 
435  | 
self.runbzr('revert hello')  | 
| 
785
by Martin Pool
 - add test for external revert command  | 
436  | 
self.check_file_contents('hello', 'foo')  | 
437  |