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 |
||
|
1185.46.9
by Aaron Bentley
Added verbose option to bzr add, to list all ignored files. |
18 |
# Mr. Smoketoomuch: I'm sorry?
|
19 |
# Mr. Bounder: You'd better cut down a little then.
|
|
20 |
# Mr. Smoketoomuch: Oh, I see! Smoke too much so I'd better cut down a little
|
|
21 |
# then!
|
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
22 |
|
23 |
"""Black-box tests for bzr.
|
|
24 |
||
25 |
These check that it behaves properly when it's invoked through the regular
|
|
|
1403
by Robert Collins
merge from martin |
26 |
command-line interface. This doesn't actually run a new interpreter but
|
|
1393.1.45
by Martin Pool
doc |
27 |
rather starts again from the run_bzr function.
|
|
720
by Martin Pool
- start moving external tests into the testsuite framework |
28 |
"""
|
29 |
||
|
1393.1.45
by Martin Pool
doc |
30 |
|
|
1185.33.14
by Martin Pool
doc |
31 |
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
32 |
# Note: Please don't add new tests here, it's too big and bulky. Instead add
|
|
|
1512
by Robert Collins
Merge from Martin. Adjust check to work with HTTP again. |
33 |
# them into small suites in bzrlib.tests.blackbox.test_FOO for the particular
|
34 |
# UI command/aspect that is being tested.
|
|
|
1185.33.14
by Martin Pool
doc |
35 |
|
36 |
||
|
1185.1.25
by Robert Collins
merge David Clymer's patch for TestCaseInTestDir.runcmd |
37 |
from cStringIO import StringIO |
|
1185.1.41
by Robert Collins
massive patch from Alexander Belchenko - many PEP8 fixes, removes unused function uuid |
38 |
import os |
|
1185.16.43
by Martin Pool
- clean up handling of option objects |
39 |
import re |
|
1185.10.1
by Aaron Bentley
Added --basis option to bzr branch |
40 |
import shutil |
|
974.1.26
by aaron.bentley at utoronto
merged mbp@sourcefrog.net-20050817233101-0939da1cf91f2472 |
41 |
import sys |
|
1161
by Martin Pool
- add test that 'bzr add' reports the files as they're added |
42 |
|
43 |
from bzrlib.branch import Branch |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
44 |
import bzrlib.bzrdir as bzrdir |
|
1393.3.3
by Jelmer Vernooij
Add test for empty commit messages. |
45 |
from bzrlib.errors import BzrCommandError |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
46 |
from bzrlib.osutils import has_symlinks, pathjoin |
|
1185.31.25
by John Arbash Meinel
Renamed all of the tests from selftest/foo.py to tests/test_foo.py |
47 |
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver |
|
1530.1.7
by Robert Collins
merge integration. |
48 |
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer |
|
1513
by Robert Collins
Blackbox tests are maintained within the bzrlib.tests.blackbox directory. |
49 |
from bzrlib.tests.blackbox import ExternalBase |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
50 |
from bzrlib.workingtree import WorkingTree |
|
1142
by Martin Pool
- remove dead code from blackbox tests (pychecker) |
51 |
|
|
1185.65.29
by Robert Collins
Implement final review suggestions. |
52 |
|
|
1102
by Martin Pool
- merge test refactoring from robertc |
53 |
class TestCommands(ExternalBase): |
54 |
||
55 |
def test_whoami(self): |
|
|
732
by Martin Pool
- move more tests into bzr selftest |
56 |
# this should always identify something, if only "john@localhost"
|
|
898
by Martin Pool
- add new runbzr method for external tests |
57 |
self.runbzr("whoami") |
58 |
self.runbzr("whoami --email") |
|
|
1074
by Martin Pool
- check for email address in BRANCH_ROOT/.bzr/email, so you can |
59 |
|
60 |
self.assertEquals(self.runbzr("whoami --email", |
|
61 |
backtick=True).count('@'), 1) |
|
62 |
||
|
1102
by Martin Pool
- merge test refactoring from robertc |
63 |
def test_whoami_branch(self): |
64 |
"""branch specific user identity works.""" |
|
|
1074
by Martin Pool
- check for email address in BRANCH_ROOT/.bzr/email, so you can |
65 |
self.runbzr('init') |
66 |
f = file('.bzr/email', 'wt') |
|
67 |
f.write('Branch Identity <branch@identi.ty>') |
|
68 |
f.close() |
|
|
1185.6.1
by John Arbash Meinel
Updated the whomai test to handle BZREMAIL |
69 |
bzr_email = os.environ.get('BZREMAIL') |
70 |
if bzr_email is not None: |
|
71 |
del os.environ['BZREMAIL'] |
|
|
1074
by Martin Pool
- check for email address in BRANCH_ROOT/.bzr/email, so you can |
72 |
whoami = self.runbzr("whoami",backtick=True) |
73 |
whoami_email = self.runbzr("whoami --email",backtick=True) |
|
74 |
self.assertTrue(whoami.startswith('Branch Identity <branch@identi.ty>')) |
|
75 |
self.assertTrue(whoami_email.startswith('branch@identi.ty')) |
|
|
1185.6.1
by John Arbash Meinel
Updated the whomai test to handle BZREMAIL |
76 |
# Verify that the environment variable overrides the value
|
77 |
# in the file
|
|
78 |
os.environ['BZREMAIL'] = 'Different ID <other@environ.ment>' |
|
79 |
whoami = self.runbzr("whoami",backtick=True) |
|
80 |
whoami_email = self.runbzr("whoami --email",backtick=True) |
|
81 |
self.assertTrue(whoami.startswith('Different ID <other@environ.ment>')) |
|
82 |
self.assertTrue(whoami_email.startswith('other@environ.ment')) |
|
83 |
if bzr_email is not None: |
|
84 |
os.environ['BZREMAIL'] = bzr_email |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
85 |
|
|
1185.35.14
by Aaron Bentley
Implemented nick command |
86 |
def test_nick_command(self): |
87 |
"""bzr nick for viewing, setting nicknames""" |
|
88 |
os.mkdir('me.dev') |
|
89 |
os.chdir('me.dev') |
|
90 |
self.runbzr('init') |
|
91 |
nick = self.runbzr("nick",backtick=True) |
|
92 |
self.assertEqual(nick, 'me.dev\n') |
|
93 |
nick = self.runbzr("nick moo") |
|
94 |
nick = self.runbzr("nick",backtick=True) |
|
95 |
self.assertEqual(nick, 'moo\n') |
|
96 |
||
|
1102
by Martin Pool
- merge test refactoring from robertc |
97 |
def test_invalid_commands(self): |
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
98 |
self.runbzr("pants", retcode=3) |
99 |
self.runbzr("--pants off", retcode=3) |
|
100 |
self.runbzr("diff --message foo", retcode=3) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
101 |
|
|
1507
by Robert Collins
Test case for removing deleted contents from Wouter van Heyst. |
102 |
def test_remove_deleted(self): |
103 |
self.runbzr("init") |
|
104 |
self.build_tree(['a']) |
|
105 |
self.runbzr(['add', 'a']) |
|
106 |
self.runbzr(['commit', '-m', 'added a']) |
|
107 |
os.unlink('a') |
|
108 |
self.runbzr(['remove', 'a']) |
|
109 |
||
|
1102
by Martin Pool
- merge test refactoring from robertc |
110 |
def test_ignore_patterns(self): |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
111 |
self.runbzr('init') |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
112 |
self.assertEquals(self.capture('unknowns'), '') |
|
906
by Martin Pool
- split out black-box ignore commands |
113 |
|
114 |
file('foo.tmp', 'wt').write('tmp files are ignored') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
115 |
self.assertEquals(self.capture('unknowns'), '') |
|
906
by Martin Pool
- split out black-box ignore commands |
116 |
|
117 |
file('foo.c', 'wt').write('int main() {}') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
118 |
self.assertEquals(self.capture('unknowns'), 'foo.c\n') |
|
906
by Martin Pool
- split out black-box ignore commands |
119 |
|
120 |
self.runbzr(['add', 'foo.c']) |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
121 |
self.assertEquals(self.capture('unknowns'), '') |
|
906
by Martin Pool
- split out black-box ignore commands |
122 |
|
123 |
# 'ignore' works when creating the .bzignore file
|
|
124 |
file('foo.blah', 'wt').write('blah') |
|
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
125 |
self.assertEquals(self.capture('unknowns'), 'foo.blah\n') |
|
906
by Martin Pool
- split out black-box ignore commands |
126 |
self.runbzr('ignore *.blah') |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
127 |
self.assertEquals(self.capture('unknowns'), '') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
128 |
self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\n') |
|
906
by Martin Pool
- split out black-box ignore commands |
129 |
|
130 |
# 'ignore' works when then .bzrignore file already exists
|
|
131 |
file('garh', 'wt').write('garh') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
132 |
self.assertEquals(self.capture('unknowns'), 'garh\n') |
|
906
by Martin Pool
- split out black-box ignore commands |
133 |
self.runbzr('ignore garh') |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
134 |
self.assertEquals(self.capture('unknowns'), '') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
135 |
self.assertEquals(file('.bzrignore', 'rU').read(), '*.blah\ngarh\n') |
|
1102
by Martin Pool
- merge test refactoring from robertc |
136 |
|
137 |
def test_revert(self): |
|
138 |
self.runbzr('init') |
|
139 |
||
140 |
file('hello', 'wt').write('foo') |
|
141 |
self.runbzr('add hello') |
|
142 |
self.runbzr('commit -m setup hello') |
|
143 |
||
144 |
file('goodbye', 'wt').write('baz') |
|
145 |
self.runbzr('add goodbye') |
|
146 |
self.runbzr('commit -m setup goodbye') |
|
|
1092.2.18
by Robert Collins
merge from symlink branch |
147 |
|
|
1102
by Martin Pool
- merge test refactoring from robertc |
148 |
file('hello', 'wt').write('bar') |
149 |
file('goodbye', 'wt').write('qux') |
|
150 |
self.runbzr('revert hello') |
|
151 |
self.check_file_contents('hello', 'foo') |
|
152 |
self.check_file_contents('goodbye', 'qux') |
|
153 |
self.runbzr('revert') |
|
154 |
self.check_file_contents('goodbye', 'baz') |
|
155 |
||
156 |
os.mkdir('revertdir') |
|
157 |
self.runbzr('add revertdir') |
|
158 |
self.runbzr('commit -m f') |
|
159 |
os.rmdir('revertdir') |
|
160 |
self.runbzr('revert') |
|
161 |
||
|
1185.31.49
by John Arbash Meinel
Some corrections using the new osutils.rename. **ALL TESTS PASS** |
162 |
if has_symlinks(): |
163 |
os.symlink('/unlikely/to/exist', 'symlink') |
|
164 |
self.runbzr('add symlink') |
|
165 |
self.runbzr('commit -m f') |
|
166 |
os.unlink('symlink') |
|
167 |
self.runbzr('revert') |
|
168 |
self.failUnlessExists('symlink') |
|
169 |
os.unlink('symlink') |
|
170 |
os.symlink('a-different-path', 'symlink') |
|
171 |
self.runbzr('revert') |
|
172 |
self.assertEqual('/unlikely/to/exist', |
|
173 |
os.readlink('symlink')) |
|
174 |
else: |
|
175 |
self.log("skipping revert symlink tests") |
|
|
1092.2.18
by Robert Collins
merge from symlink branch |
176 |
|
|
1185.5.8
by John Arbash Meinel
Fixed bzr revert with the new RevisionSpec code. |
177 |
file('hello', 'wt').write('xyz') |
178 |
self.runbzr('commit -m xyz hello') |
|
179 |
self.runbzr('revert -r 1 hello') |
|
180 |
self.check_file_contents('hello', 'foo') |
|
181 |
self.runbzr('revert hello') |
|
182 |
self.check_file_contents('hello', 'xyz') |
|
|
1185.8.5
by Aaron Bentley
Fixed non-tree-root bug in branch, revert, merge |
183 |
os.chdir('revertdir') |
184 |
self.runbzr('revert') |
|
185 |
os.chdir('..') |
|
186 |
||
|
1185.1.8
by Robert Collins
David Clymers patch to use rename rather than mv for two argument non-directory target bzr mv calls. |
187 |
def test_mv_modes(self): |
|
1102
by Martin Pool
- merge test refactoring from robertc |
188 |
"""Test two modes of operation for mv""" |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
189 |
self.runbzr('init') |
|
1102
by Martin Pool
- merge test refactoring from robertc |
190 |
self.build_tree(['a', 'c', 'subdir/']) |
|
1185.1.31
by Robert Collins
Change the use of run_bzr to run_bzr_captured in blackbox tests - inspired by David Clymers patch to change run_bzr usage to runbzr |
191 |
self.run_bzr_captured(['add', self.test_dir]) |
192 |
self.run_bzr_captured(['mv', 'a', 'b']) |
|
193 |
self.run_bzr_captured(['mv', 'b', 'subdir']) |
|
194 |
self.run_bzr_captured(['mv', 'subdir/b', 'a']) |
|
195 |
self.run_bzr_captured(['mv', 'a', 'c', 'subdir']) |
|
196 |
self.run_bzr_captured(['mv', 'subdir/a', 'subdir/newa']) |
|
|
1102
by Martin Pool
- merge test refactoring from robertc |
197 |
|
198 |
def test_main_version(self): |
|
199 |
"""Check output from version command and master option is reasonable""" |
|
200 |
# output is intentionally passed through to stdout so that we
|
|
201 |
# can see the version being tested
|
|
202 |
output = self.runbzr('version', backtick=1) |
|
203 |
self.log('bzr version output:') |
|
204 |
self.log(output) |
|
205 |
self.assert_(output.startswith('bzr (bazaar-ng) ')) |
|
206 |
self.assertNotEqual(output.index('Canonical'), -1) |
|
207 |
# make sure --version is consistent
|
|
208 |
tmp_output = self.runbzr('--version', backtick=1) |
|
209 |
self.log('bzr --version output:') |
|
210 |
self.log(tmp_output) |
|
211 |
self.assertEquals(output, tmp_output) |
|
|
906
by Martin Pool
- split out black-box ignore commands |
212 |
|
|
1092.1.39
by Robert Collins
merge from mpool |
213 |
def example_branch(test): |
214 |
test.runbzr('init') |
|
215 |
file('hello', 'wt').write('foo') |
|
216 |
test.runbzr('add hello') |
|
217 |
test.runbzr('commit -m setup hello') |
|
218 |
file('goodbye', 'wt').write('baz') |
|
219 |
test.runbzr('add goodbye') |
|
220 |
test.runbzr('commit -m setup goodbye') |
|
221 |
||
|
1185.12.1
by Aaron Bentley
Fixed export |
222 |
def test_export(self): |
223 |
os.mkdir('branch') |
|
224 |
os.chdir('branch') |
|
225 |
self.example_branch() |
|
226 |
self.runbzr('export ../latest') |
|
227 |
self.assertEqual(file('../latest/goodbye', 'rt').read(), 'baz') |
|
228 |
self.runbzr('export ../first -r 1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
229 |
self.assert_(not os.path.exists('../first/goodbye')) |
|
1185.12.1
by Aaron Bentley
Fixed export |
230 |
self.assertEqual(file('../first/hello', 'rt').read(), 'foo') |
231 |
self.runbzr('export ../first.gz -r 1') |
|
232 |
self.assertEqual(file('../first.gz/hello', 'rt').read(), 'foo') |
|
233 |
self.runbzr('export ../first.bz2 -r 1') |
|
234 |
self.assertEqual(file('../first.bz2/hello', 'rt').read(), 'foo') |
|
|
1185.31.13
by John Arbash Meinel
Updated the test to also test zip exports. Fixed some small bugs exposed by test suite. |
235 |
|
236 |
from tarfile import TarFile |
|
|
1185.12.1
by Aaron Bentley
Fixed export |
237 |
self.runbzr('export ../first.tar -r 1') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
238 |
self.assert_(os.path.isfile('../first.tar')) |
|
1185.12.1
by Aaron Bentley
Fixed export |
239 |
tf = TarFile('../first.tar') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
240 |
self.assert_('first/hello' in tf.getnames(), tf.getnames()) |
|
1185.12.1
by Aaron Bentley
Fixed export |
241 |
self.assertEqual(tf.extractfile('first/hello').read(), 'foo') |
242 |
self.runbzr('export ../first.tar.gz -r 1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
243 |
self.assert_(os.path.isfile('../first.tar.gz')) |
|
1185.12.1
by Aaron Bentley
Fixed export |
244 |
self.runbzr('export ../first.tbz2 -r 1') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
245 |
self.assert_(os.path.isfile('../first.tbz2')) |
|
1185.12.1
by Aaron Bentley
Fixed export |
246 |
self.runbzr('export ../first.tar.bz2 -r 1') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
247 |
self.assert_(os.path.isfile('../first.tar.bz2')) |
|
1185.12.1
by Aaron Bentley
Fixed export |
248 |
self.runbzr('export ../first.tar.tbz2 -r 1') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
249 |
self.assert_(os.path.isfile('../first.tar.tbz2')) |
|
1185.31.13
by John Arbash Meinel
Updated the test to also test zip exports. Fixed some small bugs exposed by test suite. |
250 |
|
|
1185.12.1
by Aaron Bentley
Fixed export |
251 |
from bz2 import BZ2File |
252 |
tf = TarFile('../first.tar.tbz2', |
|
253 |
fileobj=BZ2File('../first.tar.tbz2', 'r')) |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
254 |
self.assert_('first.tar/hello' in tf.getnames(), tf.getnames()) |
|
1185.12.1
by Aaron Bentley
Fixed export |
255 |
self.assertEqual(tf.extractfile('first.tar/hello').read(), 'foo') |
256 |
self.runbzr('export ../first2.tar -r 1 --root pizza') |
|
257 |
tf = TarFile('../first2.tar') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
258 |
self.assert_('pizza/hello' in tf.getnames(), tf.getnames()) |
|
1185.12.1
by Aaron Bentley
Fixed export |
259 |
|
|
1185.31.13
by John Arbash Meinel
Updated the test to also test zip exports. Fixed some small bugs exposed by test suite. |
260 |
from zipfile import ZipFile |
261 |
self.runbzr('export ../first.zip -r 1') |
|
262 |
self.failUnlessExists('../first.zip') |
|
263 |
zf = ZipFile('../first.zip') |
|
264 |
self.assert_('first/hello' in zf.namelist(), zf.namelist()) |
|
265 |
self.assertEqual(zf.read('first/hello'), 'foo') |
|
266 |
||
267 |
self.runbzr('export ../first2.zip -r 1 --root pizza') |
|
268 |
zf = ZipFile('../first2.zip') |
|
269 |
self.assert_('pizza/hello' in zf.namelist(), zf.namelist()) |
|
270 |
||
271 |
self.runbzr('export ../first-zip --format=zip -r 1') |
|
272 |
zf = ZipFile('../first-zip') |
|
273 |
self.assert_('first-zip/hello' in zf.namelist(), zf.namelist()) |
|
274 |
||
|
1185.8.4
by Aaron Bentley
Fixed branch -r |
275 |
def test_branch(self): |
276 |
"""Branch from one branch to another.""" |
|
277 |
os.mkdir('a') |
|
278 |
os.chdir('a') |
|
279 |
self.example_branch() |
|
280 |
os.chdir('..') |
|
281 |
self.runbzr('branch a b') |
|
|
1442.1.71
by Robert Collins
'bzr branch' sets the branch-name, |
282 |
self.assertFileEqual('b\n', 'b/.bzr/branch-name') |
|
1185.8.4
by Aaron Bentley
Fixed branch -r |
283 |
self.runbzr('branch a c -r 1') |
|
1185.10.1
by Aaron Bentley
Added --basis option to bzr branch |
284 |
os.chdir('b') |
285 |
self.runbzr('commit -m foo --unchanged') |
|
286 |
os.chdir('..') |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
287 |
|
288 |
def test_branch_basis(self): |
|
289 |
# ensure that basis really does grab from the basis by having incomplete source
|
|
290 |
tree = self.make_branch_and_tree('commit_tree') |
|
291 |
self.build_tree(['foo'], transport=tree.bzrdir.transport.clone('..')) |
|
292 |
tree.add('foo') |
|
293 |
tree.commit('revision 1', rev_id='1') |
|
294 |
source = self.make_branch_and_tree('source') |
|
295 |
# this gives us an incomplete repository
|
|
296 |
tree.bzrdir.open_repository().copy_content_into(source.branch.repository) |
|
297 |
tree.commit('revision 2', rev_id='2', allow_pointless=True) |
|
298 |
tree.bzrdir.open_branch().copy_content_into(source.branch) |
|
299 |
tree.copy_content_into(source) |
|
300 |
self.assertFalse(source.branch.repository.has_revision('2')) |
|
301 |
dir = source.bzrdir |
|
302 |
self.runbzr('branch source target --basis commit_tree') |
|
303 |
target = bzrdir.BzrDir.open('target') |
|
304 |
self.assertEqual('2', target.open_branch().last_revision()) |
|
305 |
self.assertEqual('2', target.open_workingtree().last_revision()) |
|
306 |
self.assertTrue(target.open_branch().repository.has_revision('2')) |
|
|
1185.8.4
by Aaron Bentley
Fixed branch -r |
307 |
|
|
1092.1.39
by Robert Collins
merge from mpool |
308 |
def test_merge(self): |
309 |
from bzrlib.branch import Branch |
|
|
1139
by Martin Pool
- merge in merge improvements and additional tests |
310 |
|
|
1092.1.39
by Robert Collins
merge from mpool |
311 |
os.mkdir('a') |
312 |
os.chdir('a') |
|
313 |
self.example_branch() |
|
314 |
os.chdir('..') |
|
315 |
self.runbzr('branch a b') |
|
316 |
os.chdir('b') |
|
317 |
file('goodbye', 'wt').write('quux') |
|
318 |
self.runbzr(['commit', '-m', "more u's are always good"]) |
|
319 |
||
320 |
os.chdir('../a') |
|
321 |
file('hello', 'wt').write('quuux') |
|
322 |
# We can't merge when there are in-tree changes
|
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
323 |
self.runbzr('merge ../b', retcode=3) |
|
1092.1.39
by Robert Collins
merge from mpool |
324 |
self.runbzr(['commit', '-m', "Like an epidemic of u's"]) |
|
1185.12.84
by Aaron Bentley
got merge type selection under test |
325 |
self.runbzr('merge ../b -r last:1..last:1 --merge-type blooof', |
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
326 |
retcode=3) |
|
1185.12.84
by Aaron Bentley
got merge type selection under test |
327 |
self.runbzr('merge ../b -r last:1..last:1 --merge-type merge3') |
328 |
self.runbzr('revert --no-backup') |
|
329 |
self.runbzr('merge ../b -r last:1..last:1 --merge-type weave') |
|
|
1185.12.46
by Aaron Bentley
Fixed -r brokenness in merge |
330 |
self.runbzr('revert --no-backup') |
|
1185.24.3
by Aaron Bentley
Integrated reprocessing into the rest of the merge stuff |
331 |
self.runbzr('merge ../b -r last:1..last:1 --reprocess') |
332 |
self.runbzr('revert --no-backup') |
|
|
1185.12.46
by Aaron Bentley
Fixed -r brokenness in merge |
333 |
self.runbzr('merge ../b -r last:1') |
|
1092.1.39
by Robert Collins
merge from mpool |
334 |
self.check_file_contents('goodbye', 'quux') |
335 |
# Merging a branch pulls its revision into the tree
|
|
|
1508.1.19
by Robert Collins
Give format3 working trees their own last-revision marker. |
336 |
a = WorkingTree.open('.') |
|
1185.11.5
by John Arbash Meinel
Merged up-to-date against mainline, still broken. |
337 |
b = Branch.open('../b') |
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
338 |
a.branch.repository.get_revision_xml(b.last_revision()) |
339 |
self.log('pending merges: %s', a.pending_merges()) |
|
340 |
self.assertEquals(a.pending_merges(), |
|
|
1457.1.14
by Robert Collins
Move pending_merges() to WorkingTree. |
341 |
[b.last_revision()]) |
|
1185.12.77
by Aaron Bentley
Prevented all ancestors from being marked as pending merges |
342 |
self.runbzr('commit -m merged') |
343 |
self.runbzr('merge ../b -r last:1') |
|
|
1534.4.36
by Robert Collins
Finish deprecating Branch.working_tree() |
344 |
self.assertEqual(a.pending_merges(), []) |
|
1161
by Martin Pool
- add test that 'bzr add' reports the files as they're added |
345 |
|
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
346 |
def test_merge_with_missing_file(self): |
347 |
"""Merge handles missing file conflicts""" |
|
348 |
os.mkdir('a') |
|
349 |
os.chdir('a') |
|
350 |
os.mkdir('sub') |
|
351 |
print >> file('sub/a.txt', 'wb'), "hello" |
|
|
1185.10.10
by Aaron Bentley
Handled modified files missing from THIS |
352 |
print >> file('b.txt', 'wb'), "hello" |
353 |
print >> file('sub/c.txt', 'wb'), "hello" |
|
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
354 |
self.runbzr('init') |
355 |
self.runbzr('add') |
|
356 |
self.runbzr(('commit', '-m', 'added a')) |
|
357 |
self.runbzr('branch . ../b') |
|
358 |
print >> file('sub/a.txt', 'ab'), "there" |
|
|
1185.10.10
by Aaron Bentley
Handled modified files missing from THIS |
359 |
print >> file('b.txt', 'ab'), "there" |
360 |
print >> file('sub/c.txt', 'ab'), "there" |
|
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
361 |
self.runbzr(('commit', '-m', 'Added there')) |
362 |
os.unlink('sub/a.txt') |
|
|
1185.10.10
by Aaron Bentley
Handled modified files missing from THIS |
363 |
os.unlink('sub/c.txt') |
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
364 |
os.rmdir('sub') |
|
1185.10.10
by Aaron Bentley
Handled modified files missing from THIS |
365 |
os.unlink('b.txt') |
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
366 |
self.runbzr(('commit', '-m', 'Removed a.txt')) |
367 |
os.chdir('../b') |
|
368 |
print >> file('sub/a.txt', 'ab'), "something" |
|
|
1185.10.10
by Aaron Bentley
Handled modified files missing from THIS |
369 |
print >> file('b.txt', 'ab'), "something" |
370 |
print >> file('sub/c.txt', 'ab'), "something" |
|
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
371 |
self.runbzr(('commit', '-m', 'Modified a.txt')) |
|
1476
by Robert Collins
Merge now has a retcode of 1 when conflicts occur. (Robert Collins) |
372 |
self.runbzr('merge ../a/', retcode=1) |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
373 |
self.assert_(os.path.exists('sub/a.txt.THIS')) |
374 |
self.assert_(os.path.exists('sub/a.txt.BASE')) |
|
|
1185.10.10
by Aaron Bentley
Handled modified files missing from THIS |
375 |
os.chdir('../a') |
|
1476
by Robert Collins
Merge now has a retcode of 1 when conflicts occur. (Robert Collins) |
376 |
self.runbzr('merge ../b/', retcode=1) |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
377 |
self.assert_(os.path.exists('sub/a.txt.OTHER')) |
378 |
self.assert_(os.path.exists('sub/a.txt.BASE')) |
|
|
1185.10.8
by Aaron Bentley
Conflict handling where OTHER is deleted |
379 |
|
|
1185.33.33
by Martin Pool
[patch] add 'bzr inventory --kind directory'; remove 'bzr directories' |
380 |
def test_inventory(self): |
381 |
bzr = self.runbzr |
|
382 |
def output_equals(value, *args): |
|
383 |
out = self.runbzr(['inventory'] + list(args), backtick=True) |
|
384 |
self.assertEquals(out, value) |
|
385 |
||
386 |
bzr('init') |
|
387 |
open('a', 'wb').write('hello\n') |
|
388 |
os.mkdir('b') |
|
389 |
||
390 |
bzr('add a b') |
|
391 |
bzr('commit -m add') |
|
392 |
||
393 |
output_equals('a\n', '--kind', 'file') |
|
394 |
output_equals('b\n', '--kind', 'directory') |
|
395 |
||
|
1185.26.1
by John Arbash Meinel
Made ls work again, and take extra arguments. |
396 |
def test_ls(self): |
397 |
"""Test the abilities of 'bzr ls'""" |
|
398 |
bzr = self.runbzr |
|
399 |
def bzrout(*args, **kwargs): |
|
400 |
kwargs['backtick'] = True |
|
401 |
return self.runbzr(*args, **kwargs) |
|
402 |
||
403 |
def ls_equals(value, *args): |
|
404 |
out = self.runbzr(['ls'] + list(args), backtick=True) |
|
405 |
self.assertEquals(out, value) |
|
406 |
||
407 |
bzr('init') |
|
408 |
open('a', 'wb').write('hello\n') |
|
409 |
||
410 |
# Can't supply both
|
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
411 |
bzr('ls --verbose --null', retcode=3) |
|
1185.26.1
by John Arbash Meinel
Made ls work again, and take extra arguments. |
412 |
|
413 |
ls_equals('a\n') |
|
414 |
ls_equals('? a\n', '--verbose') |
|
415 |
ls_equals('a\n', '--unknown') |
|
416 |
ls_equals('', '--ignored') |
|
417 |
ls_equals('', '--versioned') |
|
418 |
ls_equals('a\n', '--unknown', '--ignored', '--versioned') |
|
419 |
ls_equals('', '--ignored', '--versioned') |
|
420 |
ls_equals('a\0', '--null') |
|
421 |
||
422 |
bzr('add a') |
|
423 |
ls_equals('V a\n', '--verbose') |
|
424 |
bzr('commit -m add') |
|
425 |
||
426 |
os.mkdir('subdir') |
|
427 |
ls_equals('V a\n' |
|
428 |
'? subdir/\n' |
|
429 |
, '--verbose') |
|
430 |
open('subdir/b', 'wb').write('b\n') |
|
431 |
bzr('add') |
|
432 |
ls_equals('V a\n' |
|
433 |
'V subdir/\n' |
|
434 |
'V subdir/b\n' |
|
435 |
, '--verbose') |
|
436 |
bzr('commit -m subdir') |
|
437 |
||
438 |
ls_equals('a\n' |
|
439 |
'subdir\n' |
|
440 |
, '--non-recursive') |
|
441 |
||
442 |
ls_equals('V a\n' |
|
443 |
'V subdir/\n' |
|
444 |
, '--verbose', '--non-recursive') |
|
445 |
||
446 |
# Check what happens in a sub-directory
|
|
447 |
os.chdir('subdir') |
|
448 |
ls_equals('b\n') |
|
449 |
ls_equals('b\0' |
|
450 |
, '--null') |
|
451 |
ls_equals('a\n' |
|
452 |
'subdir\n' |
|
453 |
'subdir/b\n' |
|
454 |
, '--from-root') |
|
455 |
ls_equals('a\0' |
|
456 |
'subdir\0' |
|
457 |
'subdir/b\0' |
|
458 |
, '--from-root', '--null') |
|
459 |
ls_equals('a\n' |
|
460 |
'subdir\n' |
|
461 |
, '--from-root', '--non-recursive') |
|
462 |
||
463 |
os.chdir('..') |
|
464 |
||
465 |
# Check what happens when we supply a specific revision
|
|
466 |
ls_equals('a\n', '--revision', '1') |
|
467 |
ls_equals('V a\n' |
|
468 |
, '--verbose', '--revision', '1') |
|
469 |
||
470 |
os.chdir('subdir') |
|
471 |
ls_equals('', '--revision', '1') |
|
472 |
||
|
1185.26.2
by John Arbash Meinel
Added more tests. |
473 |
# Now try to do ignored files.
|
474 |
os.chdir('..') |
|
475 |
open('blah.py', 'wb').write('unknown\n') |
|
476 |
open('blah.pyo', 'wb').write('ignored\n') |
|
477 |
ls_equals('a\n' |
|
478 |
'blah.py\n' |
|
479 |
'blah.pyo\n' |
|
480 |
'subdir\n' |
|
481 |
'subdir/b\n') |
|
482 |
ls_equals('V a\n' |
|
483 |
'? blah.py\n' |
|
484 |
'I blah.pyo\n' |
|
485 |
'V subdir/\n' |
|
486 |
'V subdir/b\n' |
|
487 |
, '--verbose') |
|
488 |
ls_equals('blah.pyo\n' |
|
489 |
, '--ignored') |
|
490 |
ls_equals('blah.py\n' |
|
491 |
, '--unknown') |
|
492 |
ls_equals('a\n' |
|
493 |
'subdir\n' |
|
494 |
'subdir/b\n' |
|
495 |
, '--versioned') |
|
496 |
||
|
1185.65.4
by Aaron Bentley
Fixed cat command |
497 |
def test_cat(self): |
498 |
self.runbzr('init') |
|
499 |
file("myfile", "wb").write("My contents\n") |
|
500 |
self.runbzr('add') |
|
501 |
self.runbzr('commit -m myfile') |
|
502 |
self.run_bzr_captured('cat -r 1 myfile'.split(' ')) |
|
503 |
||
|
1185.32.2
by John Arbash Meinel
Refactor pull --verbose into a log.py function, add tests. |
504 |
def test_pull_verbose(self): |
505 |
"""Pull changes from one branch to another and watch the output.""" |
|
506 |
||
507 |
os.mkdir('a') |
|
508 |
os.chdir('a') |
|
509 |
||
510 |
bzr = self.runbzr |
|
511 |
self.example_branch() |
|
512 |
||
513 |
os.chdir('..') |
|
514 |
bzr('branch a b') |
|
515 |
os.chdir('b') |
|
516 |
open('b', 'wb').write('else\n') |
|
517 |
bzr('add b') |
|
518 |
bzr(['commit', '-m', 'added b']) |
|
519 |
||
520 |
os.chdir('../a') |
|
521 |
out = bzr('pull --verbose ../b', backtick=True) |
|
522 |
self.failIfEqual(out.find('Added Revisions:'), -1) |
|
523 |
self.failIfEqual(out.find('message:\n added b'), -1) |
|
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
524 |
self.failIfEqual(out.find('added b'), -1) |
|
1185.32.2
by John Arbash Meinel
Refactor pull --verbose into a log.py function, add tests. |
525 |
|
|
1185.32.4
by John Arbash Meinel
[merge] up-to-date against bzr.dev |
526 |
# Check that --overwrite --verbose prints out the removed entries
|
|
1185.32.2
by John Arbash Meinel
Refactor pull --verbose into a log.py function, add tests. |
527 |
bzr('commit -m foo --unchanged') |
528 |
os.chdir('../b') |
|
529 |
bzr('commit -m baz --unchanged') |
|
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
530 |
bzr('pull ../a', retcode=3) |
|
1185.32.4
by John Arbash Meinel
[merge] up-to-date against bzr.dev |
531 |
out = bzr('pull --overwrite --verbose ../a', backtick=1) |
|
1185.32.2
by John Arbash Meinel
Refactor pull --verbose into a log.py function, add tests. |
532 |
|
533 |
remove_loc = out.find('Removed Revisions:') |
|
534 |
self.failIfEqual(remove_loc, -1) |
|
535 |
added_loc = out.find('Added Revisions:') |
|
536 |
self.failIfEqual(added_loc, -1) |
|
537 |
||
538 |
removed_message = out.find('message:\n baz') |
|
539 |
self.failIfEqual(removed_message, -1) |
|
540 |
self.failUnless(remove_loc < removed_message < added_loc) |
|
541 |
||
542 |
added_message = out.find('message:\n foo') |
|
543 |
self.failIfEqual(added_message, -1) |
|
544 |
self.failUnless(added_loc < added_message) |
|
545 |
||
|
1185.12.11
by Aaron Bentley
Made pull only save the parent location if it is unset, or on --remember |
546 |
def test_locations(self): |
547 |
"""Using and remembering different locations""" |
|
548 |
os.mkdir('a') |
|
549 |
os.chdir('a') |
|
550 |
self.runbzr('init') |
|
551 |
self.runbzr('commit -m unchanged --unchanged') |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
552 |
self.runbzr('pull', retcode=3) |
553 |
self.runbzr('merge', retcode=3) |
|
|
1185.12.11
by Aaron Bentley
Made pull only save the parent location if it is unset, or on --remember |
554 |
self.runbzr('branch . ../b') |
555 |
os.chdir('../b') |
|
556 |
self.runbzr('pull') |
|
557 |
self.runbzr('branch . ../c') |
|
558 |
self.runbzr('pull ../c') |
|
|
1185.12.12
by Aaron Bentley
Made merge use pull location or die if no branch specified. |
559 |
self.runbzr('merge') |
|
1185.12.11
by Aaron Bentley
Made pull only save the parent location if it is unset, or on --remember |
560 |
os.chdir('../a') |
561 |
self.runbzr('pull ../b') |
|
562 |
self.runbzr('pull') |
|
563 |
self.runbzr('pull ../c') |
|
564 |
self.runbzr('branch ../c ../d') |
|
565 |
shutil.rmtree('../c') |
|
566 |
self.runbzr('pull') |
|
567 |
os.chdir('../b') |
|
568 |
self.runbzr('pull') |
|
569 |
os.chdir('../d') |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
570 |
self.runbzr('pull', retcode=3) |
|
1185.12.11
by Aaron Bentley
Made pull only save the parent location if it is unset, or on --remember |
571 |
self.runbzr('pull ../a --remember') |
572 |
self.runbzr('pull') |
|
|
974.1.74
by Aaron Bentley
Made pull work after remote branch has merged latest revision |
573 |
|
|
1161
by Martin Pool
- add test that 'bzr add' reports the files as they're added |
574 |
def test_add_reports(self): |
575 |
"""add command prints the names of added files.""" |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
576 |
self.runbzr('init') |
|
1185.46.8
by Aaron Bentley
bzr add reports ignored patterns. |
577 |
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt', 'CVS']) |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
578 |
out = self.run_bzr_captured(['add'], retcode=0)[0] |
|
1161
by Martin Pool
- add test that 'bzr add' reports the files as they're added |
579 |
# the ordering is not defined at the moment
|
|
1185.1.31
by Robert Collins
Change the use of run_bzr to run_bzr_captured in blackbox tests - inspired by David Clymers patch to change run_bzr usage to runbzr |
580 |
results = sorted(out.rstrip('\n').split('\n')) |
|
1185.46.8
by Aaron Bentley
bzr add reports ignored patterns. |
581 |
self.assertEquals(['If you wish to add some of these files, please'\ |
582 |
' add them by name.', |
|
583 |
'added dir', |
|
|
1185.31.34
by John Arbash Meinel
Removing instances of os.sep |
584 |
'added dir/sub.txt', |
|
1185.46.8
by Aaron Bentley
bzr add reports ignored patterns. |
585 |
'added top.txt', |
586 |
'ignored 1 file(s) matching "CVS"'], |
|
|
1161
by Martin Pool
- add test that 'bzr add' reports the files as they're added |
587 |
results) |
|
1185.46.9
by Aaron Bentley
Added verbose option to bzr add, to list all ignored files. |
588 |
out = self.run_bzr_captured(['add', '-v'], retcode=0)[0] |
589 |
results = sorted(out.rstrip('\n').split('\n')) |
|
590 |
self.assertEquals(['If you wish to add some of these files, please'\ |
|
591 |
' add them by name.', |
|
592 |
'ignored CVS matching "CVS"'], |
|
593 |
results) |
|
|
1161
by Martin Pool
- add test that 'bzr add' reports the files as they're added |
594 |
|
|
1446
by Robert Collins
fixup the verbose-does-nothing for add - add a --quiet instead |
595 |
def test_add_quiet_is(self): |
596 |
"""add -q does not print the names of added files.""" |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
597 |
self.runbzr('init') |
|
1446
by Robert Collins
fixup the verbose-does-nothing for add - add a --quiet instead |
598 |
self.build_tree(['top.txt', 'dir/', 'dir/sub.txt']) |
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
599 |
out = self.run_bzr_captured(['add', '-q'], retcode=0)[0] |
|
1446
by Robert Collins
fixup the verbose-does-nothing for add - add a --quiet instead |
600 |
# the ordering is not defined at the moment
|
601 |
results = sorted(out.rstrip('\n').split('\n')) |
|
602 |
self.assertEquals([''], results) |
|
603 |
||
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
604 |
def test_add_in_unversioned(self): |
605 |
"""Try to add a file in an unversioned directory. |
|
606 |
||
607 |
"bzr add" should add the parent(s) as necessary.
|
|
608 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
609 |
self.runbzr('init') |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
610 |
self.build_tree(['inertiatic/', 'inertiatic/esp']) |
611 |
self.assertEquals(self.capture('unknowns'), 'inertiatic\n') |
|
612 |
self.run_bzr('add', 'inertiatic/esp') |
|
613 |
self.assertEquals(self.capture('unknowns'), '') |
|
614 |
||
615 |
# Multiple unversioned parents
|
|
616 |
self.build_tree(['veil/', 'veil/cerpin/', 'veil/cerpin/taxt']) |
|
617 |
self.assertEquals(self.capture('unknowns'), 'veil\n') |
|
618 |
self.run_bzr('add', 'veil/cerpin/taxt') |
|
619 |
self.assertEquals(self.capture('unknowns'), '') |
|
620 |
||
621 |
# Check whacky paths work
|
|
622 |
self.build_tree(['cicatriz/', 'cicatriz/esp']) |
|
623 |
self.assertEquals(self.capture('unknowns'), 'cicatriz\n') |
|
624 |
self.run_bzr('add', 'inertiatic/../cicatriz/esp') |
|
625 |
self.assertEquals(self.capture('unknowns'), '') |
|
626 |
||
627 |
def test_add_in_versioned(self): |
|
628 |
"""Try to add a file in a versioned directory. |
|
629 |
||
630 |
"bzr add" should do this happily.
|
|
631 |
"""
|
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
632 |
self.runbzr('init') |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
633 |
self.build_tree(['inertiatic/', 'inertiatic/esp']) |
634 |
self.assertEquals(self.capture('unknowns'), 'inertiatic\n') |
|
635 |
self.run_bzr('add', '--no-recurse', 'inertiatic') |
|
|
1185.31.34
by John Arbash Meinel
Removing instances of os.sep |
636 |
self.assertEquals(self.capture('unknowns'), 'inertiatic/esp\n') |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
637 |
self.run_bzr('add', 'inertiatic/esp') |
638 |
self.assertEquals(self.capture('unknowns'), '') |
|
639 |
||
640 |
def test_subdir_add(self): |
|
641 |
"""Add in subdirectory should add only things from there down""" |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
642 |
from bzrlib.workingtree import WorkingTree |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
643 |
|
644 |
eq = self.assertEqual |
|
645 |
ass = self.assert_ |
|
646 |
chdir = os.chdir |
|
647 |
||
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
648 |
t = self.make_branch_and_tree('.') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
649 |
b = t.branch |
|
1508.1.6
by Robert Collins
Move Branch.unknowns() to WorkingTree. |
650 |
self.build_tree(['src/', 'README']) |
651 |
||
652 |
eq(sorted(t.unknowns()), |
|
653 |
['README', 'src']) |
|
654 |
||
655 |
self.run_bzr('add', 'src') |
|
656 |
||
657 |
self.build_tree(['src/foo.c']) |
|
658 |
||
659 |
chdir('src') |
|
660 |
self.run_bzr('add') |
|
661 |
||
662 |
self.assertEquals(self.capture('unknowns'), 'README\n') |
|
663 |
eq(len(t.read_working_inventory()), 3) |
|
664 |
||
665 |
chdir('..') |
|
666 |
self.run_bzr('add') |
|
667 |
self.assertEquals(self.capture('unknowns'), '') |
|
668 |
self.run_bzr('check') |
|
669 |
||
|
1185.3.20
by Martin Pool
- run_bzr_captured also includes logged errors in |
670 |
def test_unknown_command(self): |
671 |
"""Handling of unknown command.""" |
|
672 |
out, err = self.run_bzr_captured(['fluffy-badger'], |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
673 |
retcode=3) |
|
1185.3.20
by Martin Pool
- run_bzr_captured also includes logged errors in |
674 |
self.assertEquals(out, '') |
675 |
err.index('unknown command') |
|
|
1185.14.9
by Aaron Bentley
Added tests for 'bzr conflicts', 'bzr resolve' |
676 |
|
|
1185.35.4
by Aaron Bentley
Implemented remerge |
677 |
def create_conflicts(self): |
678 |
"""Create a conflicted tree""" |
|
|
1185.14.9
by Aaron Bentley
Added tests for 'bzr conflicts', 'bzr resolve' |
679 |
os.mkdir('base') |
680 |
os.chdir('base') |
|
681 |
file('hello', 'wb').write("hi world") |
|
682 |
file('answer', 'wb').write("42") |
|
683 |
self.runbzr('init') |
|
684 |
self.runbzr('add') |
|
685 |
self.runbzr('commit -m base') |
|
686 |
self.runbzr('branch . ../other') |
|
687 |
self.runbzr('branch . ../this') |
|
688 |
os.chdir('../other') |
|
689 |
file('hello', 'wb').write("Hello.") |
|
690 |
file('answer', 'wb').write("Is anyone there?") |
|
691 |
self.runbzr('commit -m other') |
|
692 |
os.chdir('../this') |
|
693 |
file('hello', 'wb').write("Hello, world") |
|
694 |
self.runbzr('mv answer question') |
|
695 |
file('question', 'wb').write("What do you get when you multiply six" |
|
696 |
"times nine?") |
|
697 |
self.runbzr('commit -m this') |
|
|
1185.35.4
by Aaron Bentley
Implemented remerge |
698 |
|
699 |
def test_remerge(self): |
|
700 |
"""Remerge command works as expected""" |
|
701 |
self.create_conflicts() |
|
702 |
self.runbzr('merge ../other --show-base', retcode=1) |
|
703 |
conflict_text = file('hello').read() |
|
704 |
assert '|||||||' in conflict_text |
|
705 |
assert 'hi world' in conflict_text |
|
706 |
self.runbzr('remerge', retcode=1) |
|
707 |
conflict_text = file('hello').read() |
|
708 |
assert '|||||||' not in conflict_text |
|
709 |
assert 'hi world' not in conflict_text |
|
710 |
os.unlink('hello.OTHER') |
|
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
711 |
os.unlink('question.OTHER') |
|
1558.2.1
by Aaron Bentley
Ensure remerge errors when file-id is None |
712 |
self.runbzr('remerge jello --merge-type weave', retcode=3) |
|
1185.35.4
by Aaron Bentley
Implemented remerge |
713 |
self.runbzr('remerge hello --merge-type weave', retcode=1) |
|
1185.35.6
by Aaron Bentley
Removed todo, restored test |
714 |
assert os.path.exists('hello.OTHER') |
|
1558.2.2
by Aaron Bentley
Make remerge honour interesting-ids |
715 |
self.assertIs(False, os.path.exists('question.OTHER')) |
|
1185.35.7
by Aaron Bentley
Fixed weave conflict handling |
716 |
file_id = self.runbzr('file-id hello') |
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
717 |
file_id = self.runbzr('file-id hello.THIS', retcode=3) |
|
1185.35.4
by Aaron Bentley
Implemented remerge |
718 |
self.runbzr('remerge --merge-type weave', retcode=1) |
719 |
assert os.path.exists('hello.OTHER') |
|
720 |
assert not os.path.exists('hello.BASE') |
|
721 |
assert '|||||||' not in conflict_text |
|
722 |
assert 'hi world' not in conflict_text |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
723 |
self.runbzr('remerge . --merge-type weave --show-base', retcode=3) |
724 |
self.runbzr('remerge . --merge-type weave --reprocess', retcode=3) |
|
725 |
self.runbzr('remerge . --show-base --reprocess', retcode=3) |
|
|
1185.35.4
by Aaron Bentley
Implemented remerge |
726 |
self.runbzr('remerge hello --show-base', retcode=1) |
727 |
self.runbzr('remerge hello --reprocess', retcode=1) |
|
728 |
self.runbzr('resolve --all') |
|
729 |
self.runbzr('commit -m done',) |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
730 |
self.runbzr('remerge', retcode=3) |
|
1185.35.4
by Aaron Bentley
Implemented remerge |
731 |
|
|
1185.65.6
by Aaron Bentley
Fixed inner merges in status |
732 |
def test_status(self): |
733 |
os.mkdir('branch1') |
|
734 |
os.chdir('branch1') |
|
735 |
self.runbzr('init') |
|
736 |
self.runbzr('commit --unchanged --message f') |
|
737 |
self.runbzr('branch . ../branch2') |
|
738 |
self.runbzr('branch . ../branch3') |
|
739 |
self.runbzr('commit --unchanged --message peter') |
|
740 |
os.chdir('../branch2') |
|
741 |
self.runbzr('merge ../branch1') |
|
742 |
self.runbzr('commit --unchanged --message pumpkin') |
|
743 |
os.chdir('../branch3') |
|
744 |
self.runbzr('merge ../branch2') |
|
745 |
message = self.capture('status') |
|
746 |
||
|
1185.35.4
by Aaron Bentley
Implemented remerge |
747 |
|
748 |
def test_conflicts(self): |
|
749 |
"""Handling of merge conflicts""" |
|
750 |
self.create_conflicts() |
|
|
1476
by Robert Collins
Merge now has a retcode of 1 when conflicts occur. (Robert Collins) |
751 |
self.runbzr('merge ../other --show-base', retcode=1) |
|
1185.18.1
by Aaron Bentley
Added --show-base to merge |
752 |
conflict_text = file('hello').read() |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
753 |
self.assert_('<<<<<<<' in conflict_text) |
754 |
self.assert_('>>>>>>>' in conflict_text) |
|
755 |
self.assert_('=======' in conflict_text) |
|
756 |
self.assert_('|||||||' in conflict_text) |
|
757 |
self.assert_('hi world' in conflict_text) |
|
|
1185.18.1
by Aaron Bentley
Added --show-base to merge |
758 |
self.runbzr('revert') |
759 |
self.runbzr('resolve --all') |
|
|
1476
by Robert Collins
Merge now has a retcode of 1 when conflicts occur. (Robert Collins) |
760 |
self.runbzr('merge ../other', retcode=1) |
|
1185.18.1
by Aaron Bentley
Added --show-base to merge |
761 |
conflict_text = file('hello').read() |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
762 |
self.assert_('|||||||' not in conflict_text) |
763 |
self.assert_('hi world' not in conflict_text) |
|
|
1185.14.9
by Aaron Bentley
Added tests for 'bzr conflicts', 'bzr resolve' |
764 |
result = self.runbzr('conflicts', backtick=1) |
|
1534.10.9
by Aaron Bentley
Switched display functions to conflict_lines |
765 |
self.assertEquals(result, "Text conflict in hello\nText conflict in" |
766 |
" question\n") |
|
|
1185.14.11
by Aaron Bentley
moved conflict listing into status and stopped monkey-patching |
767 |
result = self.runbzr('status', backtick=1) |
|
1534.10.9
by Aaron Bentley
Switched display functions to conflict_lines |
768 |
self.assert_("conflicts:\n Text conflict in hello\n" |
769 |
" Text conflict in question\n" in result, result) |
|
|
1185.14.10
by Aaron Bentley
Commit aborts with conflicts in the tree. |
770 |
self.runbzr('resolve hello') |
|
1185.14.9
by Aaron Bentley
Added tests for 'bzr conflicts', 'bzr resolve' |
771 |
result = self.runbzr('conflicts', backtick=1) |
|
1534.10.9
by Aaron Bentley
Switched display functions to conflict_lines |
772 |
self.assertEquals(result, "Text conflict in question\n") |
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
773 |
self.runbzr('commit -m conflicts', retcode=3) |
|
1185.14.10
by Aaron Bentley
Commit aborts with conflicts in the tree. |
774 |
self.runbzr('resolve --all') |
|
1185.14.9
by Aaron Bentley
Added tests for 'bzr conflicts', 'bzr resolve' |
775 |
result = self.runbzr('conflicts', backtick=1) |
|
1185.14.10
by Aaron Bentley
Commit aborts with conflicts in the tree. |
776 |
self.runbzr('commit -m conflicts') |
|
1185.14.9
by Aaron Bentley
Added tests for 'bzr conflicts', 'bzr resolve' |
777 |
self.assertEquals(result, "") |
|
1185.3.20
by Martin Pool
- run_bzr_captured also includes logged errors in |
778 |
|
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
779 |
def test_push(self): |
780 |
# create a source branch
|
|
781 |
os.mkdir('my-branch') |
|
782 |
os.chdir('my-branch') |
|
783 |
self.example_branch() |
|
784 |
||
785 |
# with no push target, fail
|
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
786 |
self.runbzr('push', retcode=3) |
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
787 |
# with an explicit target work
|
788 |
self.runbzr('push ../output-branch') |
|
789 |
# with an implicit target work
|
|
790 |
self.runbzr('push') |
|
791 |
# nothing missing
|
|
792 |
self.runbzr('missing ../output-branch') |
|
793 |
# advance this branch
|
|
794 |
self.runbzr('commit --unchanged -m unchanged') |
|
795 |
||
796 |
os.chdir('../output-branch') |
|
|
1185.50.6
by John Arbash Meinel
Fixed a broken test from my 'push updates local working tree' fix |
797 |
# There is no longer a difference as long as we have
|
798 |
# access to the working tree
|
|
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
799 |
self.runbzr('diff') |
|
1185.50.6
by John Arbash Meinel
Fixed a broken test from my 'push updates local working tree' fix |
800 |
|
801 |
# But we should be missing a revision
|
|
802 |
self.runbzr('missing ../my-branch', retcode=1) |
|
803 |
||
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
804 |
# diverge the branches
|
805 |
self.runbzr('commit --unchanged -m unchanged') |
|
806 |
os.chdir('../my-branch') |
|
807 |
# cannot push now
|
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
808 |
self.runbzr('push', retcode=3) |
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
809 |
# and there are difference
|
810 |
self.runbzr('missing ../output-branch', retcode=1) |
|
|
1185.35.30
by Aaron Bentley
Fixed missing --verbose |
811 |
self.runbzr('missing --verbose ../output-branch', retcode=1) |
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
812 |
# but we can force a push
|
813 |
self.runbzr('push --overwrite') |
|
814 |
# nothing missing
|
|
815 |
self.runbzr('missing ../output-branch') |
|
|
1495
by Robert Collins
Add a --create-prefix to the new push command. |
816 |
|
817 |
# pushing to a new dir with no parent should fail
|
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
818 |
self.runbzr('push ../missing/new-branch', retcode=3) |
|
1495
by Robert Collins
Add a --create-prefix to the new push command. |
819 |
# unless we provide --create-prefix
|
820 |
self.runbzr('push --create-prefix ../missing/new-branch') |
|
821 |
# nothing missing
|
|
822 |
self.runbzr('missing ../missing/new-branch') |
|
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
823 |
|
|
1185.31.3
by John Arbash Meinel
Fix ExternalCommand to not run random files in the current directory, unless it is truly in BZRPATH |
824 |
def test_external_command(self): |
|
1588.1.1
by Martin Pool
Supress "hello from test-command" noise from test_external_command |
825 |
"""Test that external commands can be run by setting the path |
826 |
"""
|
|
827 |
# We don't at present run bzr in a subprocess for blackbox tests, and so
|
|
828 |
# don't really capture stdout, only the internal python stream.
|
|
829 |
# Therefore we don't use a subcommand that produces any output or does
|
|
830 |
# anything -- we just check that it can be run successfully.
|
|
|
1185.31.3
by John Arbash Meinel
Fix ExternalCommand to not run random files in the current directory, unless it is truly in BZRPATH |
831 |
cmd_name = 'test-command' |
832 |
if sys.platform == 'win32': |
|
833 |
cmd_name += '.bat' |
|
834 |
oldpath = os.environ.get('BZRPATH', None) |
|
835 |
bzr = self.capture |
|
836 |
try: |
|
837 |
if os.environ.has_key('BZRPATH'): |
|
838 |
del os.environ['BZRPATH'] |
|
839 |
||
840 |
f = file(cmd_name, 'wb') |
|
841 |
if sys.platform == 'win32': |
|
842 |
f.write('@echo off\n') |
|
843 |
else: |
|
844 |
f.write('#!/bin/sh\n') |
|
|
1588.1.1
by Martin Pool
Supress "hello from test-command" noise from test_external_command |
845 |
# f.write('echo Hello from test-command')
|
|
1185.31.3
by John Arbash Meinel
Fix ExternalCommand to not run random files in the current directory, unless it is truly in BZRPATH |
846 |
f.close() |
847 |
os.chmod(cmd_name, 0755) |
|
848 |
||
849 |
# It should not find the command in the local
|
|
850 |
# directory by default, since it is not in my path
|
|
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
851 |
bzr(cmd_name, retcode=3) |
|
1185.31.3
by John Arbash Meinel
Fix ExternalCommand to not run random files in the current directory, unless it is truly in BZRPATH |
852 |
|
853 |
# Now put it into my path
|
|
854 |
os.environ['BZRPATH'] = '.' |
|
855 |
||
856 |
bzr(cmd_name) |
|
857 |
||
858 |
# Make sure empty path elements are ignored
|
|
859 |
os.environ['BZRPATH'] = os.pathsep |
|
860 |
||
|
1185.33.27
by Martin Pool
[merge] much integrated work from robert and john |
861 |
bzr(cmd_name, retcode=3) |
|
1185.31.3
by John Arbash Meinel
Fix ExternalCommand to not run random files in the current directory, unless it is truly in BZRPATH |
862 |
|
863 |
finally: |
|
864 |
if oldpath: |
|
865 |
os.environ['BZRPATH'] = oldpath |
|
866 |
||
867 |
||
|
1092.2.6
by Robert Collins
symlink support updated to work |
868 |
def listdir_sorted(dir): |
869 |
L = os.listdir(dir) |
|
870 |
L.sort() |
|
871 |
return L |
|
|
1185.3.20
by Martin Pool
- run_bzr_captured also includes logged errors in |
872 |
|
|
1092.2.12
by Robert Collins
merge from HEAD |
873 |
|
|
904
by Martin Pool
- more selftest external-command fixes |
874 |
class OldTests(ExternalBase): |
|
1092.1.39
by Robert Collins
merge from mpool |
875 |
"""old tests moved from ./testbzr.""" |
876 |
||
|
1102
by Martin Pool
- merge test refactoring from robertc |
877 |
def test_bzr(self): |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
878 |
from os import chdir, mkdir |
879 |
from os.path import exists |
|
880 |
||
|
904
by Martin Pool
- more selftest external-command fixes |
881 |
runbzr = self.runbzr |
|
1185.3.26
by Martin Pool
- remove remaining external executions of bzr |
882 |
capture = self.capture |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
883 |
progress = self.log |
884 |
||
885 |
progress("basic branch creation") |
|
|
904
by Martin Pool
- more selftest external-command fixes |
886 |
mkdir('branch1') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
887 |
chdir('branch1') |
|
898
by Martin Pool
- add new runbzr method for external tests |
888 |
runbzr('init') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
889 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
890 |
self.assertEquals(capture('root').rstrip(), |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
891 |
pathjoin(self.test_dir, 'branch1')) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
892 |
|
893 |
progress("status of new file") |
|
894 |
||
895 |
f = file('test.txt', 'wt') |
|
896 |
f.write('hello world!\n') |
|
897 |
f.close() |
|
898 |
||
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
899 |
self.assertEquals(capture('unknowns'), 'test.txt\n') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
900 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
901 |
out = capture("status") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
902 |
self.assertEquals(out, 'unknown:\n test.txt\n') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
903 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
904 |
out = capture("status --all") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
905 |
self.assertEquals(out, "unknown:\n test.txt\n") |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
906 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
907 |
out = capture("status test.txt --all") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
908 |
self.assertEquals(out, "unknown:\n test.txt\n") |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
909 |
|
910 |
f = file('test2.txt', 'wt') |
|
911 |
f.write('goodbye cruel world...\n') |
|
912 |
f.close() |
|
913 |
||
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
914 |
out = capture("status test.txt") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
915 |
self.assertEquals(out, "unknown:\n test.txt\n") |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
916 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
917 |
out = capture("status") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
918 |
self.assertEquals(out, ("unknown:\n" " test.txt\n" " test2.txt\n")) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
919 |
|
920 |
os.unlink('test2.txt') |
|
921 |
||
922 |
progress("command aliases") |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
923 |
out = capture("st --all") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
924 |
self.assertEquals(out, ("unknown:\n" " test.txt\n")) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
925 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
926 |
out = capture("stat") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
927 |
self.assertEquals(out, ("unknown:\n" " test.txt\n")) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
928 |
|
929 |
progress("command help") |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
930 |
runbzr("help st") |
931 |
runbzr("help") |
|
932 |
runbzr("help commands") |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
933 |
runbzr("help slartibartfast", 3) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
934 |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
935 |
out = capture("help ci") |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
936 |
out.index('aliases: ') |
937 |
||
938 |
progress("can't rename unversioned file") |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
939 |
runbzr("rename test.txt new-test.txt", 3) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
940 |
|
941 |
progress("adding a file") |
|
942 |
||
|
898
by Martin Pool
- add new runbzr method for external tests |
943 |
runbzr("add test.txt") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
944 |
self.assertEquals(capture("unknowns"), '') |
945 |
self.assertEquals(capture("status --all"), ("added:\n" " test.txt\n")) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
946 |
|
947 |
progress("rename newly-added file") |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
948 |
runbzr("rename test.txt hello.txt") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
949 |
self.assert_(os.path.exists("hello.txt")) |
950 |
self.assert_(not os.path.exists("test.txt")) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
951 |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
952 |
self.assertEquals(capture("revno"), '0\n') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
953 |
|
954 |
progress("add first revision") |
|
|
904
by Martin Pool
- more selftest external-command fixes |
955 |
runbzr(['commit', '-m', 'add first revision']) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
956 |
|
957 |
progress("more complex renames") |
|
958 |
os.mkdir("sub1") |
|
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
959 |
runbzr("rename hello.txt sub1", 3) |
960 |
runbzr("rename hello.txt sub1/hello.txt", 3) |
|
961 |
runbzr("move hello.txt sub1", 3) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
962 |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
963 |
runbzr("add sub1") |
964 |
runbzr("rename sub1 sub2") |
|
965 |
runbzr("move hello.txt sub2") |
|
|
1457.1.4
by Robert Collins
Branch.relpath has been moved to WorkingTree.relpath. |
966 |
self.assertEqual(capture("relpath sub2/hello.txt"), |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
967 |
pathjoin("sub2", "hello.txt\n")) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
968 |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
969 |
self.assert_(exists("sub2")) |
970 |
self.assert_(exists("sub2/hello.txt")) |
|
971 |
self.assert_(not exists("sub1")) |
|
972 |
self.assert_(not exists("hello.txt")) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
973 |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
974 |
runbzr(['commit', '-m', 'commit with some things moved to subdirs']) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
975 |
|
976 |
mkdir("sub1") |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
977 |
runbzr('add sub1') |
978 |
runbzr('move sub2/hello.txt sub1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
979 |
self.assert_(not exists('sub2/hello.txt')) |
980 |
self.assert_(exists('sub1/hello.txt')) |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
981 |
runbzr('move sub2 sub1') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
982 |
self.assert_(not exists('sub2')) |
983 |
self.assert_(exists('sub1/sub2')) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
984 |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
985 |
runbzr(['commit', '-m', 'rename nested subdirectories']) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
986 |
|
987 |
chdir('sub1/sub2') |
|
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
988 |
self.assertEquals(capture('root')[:-1], |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
989 |
pathjoin(self.test_dir, 'branch1')) |
|
898
by Martin Pool
- add new runbzr method for external tests |
990 |
runbzr('move ../hello.txt .') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
991 |
self.assert_(exists('./hello.txt')) |
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
992 |
self.assertEquals(capture('relpath hello.txt'), |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
993 |
pathjoin('sub1', 'sub2', 'hello.txt') + '\n') |
994 |
self.assertEquals(capture('relpath ../../sub1/sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n')) |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
995 |
runbzr(['commit', '-m', 'move to parent directory']) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
996 |
chdir('..') |
|
1185.31.32
by John Arbash Meinel
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \ |
997 |
self.assertEquals(capture('relpath sub2/hello.txt'), pathjoin('sub1', 'sub2', 'hello.txt\n')) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
998 |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
999 |
runbzr('move sub2/hello.txt .') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1000 |
self.assert_(exists('hello.txt')) |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
1001 |
|
1002 |
f = file('hello.txt', 'wt') |
|
1003 |
f.write('some nice new content\n') |
|
1004 |
f.close() |
|
1005 |
||
1006 |
f = file('msg.tmp', 'wt') |
|
|
1185.12.25
by Aaron Bentley
Added one-line log format |
1007 |
f.write('this is my new commit\nand it has multiple lines, for fun') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
1008 |
f.close() |
1009 |
||
|
898
by Martin Pool
- add new runbzr method for external tests |
1010 |
runbzr('commit -F msg.tmp') |
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
1011 |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1012 |
self.assertEquals(capture('revno'), '5\n') |
|
898
by Martin Pool
- add new runbzr method for external tests |
1013 |
runbzr('export -r 5 export-5.tmp') |
1014 |
runbzr('export export.tmp') |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
1015 |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
1016 |
runbzr('log') |
1017 |
runbzr('log -v') |
|
|
909.1.5
by Aaron Bentley
Fixed log -v (mostly) |
1018 |
runbzr('log -v --forward') |
|
1185.35.21
by Aaron Bentley
Changed error status to 3 |
1019 |
runbzr('log -m', retcode=3) |
|
1185.3.25
by Martin Pool
- run blackbox tests in-process |
1020 |
log_out = capture('log -m commit') |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1021 |
self.assert_("this is my new commit\n and" in log_out) |
1022 |
self.assert_("rename nested" not in log_out) |
|
1023 |
self.assert_('revision-id' not in log_out) |
|
1024 |
self.assert_('revision-id' in capture('log --show-ids -m commit')) |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
1025 |
|
|
1185.12.25
by Aaron Bentley
Added one-line log format |
1026 |
log_out = capture('log --line') |
1027 |
for line in log_out.splitlines(): |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1028 |
self.assert_(len(line) <= 79, len(line)) |
1029 |
self.assert_("this is my new commit and" in log_out) |
|
|
1185.12.25
by Aaron Bentley
Added one-line log format |
1030 |
|
|
736
by Martin Pool
- move old blackbox code from testbzr into bzrlib.selftest.blackbox |
1031 |
|
1032 |
progress("file with spaces in name") |
|
1033 |
mkdir('sub directory') |
|
1034 |
file('sub directory/file with spaces ', 'wt').write('see how this works\n') |
|
|
898
by Martin Pool
- add new runbzr method for external tests |
1035 |
runbzr('add .') |
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
1036 |
runbzr('diff', retcode=1) |
|
898
by Martin Pool
- add new runbzr method for external tests |
1037 |
runbzr('commit -m add-spaces') |
1038 |
runbzr('check') |
|
1039 |
||
1040 |
runbzr('log') |
|
1041 |
runbzr('log --forward') |
|
1042 |
||
1043 |
runbzr('info') |
|
|
1092.1.35
by Robert Collins
merge from mpool up to rev 1110 |
1044 |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1045 |
if has_symlinks(): |
1046 |
progress("symlinks") |
|
1047 |
mkdir('symlinks') |
|
1048 |
chdir('symlinks') |
|
1049 |
runbzr('init') |
|
1050 |
os.symlink("NOWHERE1", "link1") |
|
1051 |
runbzr('add link1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1052 |
self.assertEquals(self.capture('unknowns'), '') |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1053 |
runbzr(['commit', '-m', '1: added symlink link1']) |
1054 |
||
1055 |
mkdir('d1') |
|
1056 |
runbzr('add d1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1057 |
self.assertEquals(self.capture('unknowns'), '') |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1058 |
os.symlink("NOWHERE2", "d1/link2") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1059 |
self.assertEquals(self.capture('unknowns'), 'd1/link2\n') |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1060 |
# is d1/link2 found when adding d1
|
1061 |
runbzr('add d1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1062 |
self.assertEquals(self.capture('unknowns'), '') |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1063 |
os.symlink("NOWHERE3", "d1/link3") |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1064 |
self.assertEquals(self.capture('unknowns'), 'd1/link3\n') |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1065 |
runbzr(['commit', '-m', '2: added dir, symlink']) |
1066 |
||
1067 |
runbzr('rename d1 d2') |
|
1068 |
runbzr('move d2/link2 .') |
|
1069 |
runbzr('move link1 d2') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1070 |
self.assertEquals(os.readlink("./link2"), "NOWHERE2") |
1071 |
self.assertEquals(os.readlink("d2/link1"), "NOWHERE1") |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1072 |
runbzr('add d2/link3') |
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
1073 |
runbzr('diff', retcode=1) |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1074 |
runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3']) |
1075 |
||
1076 |
os.unlink("link2") |
|
1077 |
os.symlink("TARGET 2", "link2") |
|
1078 |
os.unlink("d2/link1") |
|
1079 |
os.symlink("TARGET 1", "d2/link1") |
|
|
1490
by Robert Collins
Implement a 'bzr push' command, with saved locations; update diff to return 1. |
1080 |
runbzr('diff', retcode=1) |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1081 |
self.assertEquals(self.capture("relpath d2/link1"), "d2/link1\n") |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1082 |
runbzr(['commit', '-m', '4: retarget of two links']) |
1083 |
||
1084 |
runbzr('remove d2/link1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1085 |
self.assertEquals(self.capture('unknowns'), 'd2/link1\n') |
|
1092.2.20
by Robert Collins
symlink and weaves, whaddya know |
1086 |
runbzr(['commit', '-m', '5: remove d2/link1']) |
|
1424
by Robert Collins
add rm alias to remove |
1087 |
# try with the rm alias
|
1088 |
runbzr('add d2/link1') |
|
1089 |
runbzr(['commit', '-m', '6: add d2/link1']) |
|
1090 |
runbzr('rm d2/link1') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1091 |
self.assertEquals(self.capture('unknowns'), 'd2/link1\n') |
|
1424
by Robert Collins
add rm alias to remove |
1092 |
runbzr(['commit', '-m', '7: remove d2/link1']) |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1093 |
|
1094 |
os.mkdir("d1") |
|
1095 |
runbzr('add d1') |
|
1096 |
runbzr('rename d2/link3 d1/link3new') |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1097 |
self.assertEquals(self.capture('unknowns'), 'd2/link1\n') |
|
1424
by Robert Collins
add rm alias to remove |
1098 |
runbzr(['commit', '-m', '8: remove d2/link1, move/rename link3']) |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1099 |
|
1100 |
runbzr(['check']) |
|
1101 |
||
1102 |
runbzr(['export', '-r', '1', 'exp1.tmp']) |
|
1103 |
chdir("exp1.tmp") |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1104 |
self.assertEquals(listdir_sorted("."), [ "link1" ]) |
1105 |
self.assertEquals(os.readlink("link1"), "NOWHERE1") |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1106 |
chdir("..") |
1107 |
||
1108 |
runbzr(['export', '-r', '2', 'exp2.tmp']) |
|
1109 |
chdir("exp2.tmp") |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1110 |
self.assertEquals(listdir_sorted("."), [ "d1", "link1" ]) |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1111 |
chdir("..") |
1112 |
||
1113 |
runbzr(['export', '-r', '3', 'exp3.tmp']) |
|
1114 |
chdir("exp3.tmp") |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1115 |
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ]) |
1116 |
self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ]) |
|
1117 |
self.assertEquals(os.readlink("d2/link1"), "NOWHERE1") |
|
1118 |
self.assertEquals(os.readlink("link2") , "NOWHERE2") |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1119 |
chdir("..") |
1120 |
||
1121 |
runbzr(['export', '-r', '4', 'exp4.tmp']) |
|
1122 |
chdir("exp4.tmp") |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1123 |
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ]) |
1124 |
self.assertEquals(os.readlink("d2/link1"), "TARGET 1") |
|
1125 |
self.assertEquals(os.readlink("link2") , "TARGET 2") |
|
1126 |
self.assertEquals(listdir_sorted("d2"), [ "link1", "link3" ]) |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1127 |
chdir("..") |
1128 |
||
1129 |
runbzr(['export', '-r', '5', 'exp5.tmp']) |
|
1130 |
chdir("exp5.tmp") |
|
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1131 |
self.assertEquals(listdir_sorted("."), [ "d2", "link2" ]) |
1132 |
self.assert_(os.path.islink("link2")) |
|
1133 |
self.assert_(listdir_sorted("d2")== [ "link3" ]) |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1134 |
chdir("..") |
1135 |
||
|
1424
by Robert Collins
add rm alias to remove |
1136 |
runbzr(['export', '-r', '8', 'exp6.tmp']) |
|
1092.2.6
by Robert Collins
symlink support updated to work |
1137 |
chdir("exp6.tmp") |
|
1424
by Robert Collins
add rm alias to remove |
1138 |
self.assertEqual(listdir_sorted("."), [ "d1", "d2", "link2"]) |
|
1185.16.145
by Martin Pool
Remove all assert statements from test cases. |
1139 |
self.assertEquals(listdir_sorted("d1"), [ "link3new" ]) |
1140 |
self.assertEquals(listdir_sorted("d2"), []) |
|
1141 |
self.assertEquals(os.readlink("d1/link3new"), "NOWHERE3") |
|
|
1092.2.6
by Robert Collins
symlink support updated to work |
1142 |
chdir("..") |
1143 |
else: |
|
1144 |
progress("skipping symlink tests") |
|
|
1400.1.1
by Robert Collins
implement a basic test for the ui branch command from http servers |
1145 |
|
1146 |
||
|
1524.1.1
by Robert Collins
Test sftp with relative, absolute-in-homedir and absolute-not-in-homedir |
1147 |
class RemoteTests(object): |
|
1400.1.1
by Robert Collins
implement a basic test for the ui branch command from http servers |
1148 |
"""Test bzr ui commands against remote branches.""" |
1149 |
||
1150 |
def test_branch(self): |
|
1151 |
os.mkdir('from') |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
1152 |
wt = self.make_branch_and_tree('from') |
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
1153 |
branch = wt.branch |
1154 |
wt.commit('empty commit for nonsense', allow_pointless=True) |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
1155 |
url = self.get_readonly_url('from') |
|
1400.1.1
by Robert Collins
implement a basic test for the ui branch command from http servers |
1156 |
self.run_bzr('branch', url, 'to') |
1157 |
branch = Branch.open('to') |
|
1158 |
self.assertEqual(1, len(branch.revision_history())) |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
1159 |
# the branch should be set in to to from
|
1160 |
self.assertEqual(url + '/', branch.get_parent()) |
|
|
1185.16.48
by mbp at sourcefrog
- more refactoring of and tests for option parsing |
1161 |
|
|
1442.1.64
by Robert Collins
Branch.open_containing now returns a tuple (Branch, relative-path). |
1162 |
def test_log(self): |
1163 |
self.build_tree(['branch/', 'branch/file']) |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
1164 |
self.capture('init branch') |
1165 |
self.capture('add branch/file') |
|
1166 |
self.capture('commit -m foo branch') |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
1167 |
url = self.get_readonly_url('branch/file') |
|
1442.1.64
by Robert Collins
Branch.open_containing now returns a tuple (Branch, relative-path). |
1168 |
output = self.capture('log %s' % url) |
|
1185.35.17
by Aaron Bentley
Added branch nicks to long-format logs |
1169 |
self.assertEqual(8, len(output.split('\n'))) |
|
1442.1.64
by Robert Collins
Branch.open_containing now returns a tuple (Branch, relative-path). |
1170 |
|
|
1510
by Robert Collins
Merge from mpool, adjusting check to retain HTTP support. |
1171 |
def test_check(self): |
1172 |
self.build_tree(['branch/', 'branch/file']) |
|
|
1534.4.26
by Robert Collins
Move working tree initialisation out from Branch.initialize, deprecated Branch.initialize to Branch.create. |
1173 |
self.capture('init branch') |
1174 |
self.capture('add branch/file') |
|
1175 |
self.capture('commit -m foo branch') |
|
|
1534.4.50
by Robert Collins
Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running. |
1176 |
url = self.get_readonly_url('branch/') |
|
1510
by Robert Collins
Merge from mpool, adjusting check to retain HTTP support. |
1177 |
self.run_bzr('check', url) |
|
1524.1.1
by Robert Collins
Test sftp with relative, absolute-in-homedir and absolute-not-in-homedir |
1178 |
|
|
1563.1.6
by Robert Collins
Add tests for sftp push, and NonLocalTets for BzrDir.create_branch_convenience, before fixing the failure of it to work on non-local urls. |
1179 |
def test_push(self): |
1180 |
# create a source branch
|
|
1181 |
os.mkdir('my-branch') |
|
1182 |
os.chdir('my-branch') |
|
1183 |
self.run_bzr('init') |
|
1184 |
file('hello', 'wt').write('foo') |
|
1185 |
self.run_bzr('add', 'hello') |
|
1186 |
self.run_bzr('commit', '-m', 'setup') |
|
1187 |
||
1188 |
# with an explicit target work
|
|
1189 |
self.run_bzr('push', self.get_url('output-branch')) |
|
1190 |
||
|
1524.1.1
by Robert Collins
Test sftp with relative, absolute-in-homedir and absolute-not-in-homedir |
1191 |
|
1192 |
class HTTPTests(TestCaseWithWebserver, RemoteTests): |
|
1193 |
"""Test various commands against a HTTP server.""" |
|
1194 |
||
1195 |
||
1196 |
class SFTPTestsAbsolute(TestCaseWithSFTPServer, RemoteTests): |
|
1197 |
"""Test various commands against a SFTP server using abs paths.""" |
|
1198 |
||
1199 |
||
1200 |
class SFTPTestsAbsoluteSibling(TestCaseWithSFTPServer, RemoteTests): |
|
1201 |
"""Test various commands against a SFTP server using abs paths.""" |
|
1202 |
||
1203 |
def setUp(self): |
|
1204 |
super(SFTPTestsAbsoluteSibling, self).setUp() |
|
1205 |
self._override_home = '/dev/noone/runs/tests/here' |
|
1206 |
||
1207 |
||
1208 |
class SFTPTestsRelative(TestCaseWithSFTPServer, RemoteTests): |
|
1209 |
"""Test various commands against a SFTP server using homedir rel paths.""" |
|
1210 |
||
1211 |
def setUp(self): |
|
1212 |
super(SFTPTestsRelative, self).setUp() |
|
1213 |
self._get_remote_is_absolute = False |