5557.1.7
by John Arbash Meinel
Merge in the bzr.dev 5582 |
1 |
# Copyright (C) 2006-2011 Canonical Ltd
|
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
16 |
|
17 |
||
18 |
"""Black-box tests for bzr branch."""
|
|
19 |
||
20 |
import os |
|
21 |
||
4596.2.3
by Lukáš Lalinský
Add tests for various situations |
22 |
from bzrlib import ( |
23 |
branch, |
|
24 |
bzrdir, |
|
6207.3.3
by jelmer at samba
Fix tests and the like. |
25 |
controldir, |
4596.2.3
by Lukáš Lalinský
Add tests for various situations |
26 |
errors, |
27 |
revision as _mod_revision, |
|
28 |
)
|
|
2241.1.6
by Martin Pool
Move Knit repositories into the submodule bzrlib.repofmt.knitrepo and |
29 |
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1 |
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
30 |
from bzrlib.tests import TestCaseWithTransport |
4580.4.2
by Martin Pool
Add KnownFailure for branch --hardlink |
31 |
from bzrlib.tests import ( |
5651.5.3
by Andrew Bennetts
Use new fixture in more tests. |
32 |
fixtures, |
5017.3.40
by Vincent Ladeuil
-s bb.test_branch passing |
33 |
test_server, |
4580.4.2
by Martin Pool
Add KnownFailure for branch --hardlink |
34 |
)
|
5967.12.1
by Martin Pool
Move all test features into bzrlib.tests.features |
35 |
from bzrlib.tests.features import ( |
36 |
HardlinkFeature, |
|
37 |
)
|
|
5816.7.1
by Vincent Ladeuil
Remove duplication and simplify. |
38 |
from bzrlib.tests.blackbox import test_switch |
2485.8.59
by Vincent Ladeuil
Update from review comments. |
39 |
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer |
5741.3.3
by Martin Pool
Add a blackbox test for deprecation of commands |
40 |
from bzrlib.tests.script import run_script |
3696.2.4
by Daniel Watkins
Fixed test to cope with trailing slashes. |
41 |
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash |
1711.2.6
by John Arbash Meinel
Creating a test case for bug 43713, bzr branch does the right thing |
42 |
from bzrlib.workingtree import WorkingTree |
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
43 |
|
44 |
||
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
45 |
class TestBranch(TestCaseWithTransport): |
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
46 |
|
6240.3.1
by Jelmer Vernooij
Name new branches after colocated branches. |
47 |
def example_branch(self, path='.', format=None): |
48 |
tree = self.make_branch_and_tree(path, format=format) |
|
2664.8.2
by Daniel Watkins
tests.blackbox.test_branch now uses internals where appropriate. |
49 |
self.build_tree_contents([(path + '/hello', 'foo')]) |
50 |
tree.add('hello') |
|
51 |
tree.commit(message='setup') |
|
52 |
self.build_tree_contents([(path + '/goodbye', 'baz')]) |
|
53 |
tree.add('goodbye') |
|
54 |
tree.commit(message='setup') |
|
6240.3.1
by Jelmer Vernooij
Name new branches after colocated branches. |
55 |
return tree |
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
56 |
|
57 |
def test_branch(self): |
|
58 |
"""Branch from one branch to another."""
|
|
2664.8.2
by Daniel Watkins
tests.blackbox.test_branch now uses internals where appropriate. |
59 |
self.example_branch('a') |
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
60 |
self.run_bzr('branch a b') |
1773.4.1
by Martin Pool
Add pyflakes makefile target; fix many warnings |
61 |
b = branch.Branch.open('b') |
2530.3.1
by Martin Pool
Cleanup old variations on run_bzr in the test suite |
62 |
self.run_bzr('branch a c -r 1') |
3400.1.3
by Martin Pool
Merge trunk |
63 |
# previously was erroneously created by branching
|
3407.2.14
by Martin Pool
Remove more cases of getting transport via control_files |
64 |
self.assertFalse(b._transport.has('branch-name')) |
2664.8.2
by Daniel Watkins
tests.blackbox.test_branch now uses internals where appropriate. |
65 |
b.bzrdir.open_workingtree().commit(message='foo', allow_pointless=True) |
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
66 |
|
6207.2.1
by jelmer at samba
Fix cloning to colocated branch. |
67 |
def test_into_colocated(self): |
68 |
"""Branch from a branch into a colocated branch."""
|
|
69 |
self.example_branch('a') |
|
70 |
out, err = self.run_bzr( |
|
71 |
'init --format=development-colo file:b,branch=orig') |
|
72 |
self.assertEqual( |
|
6240.2.12
by Jelmer Vernooij
Fix foreign tests. |
73 |
"""Created a lightweight checkout (format: development-colo)\n""", |
6207.2.1
by jelmer at samba
Fix cloning to colocated branch. |
74 |
out) |
75 |
self.assertEqual('', err) |
|
76 |
out, err = self.run_bzr( |
|
6266.1.1
by Jelmer Vernooij
Support branching into colocated branch. |
77 |
'branch a file:b,branch=thiswasa') |
6207.2.1
by jelmer at samba
Fix cloning to colocated branch. |
78 |
self.assertEqual('', out) |
79 |
self.assertEqual('Branched 2 revisions.\n', err) |
|
80 |
out, err = self.run_bzr('branches b') |
|
6282.5.10
by Neil Martinsen-Burrell
fix test fallout |
81 |
self.assertEqual(" thiswasa\n orig\n", out) |
6207.2.1
by jelmer at samba
Fix cloning to colocated branch. |
82 |
self.assertEqual('', err) |
6266.1.1
by Jelmer Vernooij
Support branching into colocated branch. |
83 |
out,err = self.run_bzr('branch a file:b,branch=orig', retcode=3) |
84 |
self.assertEqual('', out) |
|
85 |
self.assertEqual('bzr: ERROR: Already a branch: "file:b,branch=orig".\n', err) |
|
6207.2.1
by jelmer at samba
Fix cloning to colocated branch. |
86 |
|
6240.3.1
by Jelmer Vernooij
Name new branches after colocated branches. |
87 |
def test_from_colocated(self): |
88 |
"""Branch from a colocated branch into a regular branch."""
|
|
89 |
tree = self.example_branch('a', format='development-colo') |
|
90 |
tree.bzrdir.create_branch(name='somecolo') |
|
91 |
out, err = self.run_bzr('branch %s,branch=somecolo' % |
|
92 |
local_path_to_url('a')) |
|
93 |
self.assertEqual('', out) |
|
94 |
self.assertEqual('Branched 0 revisions.\n', err) |
|
95 |
self.assertPathExists("somecolo") |
|
96 |
||
5927.2.1
by Jonathan Riddell
start a test case for corrupt pack files |
97 |
def test_branch_broken_pack(self): |
98 |
"""branching with a corrupted pack file."""
|
|
99 |
self.example_branch('a') |
|
6158.1.1
by Vincent Ladeuil
Fix random test failure by making the test not random |
100 |
# add some corruption
|
101 |
packs_dir = 'a/.bzr/repository/packs/' |
|
102 |
fname = packs_dir + os.listdir(packs_dir)[0] |
|
5927.2.8
by Jonathan Riddell
tidy up file opening in test |
103 |
with open(fname, 'rb+') as f: |
6158.1.1
by Vincent Ladeuil
Fix random test failure by making the test not random |
104 |
# Start from the end of the file to avoid choosing a place bigger
|
105 |
# than the file itself.
|
|
106 |
f.seek(-5, os.SEEK_END) |
|
107 |
c = f.read(1) |
|
108 |
f.seek(-5, os.SEEK_END) |
|
109 |
# Make sure we inject a value different than the one we just read
|
|
110 |
if c == '\xFF': |
|
111 |
corrupt = '\x00' |
|
112 |
else: |
|
113 |
corrupt = '\xFF' |
|
114 |
f.write(corrupt) # make sure we corrupt something |
|
5927.2.6
by Jonathan Riddell
Make error message less specific (might not be a local disk issue) and pass through zlib error |
115 |
self.run_bzr_error(['Corruption while decompressing repository file'], |
116 |
'branch a b', retcode=3) |
|
5927.2.1
by Jonathan Riddell
start a test case for corrupt pack files |
117 |
|
4596.2.3
by Lukáš Lalinský
Add tests for various situations |
118 |
def test_branch_switch_no_branch(self): |
119 |
# No branch in the current directory:
|
|
120 |
# => new branch will be created, but switch fails
|
|
121 |
self.example_branch('a') |
|
122 |
self.make_repository('current') |
|
123 |
self.run_bzr_error(['No WorkingTree exists for'], |
|
124 |
'branch --switch ../a ../b', working_dir='current') |
|
125 |
a = branch.Branch.open('a') |
|
126 |
b = branch.Branch.open('b') |
|
127 |
self.assertEqual(a.last_revision(), b.last_revision()) |
|
128 |
||
129 |
def test_branch_switch_no_wt(self): |
|
130 |
# No working tree in the current directory:
|
|
131 |
# => new branch will be created, but switch fails and the current
|
|
132 |
# branch is unmodified
|
|
133 |
self.example_branch('a') |
|
134 |
self.make_branch('current') |
|
135 |
self.run_bzr_error(['No WorkingTree exists for'], |
|
136 |
'branch --switch ../a ../b', working_dir='current') |
|
137 |
a = branch.Branch.open('a') |
|
138 |
b = branch.Branch.open('b') |
|
139 |
self.assertEqual(a.last_revision(), b.last_revision()) |
|
140 |
work = branch.Branch.open('current') |
|
141 |
self.assertEqual(work.last_revision(), _mod_revision.NULL_REVISION) |
|
142 |
||
4596.2.1
by Lukáš Lalinský
Add support for `bzr branch --switch` |
143 |
def test_branch_switch_no_checkout(self): |
4596.2.3
by Lukáš Lalinský
Add tests for various situations |
144 |
# Standalone branch in the current directory:
|
145 |
# => new branch will be created, but switch fails and the current
|
|
146 |
# branch is unmodified
|
|
4596.2.1
by Lukáš Lalinský
Add support for `bzr branch --switch` |
147 |
self.example_branch('a') |
4596.2.3
by Lukáš Lalinský
Add tests for various situations |
148 |
self.make_branch_and_tree('current') |
4596.2.1
by Lukáš Lalinský
Add support for `bzr branch --switch` |
149 |
self.run_bzr_error(['Cannot switch a branch, only a checkout'], |
4596.2.3
by Lukáš Lalinský
Add tests for various situations |
150 |
'branch --switch ../a ../b', working_dir='current') |
151 |
a = branch.Branch.open('a') |
|
152 |
b = branch.Branch.open('b') |
|
153 |
self.assertEqual(a.last_revision(), b.last_revision()) |
|
154 |
work = branch.Branch.open('current') |
|
155 |
self.assertEqual(work.last_revision(), _mod_revision.NULL_REVISION) |
|
156 |
||
157 |
def test_branch_switch_checkout(self): |
|
158 |
# Checkout in the current directory:
|
|
159 |
# => new branch will be created and checkout bound to the new branch
|
|
160 |
self.example_branch('a') |
|
161 |
self.run_bzr('checkout a current') |
|
162 |
out, err = self.run_bzr('branch --switch ../a ../b', working_dir='current') |
|
163 |
a = branch.Branch.open('a') |
|
164 |
b = branch.Branch.open('b') |
|
165 |
self.assertEqual(a.last_revision(), b.last_revision()) |
|
166 |
work = WorkingTree.open('current') |
|
167 |
self.assertEndsWith(work.branch.get_bound_location(), '/b/') |
|
168 |
self.assertContainsRe(err, "Switched to branch: .*/b/") |
|
169 |
||
170 |
def test_branch_switch_lightweight_checkout(self): |
|
171 |
# Lightweight checkout in the current directory:
|
|
172 |
# => new branch will be created and lightweight checkout pointed to
|
|
173 |
# the new branch
|
|
174 |
self.example_branch('a') |
|
175 |
self.run_bzr('checkout --lightweight a current') |
|
176 |
out, err = self.run_bzr('branch --switch ../a ../b', working_dir='current') |
|
177 |
a = branch.Branch.open('a') |
|
178 |
b = branch.Branch.open('b') |
|
179 |
self.assertEqual(a.last_revision(), b.last_revision()) |
|
180 |
work = WorkingTree.open('current') |
|
181 |
self.assertEndsWith(work.branch.base, '/b/') |
|
4596.2.1
by Lukáš Lalinský
Add support for `bzr branch --switch` |
182 |
self.assertContainsRe(err, "Switched to branch: .*/b/") |
183 |
||
1711.2.6
by John Arbash Meinel
Creating a test case for bug 43713, bzr branch does the right thing |
184 |
def test_branch_only_copies_history(self): |
185 |
# Knit branches should only push the history for the current revision.
|
|
1773.4.1
by Martin Pool
Add pyflakes makefile target; fix many warnings |
186 |
format = bzrdir.BzrDirMetaFormat1() |
1711.2.6
by John Arbash Meinel
Creating a test case for bug 43713, bzr branch does the right thing |
187 |
format.repository_format = RepositoryFormatKnit1() |
188 |
shared_repo = self.make_repository('repo', format=format, shared=True) |
|
189 |
shared_repo.set_make_working_trees(True) |
|
190 |
||
191 |
def make_shared_tree(path): |
|
192 |
shared_repo.bzrdir.root_transport.mkdir(path) |
|
6207.3.3
by jelmer at samba
Fix tests and the like. |
193 |
controldir.ControlDir.create_branch_convenience('repo/' + path) |
1711.2.6
by John Arbash Meinel
Creating a test case for bug 43713, bzr branch does the right thing |
194 |
return WorkingTree.open('repo/' + path) |
195 |
tree_a = make_shared_tree('a') |
|
196 |
self.build_tree(['repo/a/file']) |
|
197 |
tree_a.add('file') |
|
198 |
tree_a.commit('commit a-1', rev_id='a-1') |
|
199 |
f = open('repo/a/file', 'ab') |
|
200 |
f.write('more stuff\n') |
|
201 |
f.close() |
|
202 |
tree_a.commit('commit a-2', rev_id='a-2') |
|
203 |
||
204 |
tree_b = make_shared_tree('b') |
|
205 |
self.build_tree(['repo/b/file']) |
|
206 |
tree_b.add('file') |
|
207 |
tree_b.commit('commit b-1', rev_id='b-1') |
|
208 |
||
209 |
self.assertTrue(shared_repo.has_revision('a-1')) |
|
210 |
self.assertTrue(shared_repo.has_revision('a-2')) |
|
211 |
self.assertTrue(shared_repo.has_revision('b-1')) |
|
212 |
||
213 |
# Now that we have a repository with shared files, make sure
|
|
214 |
# that things aren't copied out by a 'branch'
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
215 |
self.run_bzr('branch repo/b branch-b') |
1711.2.6
by John Arbash Meinel
Creating a test case for bug 43713, bzr branch does the right thing |
216 |
pushed_tree = WorkingTree.open('branch-b') |
217 |
pushed_repo = pushed_tree.branch.repository |
|
218 |
self.assertFalse(pushed_repo.has_revision('a-1')) |
|
219 |
self.assertFalse(pushed_repo.has_revision('a-2')) |
|
220 |
self.assertTrue(pushed_repo.has_revision('b-1')) |
|
221 |
||
3136.1.3
by Aaron Bentley
Implement hard-link support for branch and checkout |
222 |
def test_branch_hardlink(self): |
223 |
self.requireFeature(HardlinkFeature) |
|
224 |
source = self.make_branch_and_tree('source') |
|
225 |
self.build_tree(['source/file1']) |
|
226 |
source.add('file1') |
|
227 |
source.commit('added file') |
|
4580.4.2
by Martin Pool
Add KnownFailure for branch --hardlink |
228 |
out, err = self.run_bzr(['branch', 'source', 'target', '--hardlink']) |
3136.1.3
by Aaron Bentley
Implement hard-link support for branch and checkout |
229 |
source_stat = os.stat('source/file1') |
230 |
target_stat = os.stat('target/file1') |
|
4826.1.3
by Andrew Bennetts
Remove KnownFailure from test_branch_hardlink. |
231 |
self.assertEqual(source_stat, target_stat) |
3136.1.3
by Aaron Bentley
Implement hard-link support for branch and checkout |
232 |
|
5353.2.2
by John Arbash Meinel
update the test suite. |
233 |
def test_branch_files_from(self): |
234 |
source = self.make_branch_and_tree('source') |
|
235 |
self.build_tree(['source/file1']) |
|
236 |
source.add('file1') |
|
237 |
source.commit('added file') |
|
238 |
out, err = self.run_bzr('branch source target --files-from source') |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
239 |
self.assertPathExists('target/file1') |
5353.2.2
by John Arbash Meinel
update the test suite. |
240 |
|
241 |
def test_branch_files_from_hardlink(self): |
|
242 |
self.requireFeature(HardlinkFeature) |
|
243 |
source = self.make_branch_and_tree('source') |
|
244 |
self.build_tree(['source/file1']) |
|
245 |
source.add('file1') |
|
246 |
source.commit('added file') |
|
247 |
source.bzrdir.sprout('second') |
|
248 |
out, err = self.run_bzr('branch source target --files-from second' |
|
249 |
' --hardlink') |
|
250 |
source_stat = os.stat('source/file1') |
|
251 |
second_stat = os.stat('second/file1') |
|
252 |
target_stat = os.stat('target/file1') |
|
253 |
self.assertNotEqual(source_stat, target_stat) |
|
5353.2.5
by John Arbash Meinel
We need to assert that the --hardlink makes the files the same, not different. |
254 |
self.assertEqual(second_stat, target_stat) |
5353.2.2
by John Arbash Meinel
update the test suite. |
255 |
|
3696.2.1
by Daniel Watkins
Added test for 'branch --standalone'. |
256 |
def test_branch_standalone(self): |
257 |
shared_repo = self.make_repository('repo', shared=True) |
|
258 |
self.example_branch('source') |
|
259 |
self.run_bzr('branch --standalone source repo/target') |
|
260 |
b = branch.Branch.open('repo/target') |
|
261 |
expected_repo_path = os.path.abspath('repo/target/.bzr/repository') |
|
3696.2.4
by Daniel Watkins
Fixed test to cope with trailing slashes. |
262 |
self.assertEqual(strip_trailing_slash(b.repository.base), |
263 |
strip_trailing_slash(local_path_to_url(expected_repo_path))) |
|
3696.2.1
by Daniel Watkins
Added test for 'branch --standalone'. |
264 |
|
3983.1.5
by Daniel Watkins
Added blackbox test. |
265 |
def test_branch_no_tree(self): |
266 |
self.example_branch('source') |
|
267 |
self.run_bzr('branch --no-tree source target') |
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
268 |
self.assertPathDoesNotExist('target/hello') |
269 |
self.assertPathDoesNotExist('target/goodbye') |
|
3983.1.5
by Daniel Watkins
Added blackbox test. |
270 |
|
4479.2.1
by Alexander Belchenko
branch command now has new flag --use-existing-dir to force branching into existing directory if there is no branch yet. |
271 |
def test_branch_into_existing_dir(self): |
272 |
self.example_branch('a') |
|
4479.2.2
by Vincent Ladeuil
Fix typos and add NEWS entry. |
273 |
# existing dir with similar files but no .bzr dir
|
274 |
self.build_tree_contents([('b/',)]) |
|
4479.2.1
by Alexander Belchenko
branch command now has new flag --use-existing-dir to force branching into existing directory if there is no branch yet. |
275 |
self.build_tree_contents([('b/hello', 'bar')]) # different content |
4479.2.2
by Vincent Ladeuil
Fix typos and add NEWS entry. |
276 |
self.build_tree_contents([('b/goodbye', 'baz')])# same content |
277 |
# fails without --use-existing-dir
|
|
4479.2.1
by Alexander Belchenko
branch command now has new flag --use-existing-dir to force branching into existing directory if there is no branch yet. |
278 |
out,err = self.run_bzr('branch a b', retcode=3) |
279 |
self.assertEqual('', out) |
|
280 |
self.assertEqual('bzr: ERROR: Target directory "b" already exists.\n', |
|
281 |
err) |
|
282 |
# force operation
|
|
283 |
self.run_bzr('branch a b --use-existing-dir') |
|
284 |
# check conflicts
|
|
5784.1.3
by Martin Pool
Switch away from using failUnlessExists and failIfExists |
285 |
self.assertPathExists('b/hello.moved') |
286 |
self.assertPathDoesNotExist('b/godbye.moved') |
|
4479.2.1
by Alexander Belchenko
branch command now has new flag --use-existing-dir to force branching into existing directory if there is no branch yet. |
287 |
# we can't branch into branch
|
288 |
out,err = self.run_bzr('branch a b --use-existing-dir', retcode=3) |
|
289 |
self.assertEqual('', out) |
|
290 |
self.assertEqual('bzr: ERROR: Already a branch: "b".\n', err) |
|
291 |
||
4927.3.1
by Ian Clatworthy
branch --bind option |
292 |
def test_branch_bind(self): |
293 |
self.example_branch('a') |
|
294 |
out, err = self.run_bzr('branch a b --bind') |
|
4948.3.1
by Ian Clatworthy
branch --bind option |
295 |
self.assertEndsWith(err, "New branch bound to a\n") |
4927.3.1
by Ian Clatworthy
branch --bind option |
296 |
b = branch.Branch.open('b') |
297 |
self.assertEndsWith(b.get_bound_location(), '/a/') |
|
298 |
||
5107.3.6
by Marco Pantaleoni
Documented behaviour of 'post_branch_init' for lightweight checkouts. |
299 |
def test_branch_with_post_branch_init_hook(self): |
300 |
calls = [] |
|
301 |
branch.Branch.hooks.install_named_hook('post_branch_init', |
|
302 |
calls.append, None) |
|
303 |
self.assertLength(0, calls) |
|
304 |
self.example_branch('a') |
|
305 |
self.assertLength(1, calls) |
|
306 |
self.run_bzr('branch a b') |
|
307 |
self.assertLength(2, calls) |
|
308 |
||
309 |
def test_checkout_with_post_branch_init_hook(self): |
|
310 |
calls = [] |
|
311 |
branch.Branch.hooks.install_named_hook('post_branch_init', |
|
312 |
calls.append, None) |
|
313 |
self.assertLength(0, calls) |
|
314 |
self.example_branch('a') |
|
315 |
self.assertLength(1, calls) |
|
316 |
self.run_bzr('checkout a b') |
|
317 |
self.assertLength(2, calls) |
|
318 |
||
319 |
def test_lightweight_checkout_with_post_branch_init_hook(self): |
|
320 |
calls = [] |
|
321 |
branch.Branch.hooks.install_named_hook('post_branch_init', |
|
322 |
calls.append, None) |
|
323 |
self.assertLength(0, calls) |
|
324 |
self.example_branch('a') |
|
325 |
self.assertLength(1, calls) |
|
326 |
self.run_bzr('checkout --lightweight a b') |
|
327 |
self.assertLength(2, calls) |
|
328 |
||
5535.3.1
by Andrew Bennetts
Initial hack to make 'bzr branch' (and BzrDir.sprout) fetch all tags, not just branch tip. |
329 |
def test_branch_fetches_all_tags(self): |
330 |
builder = self.make_branch_builder('source') |
|
5651.5.3
by Andrew Bennetts
Use new fixture in more tests. |
331 |
source = fixtures.build_branch_with_non_ancestral_rev(builder) |
5535.3.1
by Andrew Bennetts
Initial hack to make 'bzr branch' (and BzrDir.sprout) fetch all tags, not just branch tip. |
332 |
source.tags.set_tag('tag-a', 'rev-2') |
6015.15.2
by John Arbash Meinel
This adds one more hpss round trip to determine the configuration setting. |
333 |
source.get_config().set_user_option('branch.fetch_tags', 'True') |
5535.3.1
by Andrew Bennetts
Initial hack to make 'bzr branch' (and BzrDir.sprout) fetch all tags, not just branch tip. |
334 |
# Now source has a tag not in its ancestry. Make a branch from it.
|
335 |
self.run_bzr('branch source new-branch') |
|
336 |
new_branch = branch.Branch.open('new-branch') |
|
337 |
# The tag is present, and so is its revision.
|
|
338 |
self.assertEqual('rev-2', new_branch.tags.lookup_tag('tag-a')) |
|
339 |
new_branch.repository.get_revision('rev-2') |
|
340 |
||
3665.2.5
by John Arbash Meinel
Test that we alert the user to the upgrade. |
341 |
|
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
342 |
class TestBranchStacked(TestCaseWithTransport): |
3575.2.2
by Martin Pool
branch --stacked should force a stacked format |
343 |
"""Tests for branch --stacked"""
|
344 |
||
3517.4.11
by Martin Pool
Improved blackbox tests for stacked branches |
345 |
def assertRevisionInRepository(self, repo_path, revid): |
346 |
"""Check that a revision is in a repository, disregarding stacking."""
|
|
347 |
repo = bzrdir.BzrDir.open(repo_path).open_repository() |
|
348 |
self.assertTrue(repo.has_revision(revid)) |
|
349 |
||
350 |
def assertRevisionNotInRepository(self, repo_path, revid): |
|
351 |
"""Check that a revision is not in a repository, disregarding stacking."""
|
|
352 |
repo = bzrdir.BzrDir.open(repo_path).open_repository() |
|
353 |
self.assertFalse(repo.has_revision(revid)) |
|
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
354 |
|
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
355 |
def assertRevisionsInBranchRepository(self, revid_list, branch_path): |
356 |
repo = branch.Branch.open(branch_path).repository |
|
357 |
self.assertEqual(set(revid_list), |
|
358 |
repo.has_revisions(revid_list)) |
|
359 |
||
360 |
def test_branch_stacked_branch_not_stacked(self): |
|
361 |
"""Branching a stacked branch is not stacked by default"""
|
|
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
362 |
# We have a mainline
|
363 |
trunk_tree = self.make_branch_and_tree('target', |
|
4241.6.8
by Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil
Add --development6-rich-root, disabling the legacy and unneeded development2 format, and activating the tests for CHK features disabled pending this format. (Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil) |
364 |
format='1.9') |
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
365 |
trunk_tree.commit('mainline') |
3221.20.3
by Ian Clatworthy
shallow -> stacked |
366 |
# and a branch from it which is stacked
|
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
367 |
branch_tree = self.make_branch_and_tree('branch', |
4241.6.8
by Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil
Add --development6-rich-root, disabling the legacy and unneeded development2 format, and activating the tests for CHK features disabled pending this format. (Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil) |
368 |
format='1.9') |
3537.3.3
by Martin Pool
Rename Branch.set_stacked_on to set_stacked_on_url |
369 |
branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base) |
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
370 |
# with some work on it
|
4595.4.4
by Robert Collins
Disable committing directly to stacked branches from lightweight checkouts. |
371 |
work_tree = trunk_tree.branch.bzrdir.sprout('local').open_workingtree() |
372 |
work_tree.commit('moar work plz') |
|
373 |
work_tree.branch.push(branch_tree.branch) |
|
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
374 |
# branching our local branch gives us a new stacked branch pointing at
|
375 |
# mainline.
|
|
376 |
out, err = self.run_bzr(['branch', 'branch', 'newbranch']) |
|
377 |
self.assertEqual('', out) |
|
6143.1.4
by Jonathan Riddell
update tests |
378 |
self.assertEqual('Branched 2 revisions.\n', |
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
379 |
err) |
3575.2.2
by Martin Pool
branch --stacked should force a stacked format |
380 |
# it should have preserved the branch format, and so it should be
|
381 |
# capable of supporting stacking, but not actually have a stacked_on
|
|
382 |
# branch configured
|
|
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
383 |
self.assertRaises(errors.NotStacked, |
384 |
bzrdir.BzrDir.open('newbranch').open_branch().get_stacked_on_url) |
|
385 |
||
386 |
def test_branch_stacked_branch_stacked(self): |
|
387 |
"""Asking to stack on a stacked branch does work"""
|
|
388 |
# We have a mainline
|
|
389 |
trunk_tree = self.make_branch_and_tree('target', |
|
4241.6.8
by Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil
Add --development6-rich-root, disabling the legacy and unneeded development2 format, and activating the tests for CHK features disabled pending this format. (Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil) |
390 |
format='1.9') |
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
391 |
trunk_revid = trunk_tree.commit('mainline') |
392 |
# and a branch from it which is stacked
|
|
393 |
branch_tree = self.make_branch_and_tree('branch', |
|
4241.6.8
by Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil
Add --development6-rich-root, disabling the legacy and unneeded development2 format, and activating the tests for CHK features disabled pending this format. (Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil) |
394 |
format='1.9') |
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
395 |
branch_tree.branch.set_stacked_on_url(trunk_tree.branch.base) |
396 |
# with some work on it
|
|
4595.4.4
by Robert Collins
Disable committing directly to stacked branches from lightweight checkouts. |
397 |
work_tree = trunk_tree.branch.bzrdir.sprout('local').open_workingtree() |
398 |
branch_revid = work_tree.commit('moar work plz') |
|
399 |
work_tree.branch.push(branch_tree.branch) |
|
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
400 |
# you can chain branches on from there
|
401 |
out, err = self.run_bzr(['branch', 'branch', '--stacked', 'branch2']) |
|
402 |
self.assertEqual('', out) |
|
3221.20.3
by Ian Clatworthy
shallow -> stacked |
403 |
self.assertEqual('Created new stacked branch referring to %s.\n' % |
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
404 |
branch_tree.branch.base, err) |
405 |
self.assertEqual(branch_tree.branch.base, |
|
406 |
branch.Branch.open('branch2').get_stacked_on_url()) |
|
407 |
branch2_tree = WorkingTree.open('branch2') |
|
4595.4.4
by Robert Collins
Disable committing directly to stacked branches from lightweight checkouts. |
408 |
branch2_revid = work_tree.commit('work on second stacked branch') |
409 |
work_tree.branch.push(branch2_tree.branch) |
|
3549.1.4
by Martin Pool
Branching a stacked branch should not automatically turn on stacking |
410 |
self.assertRevisionInRepository('branch2', branch2_revid) |
411 |
self.assertRevisionsInBranchRepository( |
|
412 |
[trunk_revid, branch_revid, branch2_revid], |
|
413 |
'branch2') |
|
3221.11.19
by Robert Collins
Branching a shallow branch gets a shallow branch. |
414 |
|
3221.20.3
by Ian Clatworthy
shallow -> stacked |
415 |
def test_branch_stacked(self): |
3221.11.20
by Robert Collins
Support --shallow on branch. |
416 |
# We have a mainline
|
417 |
trunk_tree = self.make_branch_and_tree('mainline', |
|
4241.6.8
by Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil
Add --development6-rich-root, disabling the legacy and unneeded development2 format, and activating the tests for CHK features disabled pending this format. (Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil) |
418 |
format='1.9') |
3517.4.11
by Martin Pool
Improved blackbox tests for stacked branches |
419 |
original_revid = trunk_tree.commit('mainline') |
420 |
self.assertRevisionInRepository('mainline', original_revid) |
|
3221.20.3
by Ian Clatworthy
shallow -> stacked |
421 |
# and a branch from it which is stacked
|
422 |
out, err = self.run_bzr(['branch', '--stacked', 'mainline', |
|
3221.20.1
by Ian Clatworthy
tweaks by igc during review |
423 |
'newbranch']) |
3221.11.20
by Robert Collins
Support --shallow on branch. |
424 |
self.assertEqual('', out) |
3221.20.3
by Ian Clatworthy
shallow -> stacked |
425 |
self.assertEqual('Created new stacked branch referring to %s.\n' % |
3221.11.20
by Robert Collins
Support --shallow on branch. |
426 |
trunk_tree.branch.base, err) |
3517.4.11
by Martin Pool
Improved blackbox tests for stacked branches |
427 |
self.assertRevisionNotInRepository('newbranch', original_revid) |
4595.4.4
by Robert Collins
Disable committing directly to stacked branches from lightweight checkouts. |
428 |
new_branch = branch.Branch.open('newbranch') |
429 |
self.assertEqual(trunk_tree.branch.base, new_branch.get_stacked_on_url()) |
|
3221.11.20
by Robert Collins
Support --shallow on branch. |
430 |
|
3221.15.10
by Robert Collins
Add test that we can stack on a smart server from Jonathan Lange. |
431 |
def test_branch_stacked_from_smart_server(self): |
432 |
# We can branch stacking on a smart server
|
|
5017.3.40
by Vincent Ladeuil
-s bb.test_branch passing |
433 |
self.transport_server = test_server.SmartTCPServer_for_testing |
4241.6.8
by Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil
Add --development6-rich-root, disabling the legacy and unneeded development2 format, and activating the tests for CHK features disabled pending this format. (Robert Collins, John Arbash Meinel, Ian Clatworthy, Vincent Ladeuil) |
434 |
trunk = self.make_branch('mainline', format='1.9') |
3221.15.10
by Robert Collins
Add test that we can stack on a smart server from Jonathan Lange. |
435 |
out, err = self.run_bzr( |
436 |
['branch', '--stacked', self.get_url('mainline'), 'shallow']) |
|
437 |
||
3575.2.2
by Martin Pool
branch --stacked should force a stacked format |
438 |
def test_branch_stacked_from_non_stacked_format(self): |
439 |
"""The origin format doesn't support stacking"""
|
|
440 |
trunk = self.make_branch('trunk', format='pack-0.92') |
|
441 |
out, err = self.run_bzr( |
|
442 |
['branch', '--stacked', 'trunk', 'shallow']) |
|
3665.2.5
by John Arbash Meinel
Test that we alert the user to the upgrade. |
443 |
# We should notify the user that we upgraded their format
|
3665.2.6
by John Arbash Meinel
Change the text a bit, and point to the explicit --1.6 or --1.6.1-rich-root bzrdir format. |
444 |
self.assertEqualDiff( |
4401.1.3
by John Arbash Meinel
Change back to defaulting to --1.6 format, and update the blackbox tests. |
445 |
'Source repository format does not support stacking, using format:\n' |
3665.2.6
by John Arbash Meinel
Change the text a bit, and point to the explicit --1.6 or --1.6.1-rich-root bzrdir format. |
446 |
' Packs 5 (adds stacking support, requires bzr 1.6)\n' |
4401.1.3
by John Arbash Meinel
Change back to defaulting to --1.6 format, and update the blackbox tests. |
447 |
'Source branch format does not support stacking, using format:\n' |
448 |
' Branch format 7\n' |
|
4634.144.6
by Martin Pool
Branching that does an implicit conversion now shows the fetch warning |
449 |
'Doing on-the-fly conversion from RepositoryFormatKnitPack1() to RepositoryFormatKnitPack5().\n' |
450 |
'This may take some time. Upgrade the repositories to the same format for better performance.\n' |
|
3665.2.6
by John Arbash Meinel
Change the text a bit, and point to the explicit --1.6 or --1.6.1-rich-root bzrdir format. |
451 |
'Created new stacked branch referring to %s.\n' % (trunk.base,), |
452 |
err) |
|
453 |
||
454 |
def test_branch_stacked_from_rich_root_non_stackable(self): |
|
455 |
trunk = self.make_branch('trunk', format='rich-root-pack') |
|
456 |
out, err = self.run_bzr( |
|
457 |
['branch', '--stacked', 'trunk', 'shallow']) |
|
458 |
# We should notify the user that we upgraded their format
|
|
459 |
self.assertEqualDiff( |
|
4401.1.3
by John Arbash Meinel
Change back to defaulting to --1.6 format, and update the blackbox tests. |
460 |
'Source repository format does not support stacking, using format:\n' |
3665.2.6
by John Arbash Meinel
Change the text a bit, and point to the explicit --1.6 or --1.6.1-rich-root bzrdir format. |
461 |
' Packs 5 rich-root (adds stacking support, requires bzr 1.6.1)\n' |
4401.1.3
by John Arbash Meinel
Change back to defaulting to --1.6 format, and update the blackbox tests. |
462 |
'Source branch format does not support stacking, using format:\n' |
463 |
' Branch format 7\n' |
|
4634.144.6
by Martin Pool
Branching that does an implicit conversion now shows the fetch warning |
464 |
'Doing on-the-fly conversion from RepositoryFormatKnitPack4() to RepositoryFormatKnitPack5RichRoot().\n' |
465 |
'This may take some time. Upgrade the repositories to the same format for better performance.\n' |
|
3665.2.6
by John Arbash Meinel
Change the text a bit, and point to the explicit --1.6 or --1.6.1-rich-root bzrdir format. |
466 |
'Created new stacked branch referring to %s.\n' % (trunk.base,), |
467 |
err) |
|
468 |
||
3575.2.2
by Martin Pool
branch --stacked should force a stacked format |
469 |
|
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
470 |
class TestSmartServerBranching(TestCaseWithTransport): |
4060.1.1
by Robert Collins
Add ratcheted acceptance test for branching from a smart server. |
471 |
|
4060.1.4
by Robert Collins
Streaming fetch from remote servers. |
472 |
def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self): |
473 |
self.setup_smart_server_with_call_log() |
|
474 |
t = self.make_branch_and_tree('from') |
|
475 |
for count in range(9): |
|
476 |
t.commit(message='commit %d' % count) |
|
477 |
self.reset_smart_call_log() |
|
478 |
out, err = self.run_bzr(['branch', self.get_url('from'), |
|
479 |
self.get_url('target')]) |
|
480 |
# This figure represent the amount of work to perform this use case. It
|
|
481 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
482 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
483 |
# become necessary for this use case. Please do not adjust this number
|
|
484 |
# upwards without agreement from bzr's network support maintainers.
|
|
5268.8.22
by Jelmer Vernooij
Fix hpss count. |
485 |
self.assertLength(40, self.hpss_calls) |
4060.1.4
by Robert Collins
Streaming fetch from remote servers. |
486 |
|
4060.1.1
by Robert Collins
Add ratcheted acceptance test for branching from a smart server. |
487 |
def test_branch_from_trivial_branch_streaming_acceptance(self): |
488 |
self.setup_smart_server_with_call_log() |
|
489 |
t = self.make_branch_and_tree('from') |
|
490 |
for count in range(9): |
|
491 |
t.commit(message='commit %d' % count) |
|
492 |
self.reset_smart_call_log() |
|
4060.1.2
by Robert Collins
Get RemoteToOther inter repository logic using the generic fetch code, to permit eventual streaming from smart servers. |
493 |
out, err = self.run_bzr(['branch', self.get_url('from'), |
494 |
'local-target']) |
|
4060.1.1
by Robert Collins
Add ratcheted acceptance test for branching from a smart server. |
495 |
# This figure represent the amount of work to perform this use case. It
|
496 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
497 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
498 |
# become necessary for this use case. Please do not adjust this number
|
|
499 |
# upwards without agreement from bzr's network support maintainers.
|
|
6015.15.3
by John Arbash Meinel
More cases that show the extra RPC |
500 |
self.assertLength(10, self.hpss_calls) |
4060.1.1
by Robert Collins
Add ratcheted acceptance test for branching from a smart server. |
501 |
|
4152.1.2
by Robert Collins
Add streaming from a stacked branch when the sort order is compatible with doing so. |
502 |
def test_branch_from_trivial_stacked_branch_streaming_acceptance(self): |
503 |
self.setup_smart_server_with_call_log() |
|
504 |
t = self.make_branch_and_tree('trunk') |
|
505 |
for count in range(8): |
|
506 |
t.commit(message='commit %d' % count) |
|
507 |
tree2 = t.branch.bzrdir.sprout('feature', stacked=True |
|
508 |
).open_workingtree() |
|
4595.4.1
by Robert Collins
Fix test_branch_from_trivial_stacked_branch_streaming_acceptance to work with rich root formats, pending work on bug 375013. |
509 |
local_tree = t.branch.bzrdir.sprout('local-working').open_workingtree() |
510 |
local_tree.commit('feature change') |
|
511 |
local_tree.branch.push(tree2.branch) |
|
4152.1.2
by Robert Collins
Add streaming from a stacked branch when the sort order is compatible with doing so. |
512 |
self.reset_smart_call_log() |
513 |
out, err = self.run_bzr(['branch', self.get_url('feature'), |
|
514 |
'local-target']) |
|
515 |
# This figure represent the amount of work to perform this use case. It
|
|
516 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
517 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
518 |
# become necessary for this use case. Please do not adjust this number
|
|
519 |
# upwards without agreement from bzr's network support maintainers.
|
|
6015.15.3
by John Arbash Meinel
More cases that show the extra RPC |
520 |
self.assertLength(15, self.hpss_calls) |
4152.1.2
by Robert Collins
Add streaming from a stacked branch when the sort order is compatible with doing so. |
521 |
|
5535.4.7
by Andrew Bennetts
Add HPSS acceptance test. |
522 |
def test_branch_from_branch_with_tags(self): |
523 |
self.setup_smart_server_with_call_log() |
|
524 |
builder = self.make_branch_builder('source') |
|
5651.5.3
by Andrew Bennetts
Use new fixture in more tests. |
525 |
source = fixtures.build_branch_with_non_ancestral_rev(builder) |
6015.15.2
by John Arbash Meinel
This adds one more hpss round trip to determine the configuration setting. |
526 |
source.get_config().set_user_option('branch.fetch_tags', 'True') |
5535.4.7
by Andrew Bennetts
Add HPSS acceptance test. |
527 |
source.tags.set_tag('tag-a', 'rev-2') |
528 |
source.tags.set_tag('tag-missing', 'missing-rev') |
|
529 |
# Now source has a tag not in its ancestry. Make a branch from it.
|
|
530 |
self.reset_smart_call_log() |
|
531 |
out, err = self.run_bzr(['branch', self.get_url('source'), 'target']) |
|
532 |
# This figure represent the amount of work to perform this use case. It
|
|
533 |
# is entirely ok to reduce this number if a test fails due to rpc_count
|
|
534 |
# being too low. If rpc_count increases, more network roundtrips have
|
|
535 |
# become necessary for this use case. Please do not adjust this number
|
|
536 |
# upwards without agreement from bzr's network support maintainers.
|
|
6015.15.2
by John Arbash Meinel
This adds one more hpss round trip to determine the configuration setting. |
537 |
self.assertLength(10, self.hpss_calls) |
5535.4.7
by Andrew Bennetts
Add HPSS acceptance test. |
538 |
|
5816.8.1
by Andrew Bennetts
Be a little more clever about constructing a parents provider for stacked repositories, so that get_parent_map with local-stacked-on-remote doesn't use HPSS VFS calls. |
539 |
def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self): |
540 |
self.setup_smart_server_with_call_log() |
|
541 |
t = self.make_branch_and_tree('from') |
|
542 |
for count in range(9): |
|
543 |
t.commit(message='commit %d' % count) |
|
544 |
self.reset_smart_call_log() |
|
545 |
out, err = self.run_bzr(['branch', '--stacked', self.get_url('from'), |
|
546 |
'local-target']) |
|
5816.8.6
by Andrew Bennetts
Fix another bug, and some cosmetic nits. |
547 |
# XXX: the number of hpss calls for this case isn't deterministic yet,
|
5816.8.1
by Andrew Bennetts
Be a little more clever about constructing a parents provider for stacked repositories, so that get_parent_map with local-stacked-on-remote doesn't use HPSS VFS calls. |
548 |
# so we can't easily assert about the number of calls.
|
549 |
#self.assertLength(XXX, self.hpss_calls)
|
|
550 |
# We can assert that none of the calls were readv requests for rix
|
|
551 |
# files, though (demonstrating that at least get_parent_map calls are
|
|
552 |
# not using VFS RPCs).
|
|
553 |
readvs_of_rix_files = [ |
|
554 |
c for c in self.hpss_calls |
|
555 |
if c.call.method == 'readv' and c.call.args[-1].endswith('.rix')] |
|
556 |
self.assertLength(0, readvs_of_rix_files) |
|
557 |
||
1711.2.5
by John Arbash Meinel
Factoring blackbox tests into their own file. |
558 |
|
2485.8.59
by Vincent Ladeuil
Update from review comments. |
559 |
class TestRemoteBranch(TestCaseWithSFTPServer): |
560 |
||
561 |
def setUp(self): |
|
562 |
super(TestRemoteBranch, self).setUp() |
|
563 |
tree = self.make_branch_and_tree('branch') |
|
564 |
self.build_tree_contents([('branch/file', 'file content\n')]) |
|
565 |
tree.add('file') |
|
566 |
tree.commit('file created') |
|
567 |
||
568 |
def test_branch_local_remote(self): |
|
569 |
self.run_bzr(['branch', 'branch', self.get_url('remote')]) |
|
570 |
t = self.get_transport() |
|
2485.8.62
by Vincent Ladeuil
From review comments, fix typos and deprecate some functions. |
571 |
# Ensure that no working tree what created remotely
|
2485.8.59
by Vincent Ladeuil
Update from review comments. |
572 |
self.assertFalse(t.has('remote/file')) |
573 |
||
574 |
def test_branch_remote_remote(self): |
|
575 |
# Light cheat: we access the branch remotely
|
|
576 |
self.run_bzr(['branch', self.get_url('branch'), |
|
577 |
self.get_url('remote')]) |
|
578 |
t = self.get_transport() |
|
2485.8.62
by Vincent Ladeuil
From review comments, fix typos and deprecate some functions. |
579 |
# Ensure that no working tree what created remotely
|
2485.8.59
by Vincent Ladeuil
Update from review comments. |
580 |
self.assertFalse(t.has('remote/file')) |
581 |
||
5741.3.3
by Martin Pool
Add a blackbox test for deprecation of commands |
582 |
|
583 |
class TestDeprecatedAliases(TestCaseWithTransport): |
|
584 |
||
585 |
def test_deprecated_aliases(self): |
|
586 |
"""bzr branch can be called clone or get, but those names are deprecated.
|
|
587 |
||
588 |
See bug 506265.
|
|
589 |
"""
|
|
590 |
for command in ['clone', 'get']: |
|
591 |
run_script(self, """ |
|
592 |
$ bzr %(command)s A B |
|
593 |
2>The command 'bzr %(command)s' has been deprecated in bzr 2.4. Please use 'bzr branch' instead. |
|
594 |
2>bzr: ERROR: Not a branch...
|
|
595 |
""" % locals()) |
|
5816.6.7
by A. S. Budden
Moved test harnesses into test_switch and test_branch as these are the commands that are being tested. |
596 |
|
597 |
||
5816.7.1
by Vincent Ladeuil
Remove duplication and simplify. |
598 |
class TestBranchParentLocation(test_switch.TestSwitchParentLocationBase): |
599 |
||
600 |
def _checkout_and_branch(self, option=''): |
|
601 |
self.script_runner.run_script(self, ''' |
|
602 |
$ bzr checkout %(option)s repo/trunk checkout |
|
603 |
$ cd checkout
|
|
604 |
$ bzr branch --switch ../repo/trunk ../repo/branched
|
|
6143.1.4
by Jonathan Riddell
update tests |
605 |
2>Branched 0 revisions.
|
5816.6.8
by A. S. Budden
Refactored to use common generation code for lightweight and heavyweight. |
606 |
2>Tree is up to date at revision 0.
|
5816.7.1
by Vincent Ladeuil
Remove duplication and simplify. |
607 |
2>Switched to branch:...branched...
|
5816.6.11
by A. S. Budden
Refactored assertParentCorrect to check the full path. |
608 |
$ cd ..
|
5816.6.10
by A. S. Budden
Use locals() instead of kwargs for more explicit parameters. |
609 |
''' % locals()) |
5816.7.1
by Vincent Ladeuil
Remove duplication and simplify. |
610 |
bound_branch = branch.Branch.open_containing('checkout')[0] |
611 |
master_branch = branch.Branch.open_containing('repo/branched')[0] |
|
5816.6.12
by A. S. Budden
Check parent branch of both the checkout (light or heavy) and the branch to which it is connected. |
612 |
return (bound_branch, master_branch) |
5816.6.8
by A. S. Budden
Refactored to use common generation code for lightweight and heavyweight. |
613 |
|
5816.6.7
by A. S. Budden
Moved test harnesses into test_switch and test_branch as these are the commands that are being tested. |
614 |
def test_branch_switch_parent_lightweight(self): |
5816.7.1
by Vincent Ladeuil
Remove duplication and simplify. |
615 |
"""Lightweight checkout using bzr branch --switch."""
|
616 |
bb, mb = self._checkout_and_branch(option='--lightweight') |
|
617 |
self.assertParent('repo/trunk', bb) |
|
618 |
self.assertParent('repo/trunk', mb) |
|
5816.6.7
by A. S. Budden
Moved test harnesses into test_switch and test_branch as these are the commands that are being tested. |
619 |
|
620 |
def test_branch_switch_parent_heavyweight(self): |
|
5816.7.1
by Vincent Ladeuil
Remove duplication and simplify. |
621 |
"""Heavyweight checkout using bzr branch --switch."""
|
622 |
bb, mb = self._checkout_and_branch() |
|
623 |
self.assertParent('repo/trunk', bb) |
|
624 |
self.assertParent('repo/trunk', mb) |