bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1 |
# Copyright (C) 2006-2012, 2016 Canonical Ltd
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
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.
|
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
|
1534.4.39
by Robert Collins
Basic BzrDir support. |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
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
|
|
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
16 |
||
17 |
"""Tests for control directory implementations - tests a controldir format."""
|
|
18 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
19 |
import breezy.branch |
20 |
from breezy import ( |
|
|
6734.1.11
by Jelmer Vernooij
Move UnstackableBranchFormat. |
21 |
branch as _mod_branch, |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
22 |
check, |
23 |
controldir, |
|
24 |
errors, |
|
25 |
gpg, |
|
26 |
osutils, |
|
|
7143.21.1
by Jelmer Vernooij
Add WriteGroup contextmanager. |
27 |
repository as _mod_repository, |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
28 |
revision as _mod_revision, |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
29 |
transport, |
30 |
ui, |
|
31 |
urlutils, |
|
32 |
workingtree, |
|
33 |
)
|
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
34 |
from breezy.bzr import ( |
35 |
bzrdir as _mod_bzrdir, |
|
36 |
)
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
37 |
from breezy.tests import ( |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
38 |
fixtures, |
39 |
ChrootedTestCase, |
|
40 |
TestNotApplicable, |
|
41 |
TestSkipped, |
|
42 |
)
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
43 |
from breezy.tests.per_controldir import TestCaseWithControlDir |
44 |
from breezy.transport.local import LocalTransport |
|
45 |
from breezy.ui import ( |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
46 |
CannedInputUIFactory, |
47 |
)
|
|
|
6670.4.14
by Jelmer Vernooij
Move remote to breezy.bzr. |
48 |
from breezy.bzr.remote import ( |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
49 |
RemoteBzrDir, |
50 |
RemoteBzrDirFormat, |
|
51 |
RemoteRepository, |
|
52 |
)
|
|
53 |
||
54 |
||
55 |
class TestControlDir(TestCaseWithControlDir): |
|
56 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
57 |
def skipIfNoWorkingTree(self, a_controldir): |
58 |
"""Raises TestSkipped if a_controldir doesn't have a working tree. |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
59 |
|
60 |
If the bzrdir does have a workingtree, this is a no-op.
|
|
61 |
"""
|
|
62 |
try: |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
63 |
a_controldir.open_workingtree() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
64 |
except (errors.NotLocalUrl, errors.NoWorkingTree): |
65 |
raise TestSkipped("bzrdir on transport %r has no working tree" |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
66 |
% a_controldir.transport) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
67 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
68 |
def openWorkingTreeIfLocal(self, a_controldir): |
69 |
"""If a_controldir is on a local transport, call open_workingtree() on it. |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
70 |
"""
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
71 |
if not isinstance(a_controldir.root_transport, LocalTransport): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
72 |
# it's not local, but that's ok
|
73 |
return
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
74 |
a_controldir.open_workingtree() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
75 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
76 |
def createWorkingTreeOrSkip(self, a_controldir): |
77 |
"""Create a working tree on a_controldir, or raise TestSkipped. |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
78 |
|
79 |
A simple wrapper for create_workingtree that translates NotLocalUrl into
|
|
80 |
TestSkipped. Returns the newly created working tree.
|
|
81 |
"""
|
|
82 |
try: |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
83 |
return a_controldir.create_workingtree() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
84 |
except (errors.NotLocalUrl, errors.UnsupportedOperation): |
85 |
raise TestSkipped("cannot make working tree with transport %r" |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
86 |
% a_controldir.transport) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
87 |
|
88 |
def sproutOrSkip(self, from_bzrdir, to_url, revision_id=None, |
|
89 |
force_new_repo=False, accelerator_tree=None, |
|
90 |
create_tree_if_local=True): |
|
91 |
"""Sprout from_bzrdir into to_url, or raise TestSkipped. |
|
92 |
||
93 |
A simple wrapper for from_bzrdir.sprout that translates NotLocalUrl into
|
|
94 |
TestSkipped. Returns the newly sprouted bzrdir.
|
|
95 |
"""
|
|
96 |
to_transport = transport.get_transport(to_url) |
|
97 |
if not isinstance(to_transport, LocalTransport): |
|
98 |
raise TestSkipped('Cannot sprout to remote bzrdirs.') |
|
99 |
target = from_bzrdir.sprout(to_url, revision_id=revision_id, |
|
100 |
force_new_repo=force_new_repo, |
|
101 |
possible_transports=[to_transport], |
|
102 |
accelerator_tree=accelerator_tree, |
|
103 |
create_tree_if_local=create_tree_if_local) |
|
104 |
return target |
|
105 |
||
|
6162.3.6
by Jelmer Vernooij
Add test for uninitializable formats. |
106 |
def test_uninitializable(self): |
107 |
if self.bzrdir_format.is_initializable(): |
|
108 |
raise TestNotApplicable("format is initializable") |
|
109 |
t = self.get_transport() |
|
110 |
self.assertRaises(errors.UninitializableFormat, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
111 |
self.bzrdir_format.initialize, t.base) |
|
6162.3.6
by Jelmer Vernooij
Add test for uninitializable formats. |
112 |
|
|
6437.10.2
by Jelmer Vernooij
Raise AlreadyControlDirError. |
113 |
def test_multiple_initialization(self): |
114 |
# loopback test to check the current format initializes to itself.
|
|
115 |
if not self.bzrdir_format.is_initializable(): |
|
116 |
# unsupported formats are not loopback testable
|
|
117 |
# because the default open will not open them and
|
|
118 |
# they may not be initializable.
|
|
119 |
raise TestNotApplicable("format is not initializable") |
|
120 |
self.bzrdir_format.initialize('.') |
|
121 |
self.assertRaises(errors.AlreadyControlDirError, |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
122 |
self.bzrdir_format.initialize, '.') |
|
6437.10.2
by Jelmer Vernooij
Raise AlreadyControlDirError. |
123 |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
124 |
def test_create_null_workingtree(self): |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
125 |
dir = self.make_controldir('dir1') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
126 |
dir.create_repository() |
127 |
dir.create_branch() |
|
128 |
try: |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
129 |
wt = dir.create_workingtree( |
130 |
revision_id=_mod_revision.NULL_REVISION) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
131 |
except (errors.NotLocalUrl, errors.UnsupportedOperation): |
132 |
raise TestSkipped("cannot make working tree with transport %r" |
|
133 |
% dir.transport) |
|
134 |
self.assertEqual([], wt.get_parent_ids()) |
|
135 |
||
136 |
def test_destroy_workingtree(self): |
|
137 |
tree = self.make_branch_and_tree('tree') |
|
138 |
self.build_tree(['tree/file']) |
|
139 |
tree.add('file') |
|
140 |
tree.commit('first commit') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
141 |
bzrdir = tree.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
142 |
try: |
143 |
bzrdir.destroy_workingtree() |
|
144 |
except errors.UnsupportedOperation: |
|
145 |
raise TestSkipped('Format does not support destroying tree') |
|
146 |
self.assertPathDoesNotExist('tree/file') |
|
147 |
self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree) |
|
148 |
bzrdir.create_workingtree() |
|
149 |
self.assertPathExists('tree/file') |
|
150 |
bzrdir.destroy_workingtree_metadata() |
|
151 |
self.assertPathExists('tree/file') |
|
152 |
self.assertRaises(errors.NoWorkingTree, bzrdir.open_workingtree) |
|
153 |
||
154 |
def test_destroy_branch(self): |
|
155 |
branch = self.make_branch('branch') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
156 |
bzrdir = branch.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
157 |
try: |
158 |
bzrdir.destroy_branch() |
|
159 |
except (errors.UnsupportedOperation, errors.TransportNotPossible): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
160 |
raise TestNotApplicable( |
161 |
'Format does not support destroying branch') |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
162 |
self.assertRaises(errors.NotBranchError, bzrdir.open_branch) |
163 |
bzrdir.create_branch() |
|
164 |
bzrdir.open_branch() |
|
165 |
||
|
6437.22.1
by Jelmer Vernooij
Except ControlDir.destroy_branch to raise NotBranchError if the branch did not exist. |
166 |
def test_destroy_branch_no_branch(self): |
167 |
branch = self.make_repository('branch') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
168 |
bzrdir = branch.controldir |
|
6437.22.1
by Jelmer Vernooij
Except ControlDir.destroy_branch to raise NotBranchError if the branch did not exist. |
169 |
try: |
170 |
self.assertRaises(errors.NotBranchError, bzrdir.destroy_branch) |
|
171 |
except (errors.UnsupportedOperation, errors.TransportNotPossible): |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
172 |
raise TestNotApplicable( |
173 |
'Format does not support destroying branch') |
|
|
6437.22.1
by Jelmer Vernooij
Except ControlDir.destroy_branch to raise NotBranchError if the branch did not exist. |
174 |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
175 |
def test_destroy_repository(self): |
176 |
repo = self.make_repository('repository') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
177 |
bzrdir = repo.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
178 |
try: |
179 |
bzrdir.destroy_repository() |
|
180 |
except (errors.UnsupportedOperation, errors.TransportNotPossible): |
|
181 |
raise TestNotApplicable('Format does not support destroying' |
|
182 |
' repository') |
|
|
6266.2.2
by Jelmer Vernooij
Fix tests. |
183 |
self.assertRaises(errors.NoRepositoryPresent, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
184 |
bzrdir.destroy_repository) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
185 |
self.assertRaises(errors.NoRepositoryPresent, bzrdir.open_repository) |
186 |
bzrdir.create_repository() |
|
187 |
bzrdir.open_repository() |
|
188 |
||
189 |
def test_open_workingtree_raises_no_working_tree(self): |
|
190 |
"""ControlDir.open_workingtree() should raise NoWorkingTree (rather than |
|
191 |
e.g. NotLocalUrl) if there is no working tree.
|
|
192 |
"""
|
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
193 |
dir = self.make_controldir('source') |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
194 |
vfs_dir = controldir.ControlDir.open(self.get_vfs_only_url('source')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
195 |
if vfs_dir.has_workingtree(): |
196 |
# This ControlDir format doesn't support ControlDirs without
|
|
197 |
# working trees, so this test is irrelevant.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
198 |
raise TestNotApplicable("format does not support " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
199 |
"control directories without working tree") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
200 |
self.assertRaises(errors.NoWorkingTree, dir.open_workingtree) |
201 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
202 |
def test_clone_controldir_repository_under_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
203 |
tree = self.make_branch_and_tree('commit_tree') |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
204 |
self.build_tree( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
205 |
['foo'], transport=tree.controldir.transport.clone('..')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
206 |
tree.add('foo') |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
207 |
rev1 = tree.commit('revision 1') |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
208 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
209 |
repo = dir.create_repository() |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
210 |
if not repo._format.supports_nesting_repositories: |
211 |
raise TestNotApplicable("repository format does not support " |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
212 |
"nesting") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
213 |
repo.fetch(tree.branch.repository) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
214 |
self.assertTrue(repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
215 |
try: |
216 |
self.make_repository('target', shared=True) |
|
217 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
218 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
219 |
"repository format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
220 |
target = dir.clone(self.get_url('target/child')) |
221 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
222 |
self.assertRaises(errors.NoRepositoryPresent, target.open_repository) |
|
223 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
224 |
def test_clone_controldir_repository_branch_both_under_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
225 |
# Create a shared repository
|
226 |
try: |
|
227 |
shared_repo = self.make_repository('shared', shared=True) |
|
228 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
229 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
230 |
"repository format does not support shared repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
231 |
if not shared_repo._format.supports_nesting_repositories: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
232 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
233 |
"format does not support nesting repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
234 |
# Make a branch, 'commit_tree', and working tree outside of the shared
|
235 |
# repository, and commit some revisions to it.
|
|
236 |
tree = self.make_branch_and_tree('commit_tree') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
237 |
self.build_tree(['foo'], transport=tree.controldir.root_transport) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
238 |
tree.add('foo') |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
239 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
240 |
tree.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
241 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
242 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
243 |
tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
244 |
# Copy the content (i.e. revisions) from the 'commit_tree' branch's
|
245 |
# repository into the shared repository.
|
|
246 |
tree.branch.repository.copy_content_into(shared_repo) |
|
247 |
# Make a branch 'source' inside the shared repository.
|
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
248 |
dir = self.make_controldir('shared/source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
249 |
dir.create_branch() |
250 |
# Clone 'source' to 'target', also inside the shared repository.
|
|
251 |
target = dir.clone(self.get_url('shared/target')) |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
252 |
# 'source', 'target', and the shared repo all have distinct controldirs.
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
253 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
254 |
self.assertNotEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
255 |
dir.transport.base, shared_repo.controldir.transport.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
256 |
# The shared repository will contain revisions from the 'commit_tree'
|
257 |
# repository, even revisions that are not part of the history of the
|
|
258 |
# 'commit_tree' branch.
|
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
259 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
260 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
261 |
def test_clone_controldir_repository_branch_only_source_under_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
262 |
try: |
263 |
shared_repo = self.make_repository('shared', shared=True) |
|
264 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
265 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
266 |
"repository format does not support shared repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
267 |
if not shared_repo._format.supports_nesting_repositories: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
268 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
269 |
"format does not support nesting repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
270 |
tree = self.make_branch_and_tree('commit_tree') |
271 |
self.build_tree(['commit_tree/foo']) |
|
272 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
273 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
274 |
tree.branch.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
275 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
276 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
277 |
tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
278 |
tree.branch.repository.copy_content_into(shared_repo) |
279 |
if shared_repo.make_working_trees(): |
|
280 |
shared_repo.set_make_working_trees(False) |
|
281 |
self.assertFalse(shared_repo.make_working_trees()) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
282 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
283 |
dir = self.make_controldir('shared/source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
284 |
dir.create_branch() |
285 |
target = dir.clone(self.get_url('target')) |
|
286 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
287 |
self.assertNotEqual(dir.transport.base, |
288 |
shared_repo.controldir.transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
289 |
branch = target.open_branch() |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
290 |
self.assertTrue(branch.repository.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
291 |
self.assertFalse(branch.repository.make_working_trees()) |
292 |
self.assertTrue(branch.repository.is_shared()) |
|
293 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
294 |
def test_clone_controldir_repository_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
295 |
# test for revision limiting, [smoke test, not corner case checks].
|
296 |
# make a repository with some revisions,
|
|
297 |
# and clone it with a revision limit.
|
|
298 |
#
|
|
299 |
tree = self.make_branch_and_tree('commit_tree') |
|
300 |
self.build_tree(['commit_tree/foo']) |
|
301 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
302 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
303 |
tree.branch.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
304 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
305 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
306 |
rev2 = tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
307 |
source = self.make_repository('source') |
308 |
tree.branch.repository.copy_content_into(source) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
309 |
dir = source.controldir |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
310 |
dir.clone(self.get_url('target'), revision_id=rev2) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
311 |
raise TestSkipped('revision limiting not strict yet') |
312 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
313 |
def test_clone_controldir_branch_and_repo_fixed_user_id(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
314 |
# Bug #430868 is about an email containing '.sig'
|
|
6622.1.28
by Jelmer Vernooij
More renames; commands in output, environment variables. |
315 |
self.overrideEnv('BRZ_EMAIL', 'murphy@host.sighup.org') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
316 |
tree = self.make_branch_and_tree('commit_tree') |
317 |
self.build_tree(['commit_tree/foo']) |
|
318 |
tree.add('foo') |
|
319 |
rev1 = tree.commit('revision 1') |
|
320 |
tree_repo = tree.branch.repository |
|
|
6825.2.1
by Jelmer Vernooij
Fix some tests for foreign branches. |
321 |
if not tree_repo._format.supports_revision_signatures: |
322 |
self.skipTest('repository format does not support signing') |
|
|
7143.21.1
by Jelmer Vernooij
Add WriteGroup contextmanager. |
323 |
with tree_repo.lock_write(), _mod_repository.WriteGroup(tree_repo): |
324 |
tree_repo.sign_revision(rev1, gpg.LoopbackGPGStrategy(None)) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
325 |
target = self.make_branch('target') |
326 |
tree.branch.repository.copy_content_into(target.repository) |
|
327 |
tree.branch.copy_content_into(target) |
|
328 |
self.assertTrue(target.repository.has_revision(rev1)) |
|
329 |
self.assertEqual( |
|
330 |
tree_repo.get_signature_text(rev1), |
|
331 |
target.repository.get_signature_text(rev1)) |
|
332 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
333 |
def test_clone_controldir_branch_and_repo_into_shared_repo(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
334 |
# by default cloning into a shared repo uses the shared repo.
|
335 |
tree = self.make_branch_and_tree('commit_tree') |
|
336 |
self.build_tree(['commit_tree/foo']) |
|
337 |
tree.add('foo') |
|
338 |
tree.commit('revision 1') |
|
339 |
source = self.make_branch('source') |
|
340 |
tree.branch.repository.copy_content_into(source.repository) |
|
341 |
tree.branch.copy_content_into(source) |
|
342 |
try: |
|
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
343 |
shared_repo = self.make_repository('target', shared=True) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
344 |
except errors.IncompatibleFormat: |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
345 |
raise TestNotApplicable("repository format does not support " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
346 |
"shared repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
347 |
if not shared_repo._format.supports_nesting_repositories: |
348 |
raise TestNotApplicable("format does not support nesting " |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
349 |
"repositories") |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
350 |
dir = source.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
351 |
target = dir.clone(self.get_url('target/child')) |
352 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
353 |
self.assertRaises(errors.NoRepositoryPresent, target.open_repository) |
|
|
6165.4.4
by Jelmer Vernooij
Avoid .revision_history(). |
354 |
self.assertEqual(source.last_revision(), |
355 |
target.open_branch().last_revision()) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
356 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
357 |
def test_clone_controldir_branch_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
358 |
# test for revision limiting, [smoke test, not corner case checks].
|
359 |
# make a branch with some revisions,
|
|
360 |
# and clone it with a revision limit.
|
|
361 |
#
|
|
362 |
tree = self.make_branch_and_tree('commit_tree') |
|
363 |
self.build_tree(['commit_tree/foo']) |
|
364 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
365 |
rev1 = tree.commit('revision 1') |
366 |
tree.commit('revision 2', allow_pointless=True) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
367 |
source = self.make_branch('source') |
368 |
tree.branch.repository.copy_content_into(source.repository) |
|
369 |
tree.branch.copy_content_into(source) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
370 |
dir = source.controldir |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
371 |
target = dir.clone(self.get_url('target'), revision_id=rev1) |
372 |
self.assertEqual(rev1, target.open_branch().last_revision()) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
373 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
374 |
def test_clone_controldir_with_colocated(self): |
375 |
if not self.bzrdir_format.colocated_branches: |
|
376 |
raise TestNotApplicable( |
|
377 |
'format does not supported colocated branches') |
|
378 |
tree = self.make_branch_and_tree('commit_tree') |
|
379 |
self.build_tree(['commit_tree/foo']) |
|
380 |
tree.add('foo') |
|
381 |
rev1 = tree.commit('revision 1') |
|
382 |
rev2 = tree.commit('revision 2', allow_pointless=True) |
|
383 |
rev3 = tree.commit('revision 2', allow_pointless=True) |
|
384 |
dir = tree.branch.controldir |
|
385 |
colo = dir.create_branch(name='colo') |
|
386 |
colo.pull(tree.branch, stop_revision=rev1) |
|
387 |
target = dir.clone(self.get_url('target'), revision_id=rev2) |
|
388 |
self.assertEqual(rev2, target.open_branch().last_revision()) |
|
389 |
self.assertEqual(rev1, target.open_branch(name='colo').last_revision()) |
|
390 |
||
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
391 |
def test_clone_on_transport_preserves_repo_format(self): |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
392 |
if self.bzrdir_format == controldir.format_registry.make_controldir('default'): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
393 |
format = 'knit' |
394 |
else: |
|
395 |
format = None |
|
396 |
source_branch = self.make_branch('source', format=format) |
|
397 |
# Ensure no format data is cached
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
398 |
a_dir = breezy.branch.Branch.open_from_transport( |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
399 |
self.get_transport('source')).controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
400 |
target_transport = self.get_transport('target') |
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
401 |
target_controldir = a_dir.clone_on_transport(target_transport) |
402 |
target_repo = target_controldir.open_repository() |
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
403 |
source_branch = breezy.branch.Branch.open( |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
404 |
self.get_vfs_only_url('source')) |
405 |
if isinstance(target_repo, RemoteRepository): |
|
406 |
target_repo._ensure_real() |
|
407 |
target_repo = target_repo._real_repository |
|
408 |
self.assertEqual(target_repo._format, source_branch.repository._format) |
|
409 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
410 |
def test_clone_controldir_tree_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
411 |
# test for revision limiting, [smoke test, not corner case checks].
|
412 |
# make a tree with a revision with a last-revision
|
|
413 |
# and clone it with a revision limit.
|
|
414 |
# This smoke test just checks the revision-id is right. Tree specific
|
|
415 |
# tests will check corner cases.
|
|
416 |
tree = self.make_branch_and_tree('source') |
|
417 |
self.build_tree(['source/foo']) |
|
418 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
419 |
rev1 = tree.commit('revision 1') |
420 |
rev2 = tree.commit('revision 2', allow_pointless=True) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
421 |
dir = tree.controldir |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
422 |
target = dir.clone(self.get_url('target'), revision_id=rev1) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
423 |
self.skipIfNoWorkingTree(target) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
424 |
self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
425 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
426 |
def test_clone_controldir_into_notrees_repo(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
427 |
"""Cloning into a no-trees repo should not create a working tree""" |
428 |
tree = self.make_branch_and_tree('source') |
|
429 |
self.build_tree(['source/foo']) |
|
430 |
tree.add('foo') |
|
431 |
tree.commit('revision 1') |
|
432 |
||
433 |
try: |
|
434 |
repo = self.make_repository('repo', shared=True) |
|
435 |
except errors.IncompatibleFormat: |
|
436 |
raise TestNotApplicable('must support shared repositories') |
|
437 |
if repo.make_working_trees(): |
|
438 |
repo.set_make_working_trees(False) |
|
439 |
self.assertFalse(repo.make_working_trees()) |
|
440 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
441 |
a_dir = tree.controldir.clone(self.get_url('repo/a')) |
|
6182.1.13
by Jelmer Vernooij
Cope with repository existing in different location. |
442 |
a_branch = a_dir.open_branch() |
443 |
# If the new control dir actually uses the repository, it should
|
|
444 |
# not have a working tree.
|
|
445 |
if not a_branch.repository.has_same_location(repo): |
|
446 |
raise TestNotApplicable('new control dir does not use repository') |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
447 |
self.assertRaises(errors.NoWorkingTree, a_dir.open_workingtree) |
448 |
||
449 |
def test_clone_respects_stacked(self): |
|
450 |
branch = self.make_branch('parent') |
|
451 |
child_transport = self.get_transport('child') |
|
|
6162.3.1
by Jelmer Vernooij
Skip a few tests for uninitializable formats. |
452 |
try: |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
453 |
child = branch.controldir.clone_on_transport(child_transport, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
454 |
stacked_on=branch.base) |
|
6734.1.11
by Jelmer Vernooij
Move UnstackableBranchFormat. |
455 |
except (_mod_branch.UnstackableBranchFormat, |
|
6162.3.1
by Jelmer Vernooij
Skip a few tests for uninitializable formats. |
456 |
errors.UnstackableRepositoryFormat): |
|
6162.5.5
by Jelmer Vernooij
Review feedback from John. |
457 |
raise TestNotApplicable("branch or repository format does " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
458 |
"not support stacking") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
459 |
self.assertEqual(child.open_branch().get_stacked_on_url(), branch.base) |
460 |
||
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
461 |
def test_set_branch_reference(self): |
462 |
"""set_branch_reference creates a branch reference""" |
|
463 |
referenced_branch = self.make_branch('referenced') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
464 |
dir = self.make_controldir('source') |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
465 |
try: |
466 |
reference = dir.set_branch_reference(referenced_branch) |
|
467 |
except errors.IncompatibleFormat: |
|
468 |
# this is ok too, not all formats have to support references.
|
|
469 |
raise TestNotApplicable("control directory does not " |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
470 |
"support branch references") |
471 |
self.assertEqual(referenced_branch.user_url, |
|
472 |
dir.get_branch_reference()) |
|
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
473 |
|
474 |
def test_set_branch_reference_on_existing_reference(self): |
|
475 |
"""set_branch_reference creates a branch reference""" |
|
476 |
referenced_branch1 = self.make_branch('old-referenced') |
|
477 |
referenced_branch2 = self.make_branch('new-referenced') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
478 |
dir = self.make_controldir('source') |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
479 |
try: |
480 |
reference = dir.set_branch_reference(referenced_branch1) |
|
481 |
except errors.IncompatibleFormat: |
|
482 |
# this is ok too, not all formats have to support references.
|
|
483 |
raise TestNotApplicable("control directory does not " |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
484 |
"support branch references") |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
485 |
reference = dir.set_branch_reference(referenced_branch2) |
486 |
self.assertEqual( |
|
|
6874.1.2
by Jelmer Vernooij
Consistently use Branch.user_url. |
487 |
referenced_branch2.user_url, |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
488 |
dir.get_branch_reference()) |
489 |
||
490 |
def test_set_branch_reference_on_existing_branch(self): |
|
491 |
"""set_branch_reference creates a branch reference""" |
|
492 |
referenced_branch = self.make_branch('referenced') |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
493 |
dir = self.make_branch('source').controldir |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
494 |
try: |
495 |
reference = dir.set_branch_reference(referenced_branch) |
|
496 |
except errors.IncompatibleFormat: |
|
497 |
# this is ok too, not all formats have to support references.
|
|
498 |
raise TestNotApplicable("control directory does not " |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
499 |
"support branch references") |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
500 |
self.assertEqual( |
|
6874.1.2
by Jelmer Vernooij
Consistently use Branch.user_url. |
501 |
referenced_branch.user_url, |
|
6437.7.1
by Jelmer Vernooij
Add ControlDir.set_branch_reference. |
502 |
dir.get_branch_reference()) |
503 |
||
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
504 |
def test_get_branch_reference_on_reference(self): |
505 |
"""get_branch_reference should return the right url.""" |
|
506 |
referenced_branch = self.make_branch('referenced') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
507 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
508 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
509 |
dir.set_branch_reference(referenced_branch) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
510 |
except errors.IncompatibleFormat: |
511 |
# this is ok too, not all formats have to support references.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
512 |
raise TestNotApplicable("control directory does not " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
513 |
"support branch references") |
|
6874.1.2
by Jelmer Vernooij
Consistently use Branch.user_url. |
514 |
self.assertEqual(referenced_branch.user_url, |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
515 |
dir.get_branch_reference()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
516 |
|
517 |
def test_get_branch_reference_on_non_reference(self): |
|
518 |
"""get_branch_reference should return None for non-reference branches.""" |
|
|
6883.19.1
by Jelmer Vernooij
Allow default branch to be a branch reference. |
519 |
dir = self.make_controldir('referenced') |
520 |
dir.create_repository() |
|
521 |
if dir._format.colocated_branches: |
|
522 |
# The default branch in a controldir might be a reference branch
|
|
523 |
# (e.g. for Git), so let's create another one.
|
|
524 |
name = 'foo' |
|
525 |
else: |
|
526 |
name = None |
|
527 |
branch = dir.create_branch(name) |
|
528 |
self.assertEqual(None, branch.controldir.get_branch_reference(name)) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
529 |
|
530 |
def test_get_branch_reference_no_branch(self): |
|
531 |
"""get_branch_reference should not mask NotBranchErrors.""" |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
532 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
533 |
if dir.has_branch(): |
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
534 |
# this format does not support branchless controldirs.
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
535 |
raise TestNotApplicable("format does not support " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
536 |
"branchless control directories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
537 |
self.assertRaises(errors.NotBranchError, dir.get_branch_reference) |
538 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
539 |
def test_sprout_controldir_empty(self): |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
540 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
541 |
target = dir.sprout(self.get_url('target')) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
542 |
self.assertNotEqual(dir.control_transport.base, |
543 |
target.control_transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
544 |
# creates a new repository branch and tree
|
545 |
target.open_repository() |
|
546 |
target.open_branch() |
|
547 |
self.openWorkingTreeIfLocal(target) |
|
548 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
549 |
def test_sprout_controldir_empty_under_shared_repo(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
550 |
# sprouting an empty dir into a repo uses the repo
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
551 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
552 |
try: |
553 |
self.make_repository('target', shared=True) |
|
554 |
except errors.IncompatibleFormat: |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
555 |
raise TestNotApplicable("format does not support shared " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
556 |
"repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
557 |
target = dir.sprout(self.get_url('target/child')) |
558 |
self.assertRaises(errors.NoRepositoryPresent, target.open_repository) |
|
559 |
target.open_branch() |
|
560 |
try: |
|
561 |
target.open_workingtree() |
|
562 |
except errors.NoWorkingTree: |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
563 |
# Some controldirs can never have working trees.
|
|
6162.5.2
by Jelmer Vernooij
Skip test that requires nesting repositories, check supports workingtrees. |
564 |
repo = target.find_repository() |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
565 |
self.assertFalse(repo.controldir._format.supports_workingtrees) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
566 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
567 |
def test_sprout_controldir_empty_under_shared_repo_force_new(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
568 |
# the force_new_repo parameter should force use of a new repo in an empty
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
569 |
# controldir's sprout logic
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
570 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
571 |
try: |
572 |
self.make_repository('target', shared=True) |
|
573 |
except errors.IncompatibleFormat: |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
574 |
raise TestNotApplicable("format does not support shared " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
575 |
"repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
576 |
target = dir.sprout(self.get_url('target/child'), force_new_repo=True) |
577 |
target.open_repository() |
|
578 |
target.open_branch() |
|
579 |
self.openWorkingTreeIfLocal(target) |
|
580 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
581 |
def test_sprout_controldir_with_repository_to_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
582 |
tree = self.make_branch_and_tree('commit_tree') |
583 |
self.build_tree(['commit_tree/foo']) |
|
584 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
585 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
586 |
tree.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
587 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
588 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
589 |
rev2 = tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
590 |
source = self.make_repository('source') |
591 |
tree.branch.repository.copy_content_into(source) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
592 |
dir = source.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
593 |
try: |
594 |
shared_repo = self.make_repository('target', shared=True) |
|
595 |
except errors.IncompatibleFormat: |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
596 |
raise TestNotApplicable("format does not support " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
597 |
"shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
598 |
target = dir.sprout(self.get_url('target/child')) |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
599 |
self.assertNotEqual(dir.user_transport.base, |
600 |
target.user_transport.base) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
601 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
602 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
603 |
def test_sprout_controldir_repository_branch_both_under_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
604 |
try: |
605 |
shared_repo = self.make_repository('shared', shared=True) |
|
606 |
except errors.IncompatibleFormat: |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
607 |
raise TestNotApplicable("format does not support shared " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
608 |
"repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
609 |
if not shared_repo._format.supports_nesting_repositories: |
610 |
raise TestNotApplicable("format does not support nesting " |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
611 |
"repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
612 |
tree = self.make_branch_and_tree('commit_tree') |
613 |
self.build_tree(['commit_tree/foo']) |
|
614 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
615 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
616 |
tree.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
617 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
618 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
619 |
rev2 = tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
620 |
tree.branch.repository.copy_content_into(shared_repo) |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
621 |
dir = self.make_controldir('shared/source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
622 |
dir.create_branch() |
623 |
target = dir.sprout(self.get_url('shared/target')) |
|
624 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
625 |
self.assertNotEqual(dir.transport.base, |
626 |
shared_repo.controldir.transport.base) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
627 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
628 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
629 |
def test_sprout_controldir_repository_branch_only_source_under_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
630 |
try: |
631 |
shared_repo = self.make_repository('shared', shared=True) |
|
632 |
except errors.IncompatibleFormat: |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
633 |
raise TestNotApplicable("format does not support shared " |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
634 |
"repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
635 |
if not shared_repo._format.supports_nesting_repositories: |
636 |
raise TestNotApplicable("format does not support nesting " |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
637 |
"repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
638 |
tree = self.make_branch_and_tree('commit_tree') |
639 |
self.build_tree(['commit_tree/foo']) |
|
640 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
641 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
642 |
tree.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
643 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
644 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
645 |
tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
646 |
tree.branch.repository.copy_content_into(shared_repo) |
647 |
if shared_repo.make_working_trees(): |
|
648 |
shared_repo.set_make_working_trees(False) |
|
649 |
self.assertFalse(shared_repo.make_working_trees()) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
650 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
651 |
dir = self.make_controldir('shared/source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
652 |
dir.create_branch() |
653 |
target = dir.sprout(self.get_url('target')) |
|
654 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
655 |
self.assertNotEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
656 |
dir.transport.base, |
657 |
shared_repo.controldir.transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
658 |
branch = target.open_branch() |
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
659 |
# The sprouted controldir has a branch, so only revisions referenced by
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
660 |
# that branch are copied, rather than the whole repository. It's an
|
661 |
# empty branch, so none are copied.
|
|
662 |
self.assertEqual([], branch.repository.all_revision_ids()) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
663 |
if branch.controldir._format.supports_workingtrees: |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
664 |
self.assertTrue(branch.repository.make_working_trees()) |
665 |
self.assertFalse(branch.repository.is_shared()) |
|
666 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
667 |
def test_sprout_controldir_repository_under_shared_force_new_repo(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
668 |
tree = self.make_branch_and_tree('commit_tree') |
669 |
self.build_tree(['commit_tree/foo']) |
|
670 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
671 |
rev1 = tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
672 |
tree.controldir.open_branch().generate_revision_history( |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
673 |
_mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
674 |
tree.set_parent_trees([]) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
675 |
tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
676 |
source = self.make_repository('source') |
677 |
tree.branch.repository.copy_content_into(source) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
678 |
dir = source.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
679 |
try: |
680 |
shared_repo = self.make_repository('target', shared=True) |
|
681 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
682 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
683 |
"format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
684 |
target = dir.sprout(self.get_url('target/child'), force_new_repo=True) |
|
6150.2.1
by Jelmer Vernooij
Use user_transport rather than deprecated .transport. |
685 |
self.assertNotEqual( |
686 |
dir.control_transport.base, |
|
687 |
target.control_transport.base) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
688 |
self.assertFalse(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
689 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
690 |
def test_sprout_controldir_repository_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
691 |
# test for revision limiting, [smoke test, not corner case checks].
|
692 |
# make a repository with some revisions,
|
|
693 |
# and sprout it with a revision limit.
|
|
694 |
#
|
|
695 |
tree = self.make_branch_and_tree('commit_tree') |
|
696 |
self.build_tree(['commit_tree/foo']) |
|
697 |
tree.add('foo') |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
698 |
tree.commit('revision 1') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
699 |
br = tree.controldir.open_branch() |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
700 |
br.set_last_revision_info(0, _mod_revision.NULL_REVISION) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
701 |
tree.set_parent_trees([]) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
702 |
rev2 = tree.commit('revision 2') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
703 |
source = self.make_repository('source') |
704 |
tree.branch.repository.copy_content_into(source) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
705 |
dir = source.controldir |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
706 |
self.sproutOrSkip(dir, self.get_url('target'), revision_id=rev2) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
707 |
raise TestSkipped('revision limiting not strict yet') |
708 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
709 |
def test_sprout_controldir_branch_and_repo_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
710 |
# sprouting a branch with a repo into a shared repo uses the shared
|
711 |
# repo
|
|
712 |
tree = self.make_branch_and_tree('commit_tree') |
|
713 |
self.build_tree(['commit_tree/foo']) |
|
714 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
715 |
rev1 = tree.commit('revision 1') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
716 |
source = self.make_branch('source') |
717 |
tree.branch.repository.copy_content_into(source.repository) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
718 |
tree.controldir.open_branch().copy_content_into(source) |
719 |
dir = source.controldir |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
720 |
try: |
721 |
shared_repo = self.make_repository('target', shared=True) |
|
722 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
723 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
724 |
"format does not support shared repositories") |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
725 |
dir.sprout(self.get_url('target/child')) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
726 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
727 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
728 |
def test_sprout_controldir_branch_and_repo_shared_force_new_repo(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
729 |
# sprouting a branch with a repo into a shared repo uses the shared
|
730 |
# repo
|
|
731 |
tree = self.make_branch_and_tree('commit_tree') |
|
732 |
self.build_tree(['commit_tree/foo']) |
|
733 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
734 |
rev1 = tree.commit('revision 1') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
735 |
source = self.make_branch('source') |
736 |
tree.branch.repository.copy_content_into(source.repository) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
737 |
tree.controldir.open_branch().copy_content_into(source) |
738 |
dir = source.controldir |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
739 |
try: |
740 |
shared_repo = self.make_repository('target', shared=True) |
|
741 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
742 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
743 |
"format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
744 |
target = dir.sprout(self.get_url('target/child'), force_new_repo=True) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
745 |
self.assertNotEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
746 |
dir.control_transport.base, target.control_transport.base) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
747 |
self.assertFalse(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
748 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
749 |
def test_sprout_controldir_branch_reference(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
750 |
# sprouting should create a repository if needed and a sprouted branch.
|
751 |
referenced_branch = self.make_branch('referenced') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
752 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
753 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
754 |
dir.set_branch_reference(referenced_branch) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
755 |
except errors.IncompatibleFormat: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
756 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
757 |
"format does not support branch references") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
758 |
self.assertRaises(errors.NoRepositoryPresent, dir.open_repository) |
759 |
target = dir.sprout(self.get_url('target')) |
|
760 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
761 |
# we want target to have a branch that is in-place.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
762 |
self.assertEqual(target, target.open_branch().controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
763 |
# and as we dont support repositories being detached yet, a repo in
|
764 |
# place
|
|
765 |
target.open_repository() |
|
766 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
767 |
def test_sprout_controldir_branch_reference_shared(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
768 |
# sprouting should create a repository if needed and a sprouted branch.
|
769 |
referenced_tree = self.make_branch_and_tree('referenced') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
770 |
rev1 = referenced_tree.commit('1', allow_pointless=True) |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
771 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
772 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
773 |
dir.set_branch_reference(referenced_tree.branch) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
774 |
except errors.IncompatibleFormat: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
775 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
776 |
"format does not support branch references") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
777 |
self.assertRaises(errors.NoRepositoryPresent, dir.open_repository) |
778 |
try: |
|
779 |
shared_repo = self.make_repository('target', shared=True) |
|
780 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
781 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
782 |
"format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
783 |
target = dir.sprout(self.get_url('target/child')) |
784 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
785 |
# we want target to have a branch that is in-place.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
786 |
self.assertEqual(target, target.open_branch().controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
787 |
# and we want no repository as the target is shared
|
788 |
self.assertRaises(errors.NoRepositoryPresent, |
|
789 |
target.open_repository) |
|
790 |
# and we want revision '1' in the shared repo
|
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
791 |
self.assertTrue(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
792 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
793 |
def test_sprout_controldir_branch_reference_shared_force_new_repo(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
794 |
# sprouting should create a repository if needed and a sprouted branch.
|
795 |
referenced_tree = self.make_branch_and_tree('referenced') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
796 |
rev1 = referenced_tree.commit('1', allow_pointless=True) |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
797 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
798 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
799 |
dir.set_branch_reference(referenced_tree.branch) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
800 |
except errors.IncompatibleFormat: |
801 |
# this is ok too, not all formats have to support references.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
802 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
803 |
"format does not support branch references") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
804 |
self.assertRaises(errors.NoRepositoryPresent, dir.open_repository) |
805 |
try: |
|
806 |
shared_repo = self.make_repository('target', shared=True) |
|
807 |
except errors.IncompatibleFormat: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
808 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
809 |
"format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
810 |
target = dir.sprout(self.get_url('target/child'), force_new_repo=True) |
811 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
812 |
# we want target to have a branch that is in-place.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
813 |
self.assertEqual(target, target.open_branch().controldir) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
814 |
# and we want revision rev1 in the new repo
|
815 |
self.assertTrue(target.open_repository().has_revision(rev1)) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
816 |
# but not the shared one
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
817 |
self.assertFalse(shared_repo.has_revision(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
818 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
819 |
def test_sprout_controldir_branch_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
820 |
# test for revision limiting, [smoke test, not corner case checks].
|
821 |
# make a repository with some revisions,
|
|
822 |
# and sprout it with a revision limit.
|
|
823 |
#
|
|
824 |
tree = self.make_branch_and_tree('commit_tree') |
|
825 |
self.build_tree(['commit_tree/foo']) |
|
826 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
827 |
rev1 = tree.commit('revision 1') |
828 |
tree.commit('revision 2', allow_pointless=True) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
829 |
source = self.make_branch('source') |
830 |
tree.branch.repository.copy_content_into(source.repository) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
831 |
tree.controldir.open_branch().copy_content_into(source) |
832 |
dir = source.controldir |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
833 |
target = dir.sprout(self.get_url('target'), revision_id=rev1) |
834 |
self.assertEqual(rev1, target.open_branch().last_revision()) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
835 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
836 |
def test_sprout_controldir_branch_with_tags(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
837 |
# when sprouting a branch all revisions named in the tags are copied
|
838 |
# too.
|
|
839 |
builder = self.make_branch_builder('source') |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
840 |
source, rev1, rev2 = fixtures.build_branch_with_non_ancestral_rev( |
841 |
builder) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
842 |
try: |
|
6747.4.1
by Jelmer Vernooij
Fix remaining tests. |
843 |
source.tags.set_tag('tag-a', rev2) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
844 |
except errors.TagsNotSupported: |
845 |
raise TestNotApplicable('Branch format does not support tags.') |
|
|
6404.6.7
by Vincent Ladeuil
Change set/remove to require a lock for the branch config files. |
846 |
source.get_config_stack().set('branch.fetch_tags', True) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
847 |
# Now source has a tag not in its ancestry. Sprout its controldir.
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
848 |
dir = source.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
849 |
target = dir.sprout(self.get_url('target')) |
850 |
# The tag is present, and so is its revision.
|
|
851 |
new_branch = target.open_branch() |
|
|
6747.4.1
by Jelmer Vernooij
Fix remaining tests. |
852 |
self.assertEqual(rev2, new_branch.tags.lookup_tag('tag-a')) |
853 |
new_branch.repository.get_revision(rev2) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
854 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
855 |
def test_sprout_controldir_branch_with_absent_tag(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
856 |
# tags referencing absent revisions are copied (and those absent
|
857 |
# revisions do not prevent the sprout.)
|
|
858 |
builder = self.make_branch_builder('source') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
859 |
builder.build_commit(message="Rev 1") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
860 |
source = builder.get_branch() |
861 |
try: |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
862 |
source.tags.set_tag('tag-a', b'missing-rev') |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
863 |
except (errors.TagsNotSupported, errors.GhostTagsNotSupported): |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
864 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
865 |
"Branch format does not support tags or tags "
|
866 |
"referencing ghost revisions.") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
867 |
# Now source has a tag pointing to an absent revision. Sprout its
|
868 |
# controldir.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
869 |
dir = source.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
870 |
target = dir.sprout(self.get_url('target')) |
871 |
# The tag is present in the target
|
|
872 |
new_branch = target.open_branch() |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
873 |
self.assertEqual(b'missing-rev', new_branch.tags.lookup_tag('tag-a')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
874 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
875 |
def test_sprout_controldir_passing_source_branch_with_absent_tag(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
876 |
# tags referencing absent revisions are copied (and those absent
|
877 |
# revisions do not prevent the sprout.)
|
|
878 |
builder = self.make_branch_builder('source') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
879 |
builder.build_commit(message="Rev 1") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
880 |
source = builder.get_branch() |
881 |
try: |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
882 |
source.tags.set_tag('tag-a', b'missing-rev') |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
883 |
except (errors.TagsNotSupported, errors.GhostTagsNotSupported): |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
884 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
885 |
"Branch format does not support tags or tags "
|
886 |
"referencing missing revisions.") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
887 |
# Now source has a tag pointing to an absent revision. Sprout its
|
888 |
# controldir.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
889 |
dir = source.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
890 |
target = dir.sprout(self.get_url('target'), source_branch=source) |
891 |
# The tag is present in the target
|
|
892 |
new_branch = target.open_branch() |
|
|
6973.13.2
by Jelmer Vernooij
Fix some more tests. |
893 |
self.assertEqual(b'missing-rev', new_branch.tags.lookup_tag('tag-a')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
894 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
895 |
def test_sprout_controldir_passing_rev_not_source_branch_copies_tags(self): |
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
896 |
# dir.sprout(..., revision_id=b'rev1') copies rev1, and all the tags of
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
897 |
# the branch at that controldir, the ancestry of all of those, but no other
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
898 |
# revs (not even the tip of the source branch).
|
899 |
builder = self.make_branch_builder('source') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
900 |
base_rev = builder.build_commit(message="Base") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
901 |
# Make three parallel lines of ancestry off this base.
|
902 |
source = builder.get_branch() |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
903 |
rev_a1 = builder.build_commit(message="Rev A1") |
904 |
rev_a2 = builder.build_commit(message="Rev A2") |
|
905 |
rev_a3 = builder.build_commit(message="Rev A3") |
|
|
6747.2.2
by Jelmer Vernooij
Fix tests. |
906 |
source.set_last_revision_info(1, base_rev) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
907 |
rev_b1 = builder.build_commit(message="Rev B1") |
908 |
rev_b2 = builder.build_commit(message="Rev B2") |
|
909 |
rev_b3 = builder.build_commit(message="Rev B3") |
|
|
6747.2.2
by Jelmer Vernooij
Fix tests. |
910 |
source.set_last_revision_info(1, base_rev) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
911 |
rev_c1 = builder.build_commit(message="Rev C1") |
912 |
rev_c2 = builder.build_commit(message="Rev C2") |
|
913 |
rev_c3 = builder.build_commit(message="Rev C3") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
914 |
# Set the branch tip to A2
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
915 |
source.set_last_revision_info(3, rev_a2) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
916 |
try: |
917 |
# Create a tag for B2, and for an absent rev
|
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
918 |
source.tags.set_tag('tag-non-ancestry', rev_b2) |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
919 |
except errors.TagsNotSupported: |
920 |
raise TestNotApplicable('Branch format does not support tags ') |
|
921 |
try: |
|
|
7045.2.17
by Jelmer Vernooij
Some more. |
922 |
source.tags.set_tag('tag-absent', b'absent-rev') |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
923 |
except errors.GhostTagsNotSupported: |
924 |
has_ghost_tag = False |
|
925 |
else: |
|
926 |
has_ghost_tag = True |
|
|
6404.6.7
by Vincent Ladeuil
Change set/remove to require a lock for the branch config files. |
927 |
source.get_config_stack().set('branch.fetch_tags', True) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
928 |
# And ask sprout for C2
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
929 |
dir = source.controldir |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
930 |
target = dir.sprout(self.get_url('target'), revision_id=rev_c2) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
931 |
# The tags are present
|
932 |
new_branch = target.open_branch() |
|
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
933 |
if has_ghost_tag: |
934 |
self.assertEqual( |
|
|
7045.2.17
by Jelmer Vernooij
Some more. |
935 |
{'tag-absent': b'absent-rev', 'tag-non-ancestry': rev_b2}, |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
936 |
new_branch.tags.get_tag_dict()) |
937 |
else: |
|
938 |
self.assertEqual( |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
939 |
{'tag-non-ancestry': rev_b2}, |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
940 |
new_branch.tags.get_tag_dict()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
941 |
# And the revs for A2, B2 and C2's ancestries are present, but no
|
942 |
# others.
|
|
943 |
self.assertEqual( |
|
|
6747.2.2
by Jelmer Vernooij
Fix tests. |
944 |
sorted([base_rev, rev_b1, rev_b2, rev_c1, rev_c2]), |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
945 |
sorted(new_branch.repository.all_revision_ids())) |
946 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
947 |
def test_sprout_controldir_tree_branch_reference(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
948 |
# sprouting should create a repository if needed and a sprouted branch.
|
949 |
# the tree state should not be copied.
|
|
950 |
referenced_branch = self.make_branch('referencced') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
951 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
952 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
953 |
dir.set_branch_reference(referenced_branch) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
954 |
except errors.IncompatibleFormat: |
955 |
# this is ok too, not all formats have to support references.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
956 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
957 |
"format does not support branch references") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
958 |
self.assertRaises(errors.NoRepositoryPresent, dir.open_repository) |
959 |
tree = self.createWorkingTreeOrSkip(dir) |
|
960 |
self.build_tree(['source/subdir/']) |
|
961 |
tree.add('subdir') |
|
962 |
target = dir.sprout(self.get_url('target')) |
|
963 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
964 |
# we want target to have a branch that is in-place.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
965 |
self.assertEqual(target, target.open_branch().controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
966 |
# and as we dont support repositories being detached yet, a repo in
|
967 |
# place
|
|
968 |
target.open_repository() |
|
969 |
result_tree = target.open_workingtree() |
|
970 |
self.assertFalse(result_tree.has_filename('subdir')) |
|
971 |
||
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
972 |
def test_sprout_controldir_tree_branch_reference_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
973 |
# sprouting should create a repository if needed and a sprouted branch.
|
974 |
# the tree state should not be copied but the revision changed,
|
|
975 |
# and the likewise the new branch should be truncated too
|
|
976 |
referenced_branch = self.make_branch('referencced') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
977 |
dir = self.make_controldir('source') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
978 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
979 |
dir.set_branch_reference(referenced_branch) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
980 |
except errors.IncompatibleFormat: |
981 |
# this is ok too, not all formats have to support references.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
982 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
983 |
"format does not support branch references") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
984 |
self.assertRaises(errors.NoRepositoryPresent, dir.open_repository) |
985 |
tree = self.createWorkingTreeOrSkip(dir) |
|
986 |
self.build_tree(['source/foo']) |
|
987 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
988 |
rev1 = tree.commit('revision 1') |
989 |
tree.commit('revision 2', allow_pointless=True) |
|
990 |
target = dir.sprout(self.get_url('target'), revision_id=rev1) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
991 |
self.skipIfNoWorkingTree(target) |
992 |
self.assertNotEqual(dir.transport.base, target.transport.base) |
|
993 |
# we want target to have a branch that is in-place.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
994 |
self.assertEqual(target, target.open_branch().controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
995 |
# and as we dont support repositories being detached yet, a repo in
|
996 |
# place
|
|
997 |
target.open_repository() |
|
998 |
# we trust that the working tree sprouting works via the other tests.
|
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
999 |
self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) |
1000 |
self.assertEqual(rev1, target.open_branch().last_revision()) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1001 |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
1002 |
def test_sprout_controldir_tree_revision(self): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1003 |
# test for revision limiting, [smoke test, not corner case checks].
|
1004 |
# make a tree with a revision with a last-revision
|
|
1005 |
# and sprout it with a revision limit.
|
|
1006 |
# This smoke test just checks the revision-id is right. Tree specific
|
|
1007 |
# tests will check corner cases.
|
|
1008 |
tree = self.make_branch_and_tree('source') |
|
1009 |
self.build_tree(['source/foo']) |
|
1010 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1011 |
rev1 = tree.commit('revision 1') |
1012 |
tree.commit('revision 2', allow_pointless=True) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1013 |
dir = tree.controldir |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1014 |
target = self.sproutOrSkip( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1015 |
dir, self.get_url('target'), revision_id=rev1) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1016 |
self.assertEqual([rev1], target.open_workingtree().get_parent_ids()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1017 |
|
1018 |
def test_sprout_takes_accelerator(self): |
|
1019 |
tree = self.make_branch_and_tree('source') |
|
1020 |
self.build_tree(['source/foo']) |
|
1021 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1022 |
tree.commit('revision 1') |
1023 |
rev2 = tree.commit('revision 2', allow_pointless=True) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1024 |
dir = tree.controldir |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1025 |
target = self.sproutOrSkip( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1026 |
dir, self.get_url('target'), accelerator_tree=tree) |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1027 |
self.assertEqual([rev2], target.open_workingtree().get_parent_ids()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1028 |
|
1029 |
def test_sprout_branch_no_tree(self): |
|
1030 |
tree = self.make_branch_and_tree('source') |
|
1031 |
self.build_tree(['source/foo']) |
|
1032 |
tree.add('foo') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1033 |
tree.commit('revision 1') |
1034 |
tree.commit('revision 2', allow_pointless=True) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1035 |
dir = tree.controldir |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1036 |
try: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1037 |
target = dir.sprout( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1038 |
self.get_url('target'), create_tree_if_local=False) |
|
6734.1.13
by Jelmer Vernooij
Move MustHaveWorkingTree. |
1039 |
except controldir.MustHaveWorkingTree: |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1040 |
raise TestNotApplicable("control dir format requires working tree") |
1041 |
self.assertPathDoesNotExist('target/foo') |
|
1042 |
self.assertEqual(tree.branch.last_revision(), |
|
1043 |
target.open_branch().last_revision()) |
|
1044 |
||
1045 |
def test_sprout_with_revision_id_uses_default_stack_on(self): |
|
1046 |
# Make a branch with three commits to stack on.
|
|
1047 |
builder = self.make_branch_builder('stack-on') |
|
1048 |
builder.start_series() |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1049 |
rev1 = builder.build_commit(message='Rev 1.') |
1050 |
rev2 = builder.build_commit(message='Rev 2.') |
|
1051 |
rev3 = builder.build_commit(message='Rev 3.') |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1052 |
builder.finish_series() |
1053 |
stack_on = builder.get_branch() |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
1054 |
# Make a controldir with a default stacking policy to stack on that branch.
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1055 |
config = self.make_controldir('policy-dir').get_config() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1056 |
try: |
1057 |
config.set_default_stack_on(self.get_url('stack-on')) |
|
1058 |
except errors.BzrError: |
|
1059 |
raise TestNotApplicable('Only relevant for stackable formats.') |
|
|
7490.13.1
by Jelmer Vernooij
Add clone subcommand. |
1060 |
# Sprout the stacked-on branch into the controldir.
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1061 |
sprouted = stack_on.controldir.sprout( |
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1062 |
self.get_url('policy-dir/sprouted'), revision_id=rev3) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1063 |
# Not all revisions are copied into the sprouted repository.
|
1064 |
repo = sprouted.open_repository() |
|
1065 |
self.addCleanup(repo.lock_read().unlock) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1066 |
self.assertEqual(None, repo.get_parent_map([rev1]).get(rev1)) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1067 |
|
1068 |
def test_format_initialize_find_open(self): |
|
1069 |
# loopback test to check the current format initializes to itself.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1070 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1071 |
# unsupported formats are not loopback testable
|
1072 |
# because the default open will not open them and
|
|
1073 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1074 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1075 |
# for remote formats, there must be no prior assumption about the
|
1076 |
# network name to use - it's possible that this may somehow have got
|
|
1077 |
# in through an unisolated test though - see
|
|
1078 |
# <https://bugs.launchpad.net/bzr/+bug/504102>
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1079 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1080 |
getattr(self.bzrdir_format, '_network_name', None), |
1081 |
None) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1082 |
# supported formats must be able to init and open
|
1083 |
t = self.get_transport() |
|
1084 |
readonly_t = self.get_readonly_transport() |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1085 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1086 |
self.assertIsInstance(made_control, controldir.ControlDir) |
1087 |
if isinstance(self.bzrdir_format, RemoteBzrDirFormat): |
|
1088 |
return
|
|
1089 |
self.assertEqual(self.bzrdir_format, |
|
1090 |
controldir.ControlDirFormat.find_format(readonly_t)) |
|
1091 |
direct_opened_dir = self.bzrdir_format.open(readonly_t) |
|
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
1092 |
opened_dir = controldir.ControlDir.open(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1093 |
self.assertEqual(made_control._format, |
1094 |
opened_dir._format) |
|
1095 |
self.assertEqual(direct_opened_dir._format, |
|
1096 |
opened_dir._format) |
|
1097 |
self.assertIsInstance(opened_dir, controldir.ControlDir) |
|
1098 |
||
1099 |
def test_format_initialize_on_transport_ex(self): |
|
1100 |
t = self.get_transport('dir') |
|
1101 |
self.assertInitializeEx(t) |
|
1102 |
||
1103 |
def test_format_initialize_on_transport_ex_use_existing_dir_True(self): |
|
1104 |
t = self.get_transport('dir') |
|
1105 |
t.ensure_base() |
|
1106 |
self.assertInitializeEx(t, use_existing_dir=True) |
|
1107 |
||
1108 |
def test_format_initialize_on_transport_ex_use_existing_dir_False(self): |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1109 |
if not self.bzrdir_format.is_initializable(): |
1110 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1111 |
t = self.get_transport('dir') |
1112 |
t.ensure_base() |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1113 |
self.assertRaises( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1114 |
errors.FileExists, |
1115 |
self.bzrdir_format.initialize_on_transport_ex, t, |
|
1116 |
use_existing_dir=False) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1117 |
|
1118 |
def test_format_initialize_on_transport_ex_create_prefix_True(self): |
|
1119 |
t = self.get_transport('missing/dir') |
|
1120 |
self.assertInitializeEx(t, create_prefix=True) |
|
1121 |
||
1122 |
def test_format_initialize_on_transport_ex_create_prefix_False(self): |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1123 |
if not self.bzrdir_format.is_initializable(): |
1124 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1125 |
t = self.get_transport('missing/dir') |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1126 |
self.assertRaises( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1127 |
errors.NoSuchFile, self.assertInitializeEx, t, |
1128 |
create_prefix=False) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1129 |
|
1130 |
def test_format_initialize_on_transport_ex_force_new_repo_True(self): |
|
1131 |
t = self.get_transport('repo') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1132 |
repo_fmt = controldir.format_registry.make_controldir('1.9') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1133 |
repo_name = repo_fmt.repository_format.network_name() |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1134 |
repo = repo_fmt.initialize_on_transport_ex( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1135 |
t, repo_format_name=repo_name, shared_repo=True)[0] |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1136 |
made_repo, control = self.assertInitializeEx( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1137 |
t.clone('branch'), force_new_repo=True, |
1138 |
repo_format_name=repo_name) |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1139 |
self.assertNotEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1140 |
repo.controldir.root_transport.base, |
1141 |
made_repo.controldir.root_transport.base) |
|
1142 |
||
1143 |
def test_format_initialize_on_transport_ex_force_new_repo_False(self): |
|
1144 |
t = self.get_transport('repo') |
|
1145 |
repo_fmt = controldir.format_registry.make_controldir('1.9') |
|
1146 |
repo_name = repo_fmt.repository_format.network_name() |
|
1147 |
repo = repo_fmt.initialize_on_transport_ex( |
|
1148 |
t, repo_format_name=repo_name, shared_repo=True)[0] |
|
1149 |
made_repo, control = self.assertInitializeEx( |
|
1150 |
t.clone('branch'), force_new_repo=False, |
|
1151 |
repo_format_name=repo_name) |
|
1152 |
if not control._format.fixed_components: |
|
1153 |
self.assertEqual( |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1154 |
repo.controldir.root_transport.base, |
1155 |
made_repo.controldir.root_transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1156 |
|
1157 |
def test_format_initialize_on_transport_ex_repo_fmt_name_None(self): |
|
1158 |
t = self.get_transport('dir') |
|
1159 |
repo, control = self.assertInitializeEx(t) |
|
1160 |
self.assertEqual(None, repo) |
|
1161 |
||
1162 |
def test_format_initialize_on_transport_ex_repo_fmt_name_followed(self): |
|
1163 |
t = self.get_transport('dir') |
|
1164 |
# 1.6 is likely to never be default
|
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1165 |
fmt = controldir.format_registry.make_controldir('1.6') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1166 |
repo_name = fmt.repository_format.network_name() |
1167 |
repo, control = self.assertInitializeEx(t, repo_format_name=repo_name) |
|
1168 |
if self.bzrdir_format.fixed_components: |
|
1169 |
# must stay with the all-in-one-format.
|
|
1170 |
repo_name = self.bzrdir_format.network_name() |
|
1171 |
self.assertEqual(repo_name, repo._format.network_name()) |
|
1172 |
||
|
6164.2.5
by Jelmer Vernooij
Move some stacking tests specific to bzr formats to per_bzrdir. |
1173 |
def assertInitializeEx(self, t, **kwargs): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1174 |
"""Execute initialize_on_transport_ex and check it succeeded correctly. |
1175 |
||
1176 |
This involves checking that the disk objects were created, open with
|
|
1177 |
the same format returned, and had the expected disk format.
|
|
1178 |
||
1179 |
:param t: The transport to initialize on.
|
|
1180 |
:param **kwargs: Additional arguments to pass to
|
|
1181 |
initialize_on_transport_ex.
|
|
1182 |
:return: the resulting repo, control dir tuple.
|
|
1183 |
"""
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1184 |
if not self.bzrdir_format.is_initializable(): |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1185 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1186 |
"control dir format is not initializable") |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1187 |
repo, control, require_stacking, repo_policy = \ |
1188 |
self.bzrdir_format.initialize_on_transport_ex(t, **kwargs) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1189 |
if repo is not None: |
1190 |
# Repositories are open write-locked
|
|
1191 |
self.assertTrue(repo.is_write_locked()) |
|
1192 |
self.addCleanup(repo.unlock) |
|
1193 |
self.assertIsInstance(control, controldir.ControlDir) |
|
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
1194 |
opened = controldir.ControlDir.open(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1195 |
expected_format = self.bzrdir_format |
1196 |
if not isinstance(expected_format, RemoteBzrDirFormat): |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1197 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1198 |
control._format.network_name(), |
1199 |
expected_format.network_name()) |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1200 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1201 |
control._format.network_name(), |
1202 |
opened._format.network_name()) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1203 |
self.assertEqual(control.__class__, opened.__class__) |
1204 |
return repo, control |
|
1205 |
||
1206 |
def test_format_network_name(self): |
|
1207 |
# All control formats must have a network name.
|
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1208 |
dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1209 |
format = dir._format |
1210 |
# We want to test that the network_name matches the actual format on
|
|
1211 |
# disk. For local control dirsthat means that using network_name as a
|
|
1212 |
# key in the registry gives back the same format. For remote obects
|
|
1213 |
# we check that the network_name of the RemoteBzrDirFormat we have
|
|
1214 |
# locally matches the actual format present on disk.
|
|
1215 |
if isinstance(format, RemoteBzrDirFormat): |
|
1216 |
dir._ensure_real() |
|
1217 |
real_dir = dir._real_bzrdir |
|
1218 |
network_name = format.network_name() |
|
1219 |
self.assertEqual(real_dir._format.network_name(), network_name) |
|
1220 |
else: |
|
1221 |
registry = controldir.network_format_registry |
|
1222 |
network_name = format.network_name() |
|
1223 |
looked_up_format = registry.get(network_name) |
|
1224 |
self.assertTrue( |
|
1225 |
issubclass(format.__class__, looked_up_format.__class__)) |
|
1226 |
# The network name must be a byte string.
|
|
|
7018.3.5
by Jelmer Vernooij
Fix remaining tests. |
1227 |
self.assertIsInstance(network_name, bytes) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1228 |
|
1229 |
def test_open_not_bzrdir(self): |
|
1230 |
# test the formats specific behaviour for no-content or similar dirs.
|
|
1231 |
self.assertRaises(errors.NotBranchError, |
|
1232 |
self.bzrdir_format.open, |
|
1233 |
transport.get_transport_from_url(self.get_readonly_url())) |
|
1234 |
||
1235 |
def test_create_branch(self): |
|
1236 |
# a bzrdir can construct a branch and repository for itself.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1237 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1238 |
# unsupported formats are not loopback testable
|
1239 |
# because the default open will not open them and
|
|
1240 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1241 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1242 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1243 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1244 |
made_control.create_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1245 |
made_branch = made_control.create_branch() |
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1246 |
self.assertIsInstance(made_branch, breezy.branch.Branch) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1247 |
self.assertEqual(made_control, made_branch.controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1248 |
|
|
6123.9.12
by Jelmer Vernooij
Add append_revisions_only argument to BranchFormat.initialize. |
1249 |
def test_create_branch_append_revisions_only(self): |
1250 |
# a bzrdir can construct a branch and repository for itself.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1251 |
if not self.bzrdir_format.is_initializable(): |
|
6123.9.12
by Jelmer Vernooij
Add append_revisions_only argument to BranchFormat.initialize. |
1252 |
# unsupported formats are not loopback testable
|
1253 |
# because the default open will not open them and
|
|
1254 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1255 |
raise TestNotApplicable("format is not initializable") |
|
6123.9.12
by Jelmer Vernooij
Add append_revisions_only argument to BranchFormat.initialize. |
1256 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1257 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1258 |
made_control.create_repository() |
|
6123.9.12
by Jelmer Vernooij
Add append_revisions_only argument to BranchFormat.initialize. |
1259 |
try: |
1260 |
made_branch = made_control.create_branch( |
|
1261 |
append_revisions_only=True) |
|
1262 |
except errors.UpgradeRequired: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1263 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1264 |
"format does not support append_revisions_only setting") |
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1265 |
self.assertIsInstance(made_branch, breezy.branch.Branch) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1266 |
self.assertEqual(True, made_branch.get_append_revisions_only()) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1267 |
self.assertEqual(made_control, made_branch.controldir) |
|
6123.9.12
by Jelmer Vernooij
Add append_revisions_only argument to BranchFormat.initialize. |
1268 |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1269 |
def test_open_branch(self): |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1270 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1271 |
# unsupported formats are not loopback testable
|
1272 |
# because the default open will not open them and
|
|
1273 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1274 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1275 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1276 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1277 |
made_control.create_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1278 |
made_branch = made_control.create_branch() |
1279 |
opened_branch = made_control.open_branch() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1280 |
self.assertEqual(made_control, opened_branch.controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1281 |
self.assertIsInstance(opened_branch, made_branch.__class__) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1282 |
self.assertIsInstance( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1283 |
opened_branch._format, |
1284 |
made_branch._format.__class__) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1285 |
|
1286 |
def test_list_branches(self): |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1287 |
if not self.bzrdir_format.is_initializable(): |
1288 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1289 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1290 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1291 |
made_control.create_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1292 |
made_branch = made_control.create_branch() |
|
7045.4.1
by Jelmer Vernooij
Some brz-git fixes. |
1293 |
branches = list(made_control.list_branches()) |
|
6874.3.4
by Jelmer Vernooij
Remove unnecessary change. |
1294 |
self.assertEqual(1, len(branches)) |
1295 |
self.assertEqual(made_branch.base, branches[0].base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1296 |
try: |
1297 |
made_control.destroy_branch() |
|
1298 |
except errors.UnsupportedOperation: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1299 |
pass # Not all bzrdirs support destroying directories |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1300 |
else: |
|
6874.3.4
by Jelmer Vernooij
Remove unnecessary change. |
1301 |
self.assertEqual([], made_control.list_branches()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1302 |
|
|
6282.5.4
by Neil Martinsen-Burrell
add get_branches method to return a dictionary of names and branches |
1303 |
def test_get_branches(self): |
1304 |
repo = self.make_repository('branch-1') |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1305 |
repo.controldir.create_branch() |
|
6874.3.4
by Jelmer Vernooij
Remove unnecessary change. |
1306 |
self.assertEqual([""], list(repo.controldir.get_branches())) |
|
6282.5.4
by Neil Martinsen-Burrell
add get_branches method to return a dictionary of names and branches |
1307 |
|
|
7490.13.2
by Jelmer Vernooij
Fix reference handling. |
1308 |
def test_branch_names(self): |
1309 |
repo = self.make_repository('branch-1') |
|
1310 |
repo.controldir.create_branch() |
|
1311 |
self.assertEqual([""], repo.controldir.branch_names()) |
|
1312 |
||
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1313 |
def test_create_repository(self): |
1314 |
# a bzrdir can construct a repository for itself.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1315 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1316 |
# unsupported formats are not loopback testable
|
1317 |
# because the default open will not open them and
|
|
1318 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1319 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1320 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1321 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1322 |
made_repo = made_control.create_repository() |
1323 |
# Check that we have a repository object.
|
|
|
6973.5.2
by Jelmer Vernooij
Add more bees. |
1324 |
made_repo.has_revision(b'foo') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1325 |
self.assertEqual(made_control, made_repo.controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1326 |
|
1327 |
def test_create_repository_shared(self): |
|
1328 |
# a bzrdir can create a shared repository or
|
|
1329 |
# fail appropriately
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1330 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1331 |
# unsupported formats are not loopback testable
|
1332 |
# because the default open will not open them and
|
|
1333 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1334 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1335 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1336 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1337 |
try: |
1338 |
made_repo = made_control.create_repository(shared=True) |
|
1339 |
except errors.IncompatibleFormat: |
|
1340 |
# Old bzrdir formats don't support shared repositories
|
|
1341 |
# and should raise IncompatibleFormat
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1342 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1343 |
"format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1344 |
self.assertTrue(made_repo.is_shared()) |
1345 |
||
1346 |
def test_create_repository_nonshared(self): |
|
1347 |
# a bzrdir can create a non-shared repository
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1348 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1349 |
# unsupported formats are not loopback testable
|
1350 |
# because the default open will not open them and
|
|
1351 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1352 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1353 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1354 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6123.9.10
by Jelmer Vernooij
Improve tag handling. |
1355 |
try: |
1356 |
made_repo = made_control.create_repository(shared=False) |
|
1357 |
except errors.IncompatibleFormat: |
|
1358 |
# Some control dir formats don't support non-shared repositories
|
|
1359 |
# and should raise IncompatibleFormat
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1360 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1361 |
"format does not support shared repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1362 |
self.assertFalse(made_repo.is_shared()) |
1363 |
||
1364 |
def test_open_repository(self): |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1365 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1366 |
# unsupported formats are not loopback testable
|
1367 |
# because the default open will not open them and
|
|
1368 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1369 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1370 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1371 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1372 |
made_repo = made_control.create_repository() |
1373 |
opened_repo = made_control.open_repository() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1374 |
self.assertEqual(made_control, opened_repo.controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1375 |
self.assertIsInstance(opened_repo, made_repo.__class__) |
1376 |
self.assertIsInstance(opened_repo._format, made_repo._format.__class__) |
|
1377 |
||
1378 |
def test_create_workingtree(self): |
|
1379 |
# a bzrdir can construct a working tree for itself.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1380 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1381 |
# unsupported formats are not loopback testable
|
1382 |
# because the default open will not open them and
|
|
1383 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1384 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1385 |
t = self.get_transport() |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1386 |
made_control = self.bzrdir_format.initialize(t.base) |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1387 |
made_control.create_repository() |
1388 |
made_control.create_branch() |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1389 |
made_tree = self.createWorkingTreeOrSkip(made_control) |
1390 |
self.assertIsInstance(made_tree, workingtree.WorkingTree) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1391 |
self.assertEqual(made_control, made_tree.controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1392 |
|
1393 |
def test_create_workingtree_revision(self): |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1394 |
# a bzrdir can construct a working tree for itself @ a specific
|
1395 |
# revision.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1396 |
if not self.bzrdir_format.is_initializable(): |
1397 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1398 |
t = self.get_transport() |
1399 |
source = self.make_branch_and_tree('source') |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1400 |
a = source.commit('a', allow_pointless=True) |
1401 |
b = source.commit('b', allow_pointless=True) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1402 |
t.mkdir('new') |
1403 |
t_new = t.clone('new') |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1404 |
made_control = self.bzrdir_format.initialize_on_transport(t_new) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1405 |
source.branch.repository.clone(made_control) |
1406 |
source.branch.clone(made_control) |
|
1407 |
try: |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1408 |
made_tree = made_control.create_workingtree(revision_id=a) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1409 |
except (errors.NotLocalUrl, errors.UnsupportedOperation): |
1410 |
raise TestSkipped("Can't make working tree on transport %r" % t) |
|
|
6747.2.1
by Jelmer Vernooij
Avoid setting revision_ids. |
1411 |
self.assertEqual([a], made_tree.get_parent_ids()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1412 |
|
1413 |
def test_open_workingtree(self): |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1414 |
if not self.bzrdir_format.is_initializable(): |
1415 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1416 |
# this has to be tested with local access as we still support creating
|
1417 |
# format 6 bzrdirs
|
|
1418 |
t = self.get_transport() |
|
1419 |
try: |
|
1420 |
made_control = self.bzrdir_format.initialize(t.base) |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1421 |
made_control.create_repository() |
1422 |
made_control.create_branch() |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1423 |
made_tree = made_control.create_workingtree() |
1424 |
except (errors.NotLocalUrl, errors.UnsupportedOperation): |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1425 |
raise TestSkipped( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1426 |
"Can't initialize %r on transport %r" % ( |
1427 |
self.bzrdir_format, t)) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1428 |
opened_tree = made_control.open_workingtree() |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1429 |
self.assertEqual(made_control, opened_tree.controldir) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1430 |
self.assertIsInstance(opened_tree, made_tree.__class__) |
1431 |
self.assertIsInstance(opened_tree._format, made_tree._format.__class__) |
|
1432 |
||
1433 |
def test_get_selected_branch(self): |
|
1434 |
# The segment parameters are accessible from the root transport
|
|
1435 |
# if a URL with segment parameters is opened.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1436 |
if not self.bzrdir_format.is_initializable(): |
1437 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1438 |
t = self.get_transport() |
1439 |
try: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1440 |
self.bzrdir_format.initialize(t.base) |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1441 |
except (errors.NotLocalUrl, errors.UnsupportedOperation): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1442 |
raise TestSkipped("Can't initialize %r on transport %r" |
1443 |
% (self.bzrdir_format, t)) |
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1444 |
dir = controldir.ControlDir.open(t.base + ",branch=foo") |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1445 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1446 |
{"branch": "foo"}, dir.user_transport.get_segment_parameters()) |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1447 |
self.assertEqual("foo", dir._get_selected_branch()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1448 |
|
1449 |
def test_get_selected_branch_none_selected(self): |
|
1450 |
# _get_selected_branch defaults to None
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1451 |
if not self.bzrdir_format.is_initializable(): |
1452 |
raise TestNotApplicable("format is not initializable") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1453 |
t = self.get_transport() |
1454 |
try: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1455 |
self.bzrdir_format.initialize(t.base) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1456 |
except (errors.NotLocalUrl, errors.UnsupportedOperation): |
1457 |
raise TestSkipped("Can't initialize %r on transport %r" |
|
1458 |
% (self.bzrdir_format, t)) |
|
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
1459 |
dir = controldir.ControlDir.open(t.base) |
|
6436.1.1
by Jelmer Vernooij
Change default branch name to "". |
1460 |
self.assertEqual(u"", dir._get_selected_branch()) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1461 |
|
1462 |
def test_root_transport(self): |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1463 |
dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1464 |
self.assertEqual(dir.root_transport.base, |
1465 |
self.get_transport().base) |
|
1466 |
||
1467 |
def test_find_repository_no_repo_under_standalone_branch(self): |
|
1468 |
# finding a repo stops at standalone branches even if there is a
|
|
1469 |
# higher repository available.
|
|
1470 |
try: |
|
1471 |
repo = self.make_repository('.', shared=True) |
|
1472 |
except errors.IncompatibleFormat: |
|
1473 |
# need a shared repository to test this.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1474 |
raise TestNotApplicable("requires shared repository support") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
1475 |
if not repo._format.supports_nesting_repositories: |
1476 |
raise TestNotApplicable("requires nesting repositories") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1477 |
url = self.get_url('intermediate') |
1478 |
t = self.get_transport() |
|
1479 |
t.mkdir('intermediate') |
|
1480 |
t.mkdir('intermediate/child') |
|
1481 |
made_control = self.bzrdir_format.initialize(url) |
|
1482 |
made_control.create_repository() |
|
1483 |
innermost_control = self.bzrdir_format.initialize( |
|
1484 |
self.get_url('intermediate/child')) |
|
1485 |
try: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1486 |
innermost_control.open_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1487 |
# if there is a repository, then the format cannot ever hit this
|
1488 |
# code path.
|
|
1489 |
return
|
|
1490 |
except errors.NoRepositoryPresent: |
|
1491 |
pass
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1492 |
self.assertRaises( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1493 |
errors.NoRepositoryPresent, innermost_control.find_repository) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1494 |
|
1495 |
def test_find_repository_containing_shared_repository(self): |
|
1496 |
# find repo inside a shared repo with an empty control dir
|
|
1497 |
# returns the shared repo.
|
|
1498 |
try: |
|
1499 |
repo = self.make_repository('.', shared=True) |
|
1500 |
except errors.IncompatibleFormat: |
|
1501 |
# need a shared repository to test this.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1502 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1503 |
"requires format with shared repository support") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
1504 |
if not repo._format.supports_nesting_repositories: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1505 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1506 |
"requires support for nesting repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1507 |
url = self.get_url('childbzrdir') |
1508 |
self.get_transport().mkdir('childbzrdir') |
|
1509 |
made_control = self.bzrdir_format.initialize(url) |
|
1510 |
try: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1511 |
made_control.open_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1512 |
# if there is a repository, then the format cannot ever hit this
|
1513 |
# code path.
|
|
1514 |
return
|
|
1515 |
except errors.NoRepositoryPresent: |
|
1516 |
pass
|
|
1517 |
found_repo = made_control.find_repository() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1518 |
self.assertEqual(repo.controldir.root_transport.base, |
1519 |
found_repo.controldir.root_transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1520 |
|
1521 |
def test_find_repository_standalone_with_containing_shared_repository(self): |
|
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
1522 |
# find repo inside a standalone repo inside a shared repo finds the
|
1523 |
# standalone repo
|
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1524 |
try: |
1525 |
containing_repo = self.make_repository('.', shared=True) |
|
1526 |
except errors.IncompatibleFormat: |
|
1527 |
# need a shared repository to test this.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1528 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1529 |
"requires support for shared repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
1530 |
if not containing_repo._format.supports_nesting_repositories: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1531 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1532 |
"format does not support nesting repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1533 |
child_repo = self.make_repository('childrepo') |
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
1534 |
opened_control = controldir.ControlDir.open(self.get_url('childrepo')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1535 |
found_repo = opened_control.find_repository() |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1536 |
self.assertEqual(child_repo.controldir.root_transport.base, |
1537 |
found_repo.controldir.root_transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1538 |
|
1539 |
def test_find_repository_shared_within_shared_repository(self): |
|
1540 |
# find repo at a shared repo inside a shared repo finds the inner repo
|
|
1541 |
try: |
|
1542 |
containing_repo = self.make_repository('.', shared=True) |
|
1543 |
except errors.IncompatibleFormat: |
|
1544 |
# need a shared repository to test this.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1545 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1546 |
"requires support for shared repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
1547 |
if not containing_repo._format.supports_nesting_repositories: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1548 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1549 |
"requires support for nesting repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1550 |
url = self.get_url('childrepo') |
1551 |
self.get_transport().mkdir('childrepo') |
|
1552 |
child_control = self.bzrdir_format.initialize(url) |
|
1553 |
child_repo = child_control.create_repository(shared=True) |
|
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
1554 |
opened_control = controldir.ControlDir.open(self.get_url('childrepo')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1555 |
found_repo = opened_control.find_repository() |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1556 |
self.assertEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1557 |
child_repo.controldir.root_transport.base, |
1558 |
found_repo.controldir.root_transport.base) |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1559 |
self.assertNotEqual( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1560 |
child_repo.controldir.root_transport.base, |
1561 |
containing_repo.controldir.root_transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1562 |
|
1563 |
def test_find_repository_with_nested_dirs_works(self): |
|
1564 |
# find repo inside a bzrdir inside a bzrdir inside a shared repo
|
|
1565 |
# finds the outer shared repo.
|
|
1566 |
try: |
|
1567 |
repo = self.make_repository('.', shared=True) |
|
1568 |
except errors.IncompatibleFormat: |
|
1569 |
# need a shared repository to test this.
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1570 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1571 |
"requires support for shared repositories") |
|
6145.2.1
by Jelmer Vernooij
Add RepositoryFormat.supports_nesting_repositories. |
1572 |
if not repo._format.supports_nesting_repositories: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1573 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1574 |
"requires support for nesting repositories") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1575 |
url = self.get_url('intermediate') |
1576 |
t = self.get_transport() |
|
1577 |
t.mkdir('intermediate') |
|
1578 |
t.mkdir('intermediate/child') |
|
1579 |
made_control = self.bzrdir_format.initialize(url) |
|
1580 |
try: |
|
1581 |
child_repo = made_control.open_repository() |
|
1582 |
# if there is a repository, then the format cannot ever hit this
|
|
1583 |
# code path.
|
|
1584 |
return
|
|
1585 |
except errors.NoRepositoryPresent: |
|
1586 |
pass
|
|
1587 |
innermost_control = self.bzrdir_format.initialize( |
|
1588 |
self.get_url('intermediate/child')) |
|
1589 |
try: |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1590 |
innermost_control.open_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1591 |
# if there is a repository, then the format cannot ever hit this
|
1592 |
# code path.
|
|
1593 |
return
|
|
1594 |
except errors.NoRepositoryPresent: |
|
1595 |
pass
|
|
1596 |
found_repo = innermost_control.find_repository() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1597 |
self.assertEqual(repo.controldir.root_transport.base, |
1598 |
found_repo.controldir.root_transport.base) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1599 |
|
1600 |
def test_can_and_needs_format_conversion(self): |
|
1601 |
# check that we can ask an instance if its upgradable
|
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1602 |
dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1603 |
if dir.can_convert_format(): |
1604 |
# if its default updatable there must be an updater
|
|
1605 |
# (we force the latest known format as downgrades may not be
|
|
1606 |
# available
|
|
1607 |
self.assertTrue(isinstance(dir._format.get_converter( |
|
1608 |
format=dir._format), controldir.Converter)) |
|
1609 |
dir.needs_format_conversion( |
|
1610 |
controldir.ControlDirFormat.get_default_format()) |
|
1611 |
||
1612 |
def test_backup_copies_existing(self): |
|
1613 |
tree = self.make_branch_and_tree('test') |
|
1614 |
self.build_tree(['test/a']) |
|
|
6745.1.1
by Jelmer Vernooij
Avoid explicitly setting file ids or guard it by checking |
1615 |
tree.add(['a']) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1616 |
tree.commit('some data to be copied.') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1617 |
old_url, new_url = tree.controldir.backup_bzrdir() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1618 |
old_path = urlutils.local_path_from_url(old_url) |
1619 |
new_path = urlutils.local_path_from_url(new_url) |
|
1620 |
self.assertPathExists(old_path) |
|
1621 |
self.assertPathExists(new_path) |
|
1622 |
for (((dir_relpath1, _), entries1), |
|
|
6631.2.2
by Martin
Run 2to3 itertools fixer and refactor |
1623 |
((dir_relpath2, _), entries2)) in zip( |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1624 |
osutils.walkdirs(old_path), |
1625 |
osutils.walkdirs(new_path)): |
|
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1626 |
self.assertEqual(dir_relpath1, dir_relpath2) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1627 |
for f1, f2 in zip(entries1, entries2): |
|
6614.1.3
by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual. |
1628 |
self.assertEqual(f1[0], f2[0]) |
1629 |
self.assertEqual(f1[2], f2[2]) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1630 |
if f1[2] == "file": |
|
7045.1.20
by Jelmer Vernooij
Fix per_pack_repository tests. |
1631 |
with open(f1[4], 'rb') as a, open(f2[4], 'rb') as b: |
1632 |
osutils.compare_files(a, b) |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1633 |
|
1634 |
def test_upgrade_new_instance(self): |
|
1635 |
"""Does an available updater work?""" |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1636 |
dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1637 |
# for now, upgrade is not ready for partial bzrdirs.
|
1638 |
dir.create_repository() |
|
1639 |
dir.create_branch() |
|
1640 |
self.createWorkingTreeOrSkip(dir) |
|
1641 |
if dir.can_convert_format(): |
|
1642 |
# if its default updatable there must be an updater
|
|
1643 |
# (we force the latest known format as downgrades may not be
|
|
1644 |
# available
|
|
|
6861.4.1
by Jelmer Vernooij
Make progress bars context managers. |
1645 |
with ui.ui_factory.nested_progress_bar() as pb: |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1646 |
dir._format.get_converter(format=dir._format).convert(dir, pb) |
1647 |
# and it should pass 'check' now.
|
|
1648 |
check.check_dwim(self.get_url('.'), False, True, True) |
|
1649 |
||
1650 |
def test_format_description(self): |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1651 |
dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1652 |
text = dir._format.get_format_description() |
1653 |
self.assertTrue(len(text)) |
|
1654 |
||
1655 |
||
1656 |
class TestBreakLock(TestCaseWithControlDir): |
|
1657 |
||
1658 |
def test_break_lock_empty(self): |
|
1659 |
# break lock on an empty bzrdir should work silently.
|
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1660 |
dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1661 |
try: |
1662 |
dir.break_lock() |
|
1663 |
except NotImplementedError: |
|
1664 |
pass
|
|
1665 |
||
1666 |
def test_break_lock_repository(self): |
|
1667 |
# break lock with just a repo should unlock the repo.
|
|
1668 |
repo = self.make_repository('.') |
|
1669 |
repo.lock_write() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1670 |
lock_repo = repo.controldir.open_repository() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1671 |
if not lock_repo.get_physical_lock_status(): |
1672 |
# This bzrdir's default repository does not physically lock things
|
|
1673 |
# and thus this interaction cannot be tested at the interface
|
|
1674 |
# level.
|
|
1675 |
repo.unlock() |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1676 |
raise TestNotApplicable("format does not physically lock") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1677 |
# only one yes needed here: it should only be unlocking
|
1678 |
# the repo
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1679 |
breezy.ui.ui_factory = CannedInputUIFactory([True]) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1680 |
try: |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1681 |
repo.controldir.break_lock() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1682 |
except NotImplementedError: |
1683 |
# this bzrdir does not implement break_lock - so we cant test it.
|
|
1684 |
repo.unlock() |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1685 |
raise TestNotApplicable("format does not support breaking locks") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1686 |
lock_repo.lock_write() |
1687 |
lock_repo.unlock() |
|
1688 |
self.assertRaises(errors.LockBroken, repo.unlock) |
|
1689 |
||
1690 |
def test_break_lock_branch(self): |
|
1691 |
# break lock with just a repo should unlock the branch.
|
|
1692 |
# and not directly try the repository.
|
|
1693 |
# we test this by making a branch reference to a branch
|
|
1694 |
# and repository in another bzrdir
|
|
1695 |
# for pre-metadir formats this will fail, thats ok.
|
|
1696 |
master = self.make_branch('branch') |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1697 |
thisdir = self.make_controldir('this') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1698 |
try: |
|
6437.7.3
by Jelmer Vernooij
Use ControlDir.set_branch_reference. |
1699 |
thisdir.set_branch_reference(master) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1700 |
except errors.IncompatibleFormat: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1701 |
raise TestNotApplicable( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1702 |
"format does not support branch references") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1703 |
unused_repo = thisdir.create_repository() |
1704 |
master.lock_write() |
|
|
6874.1.1
by Jelmer Vernooij
Allow ControlDir.break_lock to not be implemented. |
1705 |
with unused_repo.lock_write(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1706 |
# two yes's : branch and repository. If the repo in this
|
1707 |
# dir is inappropriately accessed, 3 will be needed, and
|
|
1708 |
# we'll see that because the stream will be fully consumed
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1709 |
breezy.ui.ui_factory = CannedInputUIFactory([True, True, True]) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1710 |
# determine if the repository will have been locked;
|
1711 |
this_repo_locked = \ |
|
|
6874.1.1
by Jelmer Vernooij
Allow ControlDir.break_lock to not be implemented. |
1712 |
thisdir.find_repository().get_physical_lock_status() |
1713 |
try: |
|
1714 |
master.controldir.break_lock() |
|
1715 |
except NotImplementedError: |
|
1716 |
# bzrdir does not support break_lock
|
|
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1717 |
raise TestNotApplicable( |
1718 |
"format does not support breaking locks") |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1719 |
if this_repo_locked: |
1720 |
# only two ys should have been read
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1721 |
self.assertEqual([True], breezy.ui.ui_factory.responses) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1722 |
else: |
1723 |
# only one y should have been read
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1724 |
self.assertEqual([True, True], breezy.ui.ui_factory.responses) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1725 |
# we should be able to lock a newly opened branch now
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1726 |
branch = master.controldir.open_branch() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1727 |
branch.lock_write() |
1728 |
branch.unlock() |
|
1729 |
if this_repo_locked: |
|
1730 |
# we should not be able to lock the repository in thisdir as
|
|
1731 |
# its still held by the explicit lock we took, and the break
|
|
1732 |
# lock should not have touched it.
|
|
1733 |
repo = thisdir.open_repository() |
|
1734 |
self.assertRaises(errors.LockContention, repo.lock_write) |
|
1735 |
self.assertRaises(errors.LockBroken, master.unlock) |
|
1736 |
||
1737 |
def test_break_lock_tree(self): |
|
1738 |
# break lock with a tree should unlock the tree but not try the
|
|
1739 |
# branch explicitly. However this is very hard to test for as we
|
|
1740 |
# dont have a tree reference class, nor is one needed;
|
|
1741 |
# the worst case if this code unlocks twice is an extra question
|
|
1742 |
# being asked.
|
|
1743 |
tree = self.make_branch_and_tree('.') |
|
1744 |
tree.lock_write() |
|
1745 |
# three yes's : tree, branch and repository.
|
|
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
1746 |
breezy.ui.ui_factory = CannedInputUIFactory([True, True, True]) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1747 |
try: |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1748 |
tree.controldir.break_lock() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1749 |
except (NotImplementedError, errors.LockActive): |
1750 |
# bzrdir does not support break_lock
|
|
1751 |
# or one of the locked objects (currently only tree does this)
|
|
1752 |
# raised a LockActive because we do still have a live locked
|
|
1753 |
# object.
|
|
1754 |
tree.unlock() |
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1755 |
raise TestNotApplicable("format does not support breaking locks") |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1756 |
self.assertEqual([True], breezy.ui.ui_factory.responses) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
1757 |
lock_tree = tree.controldir.open_workingtree() |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1758 |
lock_tree.lock_write() |
1759 |
lock_tree.unlock() |
|
1760 |
self.assertRaises(errors.LockBroken, tree.unlock) |
|
1761 |
||
1762 |
||
1763 |
class TestTransportConfig(TestCaseWithControlDir): |
|
1764 |
||
1765 |
def test_get_config(self): |
|
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1766 |
my_dir = self.make_controldir('.') |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1767 |
config = my_dir.get_config() |
1768 |
try: |
|
1769 |
config.set_default_stack_on('http://example.com') |
|
|
6619.3.2
by Jelmer Vernooij
Apply 2to3 except fix. |
1770 |
except errors.BzrError as e: |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1771 |
if 'Cannot set config' in str(e): |
1772 |
self.assertFalse( |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1773 |
isinstance( |
1774 |
my_dir, (_mod_bzrdir.BzrDirMeta1, RemoteBzrDir)), |
|
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1775 |
"%r should support configs" % my_dir) |
1776 |
raise TestNotApplicable( |
|
1777 |
'This BzrDir format does not support configs.') |
|
1778 |
else: |
|
1779 |
raise
|
|
1780 |
self.assertEqual('http://example.com', config.get_default_stack_on()) |
|
|
6472.2.1
by Jelmer Vernooij
Use bzrdir.controldir for generic access to control directories. |
1781 |
my_dir2 = controldir.ControlDir.open(self.get_url('.')) |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1782 |
config2 = my_dir2.get_config() |
1783 |
self.assertEqual('http://example.com', config2.get_default_stack_on()) |
|
1784 |
||
1785 |
||
1786 |
class ChrootedControlDirTests(ChrootedTestCase): |
|
1787 |
||
1788 |
def test_find_repository_no_repository(self): |
|
1789 |
# loopback test to check the current format fails to find a
|
|
1790 |
# share repository correctly.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1791 |
if not self.bzrdir_format.is_initializable(): |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1792 |
# unsupported formats are not loopback testable
|
1793 |
# because the default open will not open them and
|
|
1794 |
# they may not be initializable.
|
|
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1795 |
raise TestNotApplicable("format is not initializable") |
|
6083.1.2
by Jelmer Vernooij
Revert unnecessary changes. |
1796 |
# supported formats must be able to init and open
|
1797 |
# - do the vfs initialisation over the basic vfs transport
|
|
1798 |
# XXX: TODO this should become a 'bzrdirlocation' api call.
|
|
1799 |
url = self.get_vfs_only_url('subdir') |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1800 |
transport.get_transport_from_url( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1801 |
self.get_vfs_only_url()).mkdir('subdir') |
|
6162.3.4
by Jelmer Vernooij
Use TestNotApplicable rather than returning directly. |
1802 |
made_control = self.bzrdir_format.initialize(self.get_url('subdir')) |
|
1534.6.6
by Robert Collins
Move find_repository to bzrdir, its not quite ideal there but its simpler and until someone chooses to vary the search by branch type its completely sufficient. |
1803 |
try: |
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1804 |
made_control.open_repository() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
1805 |
# if there is a repository, then the format cannot ever hit this
|
|
1534.6.6
by Robert Collins
Move find_repository to bzrdir, its not quite ideal there but its simpler and until someone chooses to vary the search by branch type its completely sufficient. |
1806 |
# code path.
|
1807 |
return
|
|
1808 |
except errors.NoRepositoryPresent: |
|
1809 |
pass
|
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1810 |
made_control = controldir.ControlDir.open( |
|
7143.15.2
by Jelmer Vernooij
Run autopep8. |
1811 |
self.get_readonly_url('subdir')) |
|
1534.6.6
by Robert Collins
Move find_repository to bzrdir, its not quite ideal there but its simpler and until someone chooses to vary the search by branch type its completely sufficient. |
1812 |
self.assertRaises(errors.NoRepositoryPresent, |
|
2018.5.42
by Robert Collins
Various hopefully improvements, but wsgi is broken, handing over to spiv :). |
1813 |
made_control.find_repository) |
|
1534.6.6
by Robert Collins
Move find_repository to bzrdir, its not quite ideal there but its simpler and until someone chooses to vary the search by branch type its completely sufficient. |
1814 |
|
|
5158.6.1
by Martin Pool
Add ControlComponent interface and make BzrDir implement it |
1815 |
|
|
5363.2.22
by Jelmer Vernooij
Provide bzrlib.bzrdir.format_registry. |
1816 |
class TestControlDirControlComponent(TestCaseWithControlDir): |
1817 |
"""ControlDir implementations adequately implement ControlComponent.""" |
|
|
5273.1.7
by Vincent Ladeuil
No more use of the get_transport imported *symbol*, all uses are through |
1818 |
|
|
5158.6.1
by Martin Pool
Add ControlComponent interface and make BzrDir implement it |
1819 |
def test_urls(self): |
|
6653.6.5
by Jelmer Vernooij
Rename make_bzrdir to make_controldir. |
1820 |
bd = self.make_controldir('bd') |
|
5158.6.1
by Martin Pool
Add ControlComponent interface and make BzrDir implement it |
1821 |
self.assertIsInstance(bd.user_url, str) |
1822 |
self.assertEqual(bd.user_url, bd.user_transport.base) |
|
|
6747.2.3
by Jelmer Vernooij
Fix formatting. |
1823 |
# for all current bzrdir implementations the user dir must be
|
|
5158.6.1
by Martin Pool
Add ControlComponent interface and make BzrDir implement it |
1824 |
# above the control dir but we might need to relax that?
|
1825 |
self.assertEqual(bd.control_url.find(bd.user_url), 0) |
|
1826 |
self.assertEqual(bd.control_url, bd.control_transport.base) |