bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
1 |
# Copyright (C) 2008 Canonical Ltd
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
17 |
import os |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
18 |
import stat |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
19 |
import sys |
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
20 |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
21 |
|
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
22 |
from bzrlib import ( |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
23 |
branch, |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
24 |
bzrdir, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
25 |
errors, |
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
26 |
osutils, |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
27 |
remote, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
28 |
revisionspec, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
29 |
tests, |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
30 |
transport, |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
31 |
workingtree, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
32 |
)
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
33 |
from bzrlib.smart import server as smart_server |
34 |
||
35 |
from bzrlib.tests import ( |
|
36 |
test_transport_implementations, |
|
37 |
branch_implementations, |
|
38 |
)
|
|
39 |
||
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
40 |
|
|
0.158.9
by Gary van der Merwe
Add a check to make sure we are not uploading to an existing wt. |
41 |
from bzrlib.plugins.upload import ( |
42 |
cmd_upload, |
|
43 |
BzrUploader, |
|
44 |
get_upload_auto, |
|
|
0.158.19
by Vincent Ladeuil
Bzr has facilities for exceptions, let's use them. |
45 |
CannotUploadToWorkingTreeError, |
|
0.158.9
by Gary van der Merwe
Add a check to make sure we are not uploading to an existing wt. |
46 |
)
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
47 |
|
48 |
||
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
49 |
class TransportAdapter( |
50 |
test_transport_implementations.TransportTestProviderAdapter): |
|
51 |
"""A tool to generate a suite testing all transports for a single test. |
|
52 |
||
53 |
We restrict the transports to the ones we want to support.
|
|
54 |
"""
|
|
55 |
||
56 |
def _test_permutations(self): |
|
57 |
"""Return a list of the klass, server_factory pairs to test.""" |
|
58 |
result = [] |
|
59 |
transport_modules =['bzrlib.transport.ftp', |
|
60 |
'bzrlib.transport.sftp'] |
|
61 |
for module in transport_modules: |
|
62 |
try: |
|
63 |
permutations = self.get_transport_test_permutations( |
|
64 |
reduce(getattr, (module).split('.')[1:], |
|
65 |
__import__(module))) |
|
66 |
for (klass, server_factory) in permutations: |
|
67 |
scenario = (server_factory.__name__, |
|
68 |
{"transport_class":klass, |
|
69 |
"transport_server":server_factory}) |
|
70 |
result.append(scenario) |
|
71 |
except errors.DependencyNotPresent, e: |
|
72 |
# Continue even if a dependency prevents us
|
|
73 |
# from adding this test
|
|
74 |
pass
|
|
|
0.152.48
by Vincent Ladeuil
Plug tests against proftpd if the local_test_sever plugin is |
75 |
try: |
76 |
import bzrlib.plugins.local_test_server |
|
77 |
from bzrlib.plugins.local_test_server import test_server |
|
78 |
if False: |
|
79 |
# XXX: Disable since we can't get chmod working for anonymous
|
|
80 |
# user
|
|
81 |
scenario = ('vsftpd', |
|
82 |
{'transport_class': test_server.FtpTransport, |
|
83 |
'transport_server': test_server.Vsftpd, |
|
84 |
})
|
|
85 |
result.append(scenario) |
|
86 |
if test_server.ProftpdFeature().available(): |
|
87 |
scenario = ('proftpd', |
|
88 |
{'transport_class': test_server.FtpTransport, |
|
89 |
'transport_server': test_server.Proftpd, |
|
90 |
})
|
|
91 |
result.append(scenario) |
|
92 |
except ImportError: |
|
93 |
pass
|
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
94 |
return result |
95 |
||
96 |
||
97 |
def load_tests(standard_tests, module, loader): |
|
98 |
"""Multiply tests for tranport implementations.""" |
|
99 |
result = loader.suiteClass() |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
100 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
101 |
is_testing_for_transports = tests.condition_isinstance( |
102 |
(TestFullUpload, |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
103 |
TestIncrementalUpload, |
|
0.158.20
by Vincent Ladeuil
Testing against remote branch and testing full/incremental are different. |
104 |
TestUploadFromRemoteBranch)) |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
105 |
transport_adapter = TransportAdapter() |
106 |
||
107 |
is_testing_for_branches = tests.condition_isinstance( |
|
108 |
(TestBranchUploadLocations,)) |
|
109 |
# Generate a list of branch formats and their associated bzrdir formats to
|
|
110 |
# use.
|
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
111 |
# XXX: This was copied from bzrlib.tests.branch_implementations.tests_suite
|
112 |
# and need to be shared in a better way.
|
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
113 |
combinations = [(format, format._matchingbzrdir) for format in |
114 |
branch.BranchFormat._formats.values() + branch._legacy_formats] |
|
115 |
BTPA = branch_implementations.BranchTestProviderAdapter |
|
116 |
branch_adapter = BTPA( |
|
117 |
# None here will cause the default vfs transport server to be used.
|
|
118 |
None, |
|
119 |
# None here will cause a readonly decorator to be created
|
|
120 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
121 |
None, |
|
122 |
combinations) |
|
123 |
branch_adapter_for_ss = BTPA( |
|
124 |
smart_server.SmartTCPServer_for_testing, |
|
125 |
smart_server.ReadonlySmartTCPServer_for_testing, |
|
126 |
[(remote.RemoteBranchFormat(), remote.RemoteBzrDirFormat())], |
|
127 |
# XXX: Report to bzr list, this parameter is not used in the
|
|
128 |
# constructor
|
|
129 |
||
130 |
# MemoryServer
|
|
131 |
)
|
|
132 |
||
133 |
for test_class in tests.iter_suite_tests(standard_tests): |
|
134 |
# Each test class is either standalone or testing for some combination
|
|
135 |
# of transport or branch. Use the right adpater (or none) depending on
|
|
136 |
# the class.
|
|
137 |
if is_testing_for_transports(test_class): |
|
138 |
result.addTests(transport_adapter.adapt(test_class)) |
|
139 |
elif is_testing_for_branches(test_class): |
|
140 |
result.addTests(branch_adapter.adapt(test_class)) |
|
141 |
result.addTests(branch_adapter_for_ss.adapt(test_class)) |
|
142 |
else: |
|
143 |
result.addTest(test_class) |
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
144 |
return result |
145 |
||
146 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
147 |
class UploadUtilsMixin(object): |
148 |
"""Helper class to write upload tests. |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
149 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
150 |
This class provides helpers to simplify test writing. The emphasis is on
|
151 |
easy test writing, so each tree modification is committed. This doesn't
|
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
152 |
preclude writing tests spawning several revisions to upload more complex
|
153 |
changes.
|
|
154 |
"""
|
|
155 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
156 |
upload_dir = 'upload' |
157 |
branch_dir = 'branch' |
|
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
158 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
159 |
def make_branch_and_working_tree(self): |
160 |
t = transport.get_transport(self.branch_dir) |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
161 |
t.ensure_base() |
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
162 |
branch = bzrdir.BzrDir.create_branch_convenience( |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
163 |
t.base, |
164 |
format=bzrdir.format_registry.make_bzrdir('default'), |
|
165 |
force_new_tree=False) |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
166 |
self.tree = branch.bzrdir.create_workingtree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
167 |
self.tree.commit('initial empty tree') |
168 |
||
169 |
def assertUpFileEqual(self, content, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
170 |
self.assertFileEqual(content, osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
171 |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
172 |
def assertUpPathModeEqual(self, path, expected_mode, base=upload_dir): |
173 |
# FIXME: the tests needing that assertion should depend on the server
|
|
174 |
# ability to handle chmod so that they don't fail (or be skipped)
|
|
175 |
# against servers that can't. Note that some bzrlib transports define
|
|
176 |
# _can_roundtrip_unix_modebits in a incomplete way, this property
|
|
177 |
# should depend on both the client and the server, not the client only.
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
178 |
full_path = osutils.pathjoin(base, path) |
179 |
st = os.stat(full_path) |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
180 |
mode = st.st_mode & 0777 |
181 |
if expected_mode == mode: |
|
182 |
return
|
|
183 |
raise AssertionError( |
|
184 |
'For path %s, mode is %s not %s' % |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
185 |
(full_path, oct(mode), oct(expected_mode))) |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
186 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
187 |
def failIfUpFileExists(self, path, base=upload_dir): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
188 |
self.failIfExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
189 |
|
190 |
def failUnlessUpFileExists(self, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
191 |
self.failUnlessExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
192 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
193 |
def set_file_content(self, path, content, base=branch_dir): |
194 |
f = file(osutils.pathjoin(base, path), 'wb') |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
195 |
try: |
196 |
f.write(content) |
|
197 |
finally: |
|
198 |
f.close() |
|
199 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
200 |
def add_file(self, path, content, base=branch_dir): |
201 |
self.set_file_content(path, content, base) |
|
202 |
self.tree.add(path) |
|
203 |
self.tree.commit('add file %s' % path) |
|
204 |
||
205 |
def modify_file(self, path, content, base=branch_dir): |
|
206 |
self.set_file_content(path, content, base) |
|
207 |
self.tree.commit('modify file %s' % path) |
|
208 |
||
209 |
def chmod_file(self, path, mode, base=branch_dir): |
|
210 |
full_path = osutils.pathjoin(base, path) |
|
211 |
os.chmod(full_path, mode) |
|
212 |
self.tree.commit('change file %s mode to %s' % (path, oct(mode))) |
|
213 |
||
214 |
def delete_any(self, path, base=branch_dir): |
|
215 |
self.tree.remove([path], keep_files=False) |
|
216 |
self.tree.commit('delete %s' % path) |
|
217 |
||
218 |
def add_dir(self, path, base=branch_dir): |
|
219 |
os.mkdir(osutils.pathjoin(base, path)) |
|
220 |
self.tree.add(path) |
|
221 |
self.tree.commit('add directory %s' % path) |
|
222 |
||
223 |
def rename_any(self, old_path, new_path): |
|
224 |
self.tree.rename_one(old_path, new_path) |
|
225 |
self.tree.commit('rename %s into %s' % (old_path, new_path)) |
|
226 |
||
227 |
def transform_dir_into_file(self, path, content, base=branch_dir): |
|
228 |
osutils.delete_any(osutils.pathjoin(base, path)) |
|
229 |
self.set_file_content(path, content, base) |
|
230 |
self.tree.commit('change %s from dir to file' % path) |
|
231 |
||
232 |
def transform_file_into_dir(self, path, base=branch_dir): |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
233 |
# bzr can't handle that kind change in a single commit without an
|
234 |
# intervening bzr status (see bug #205636).
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
235 |
self.tree.remove([path], keep_files=False) |
236 |
os.mkdir(osutils.pathjoin(base, path)) |
|
237 |
self.tree.add(path) |
|
238 |
self.tree.commit('change %s from file to dir' % path) |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
239 |
|
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
240 |
def _get_cmd_upload(self): |
241 |
upload = cmd_upload() |
|
242 |
# We don't want to use run_bzr here because redirected output are a
|
|
243 |
# pain to debug. But we need to provides a valid outf.
|
|
244 |
# XXX: Should a bug against bzr be filled about that ?
|
|
245 |
upload._setup_outf() |
|
246 |
return upload |
|
247 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
248 |
def do_full_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
249 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
250 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
251 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
252 |
kwargs['directory'] = self.branch_dir |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
253 |
kwargs['full'] = True |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
254 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
255 |
upload.run(up_url, *args, **kwargs) |
256 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
257 |
def do_incremental_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
258 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
259 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
260 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
261 |
kwargs['directory'] = self.branch_dir |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
262 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
263 |
upload.run(up_url, *args, **kwargs) |
264 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
265 |
|
266 |
class TestUploadMixin(UploadUtilsMixin): |
|
267 |
"""Helper class to share tests between full and incremental uploads.""" |
|
268 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
269 |
def test_create_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
270 |
self.make_branch_and_working_tree() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
271 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
272 |
self.add_file('hello', 'foo') |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
273 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
274 |
self.do_upload() |
275 |
||
276 |
self.assertUpFileEqual('foo', 'hello') |
|
277 |
||
278 |
def test_create_file_in_subdir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
279 |
self.make_branch_and_working_tree() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
280 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
281 |
self.add_dir('dir') |
282 |
self.add_file('dir/goodbye', 'baz') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
283 |
|
284 |
self.failIfUpFileExists('dir/goodbye') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
285 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
286 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
287 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
288 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
289 |
self.assertUpPathModeEqual('dir', 0775) |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
290 |
|
291 |
def test_modify_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
292 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
293 |
self.add_file('hello', 'foo') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
294 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
295 |
self.modify_file('hello', 'bar') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
296 |
|
297 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
298 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
299 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
300 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
301 |
self.assertUpFileEqual('bar', 'hello') |
302 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
303 |
def test_rename_one_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
304 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
305 |
self.add_file('hello', 'foo') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
306 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
307 |
self.rename_any('hello', 'goodbye') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
308 |
|
309 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
310 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
311 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
312 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
313 |
self.assertUpFileEqual('foo', 'goodbye') |
314 |
||
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
315 |
def test_rename_and_change_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
316 |
self.make_branch_and_working_tree() |
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
317 |
self.add_file('hello', 'foo') |
318 |
self.do_full_upload() |
|
319 |
self.rename_any('hello', 'goodbye') |
|
320 |
self.modify_file('goodbye', 'bar') |
|
321 |
||
322 |
self.assertUpFileEqual('foo', 'hello') |
|
323 |
||
324 |
self.do_upload() |
|
325 |
||
326 |
self.assertUpFileEqual('bar', 'goodbye') |
|
327 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
328 |
def test_rename_two_files(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
329 |
self.make_branch_and_working_tree() |
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
330 |
self.add_file('a', 'foo') |
331 |
self.add_file('b', 'qux') |
|
332 |
self.do_full_upload() |
|
333 |
# We rely on the assumption that bzr will topologically sort the
|
|
334 |
# renames which will cause a -> b to appear *before* b -> c
|
|
335 |
self.rename_any('b', 'c') |
|
336 |
self.rename_any('a', 'b') |
|
337 |
||
338 |
self.assertUpFileEqual('foo', 'a') |
|
339 |
self.assertUpFileEqual('qux', 'b') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
340 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
341 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
342 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
343 |
self.assertUpFileEqual('foo', 'b') |
344 |
self.assertUpFileEqual('qux', 'c') |
|
345 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
346 |
def test_upload_revision(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
347 |
self.make_branch_and_working_tree() # rev1 |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
348 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
349 |
self.add_file('hello', 'foo') # rev2 |
350 |
self.modify_file('hello', 'bar') # rev3 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
351 |
|
352 |
self.failIfUpFileExists('hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
353 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
354 |
revspec = revisionspec.RevisionSpec.from_string('2') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
355 |
self.do_upload(revision=[revspec]) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
356 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
357 |
self.assertUpFileEqual('foo', 'hello') |
358 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
359 |
def test_no_upload_when_changes(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
360 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
361 |
self.add_file('a', 'foo') |
362 |
self.set_file_content('a', 'bar') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
363 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
364 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
365 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
366 |
def test_no_upload_when_conflicts(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
367 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
368 |
self.add_file('a', 'foo') |
369 |
self.run_bzr('branch branch other') |
|
370 |
self.modify_file('a', 'bar') |
|
371 |
other_tree = workingtree.WorkingTree.open('other') |
|
372 |
self.set_file_content('a', 'baz', 'other/') |
|
373 |
other_tree.commit('modify file a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
374 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
375 |
self.run_bzr('merge -d branch other', retcode=1) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
376 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
377 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
378 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
379 |
def test_change_file_into_dir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
380 |
self.make_branch_and_working_tree() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
381 |
self.add_file('hello', 'foo') |
382 |
self.do_full_upload() |
|
383 |
self.transform_file_into_dir('hello') |
|
384 |
self.add_file('hello/file', 'bar') |
|
385 |
||
386 |
self.assertUpFileEqual('foo', 'hello') |
|
387 |
||
388 |
self.do_upload() |
|
389 |
||
390 |
self.assertUpFileEqual('bar', 'hello/file') |
|
391 |
||
392 |
def test_change_dir_into_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
393 |
self.make_branch_and_working_tree() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
394 |
self.add_dir('hello') |
395 |
self.add_file('hello/file', 'foo') |
|
396 |
self.do_full_upload() |
|
397 |
self.delete_any('hello/file') |
|
398 |
self.transform_dir_into_file('hello', 'bar') |
|
399 |
||
400 |
self.assertUpFileEqual('foo', 'hello/file') |
|
401 |
||
402 |
self.do_upload() |
|
403 |
||
404 |
self.assertUpFileEqual('bar', 'hello') |
|
405 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
406 |
def test_make_file_executable(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
407 |
self.make_branch_and_working_tree() |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
408 |
self.add_file('hello', 'foo') |
409 |
self.chmod_file('hello', 0664) |
|
410 |
self.do_full_upload() |
|
411 |
self.chmod_file('hello', 0755) |
|
412 |
||
413 |
self.assertUpPathModeEqual('hello', 0664) |
|
414 |
||
415 |
self.do_upload() |
|
416 |
||
417 |
self.assertUpPathModeEqual('hello', 0775) |
|
418 |
||
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
419 |
def get_upload_auto(self): |
420 |
return get_upload_auto(self.tree.branch) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
421 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
422 |
def test_upload_auto(self): |
423 |
"""Test that upload --auto sets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
424 |
self.make_branch_and_working_tree() |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
425 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
426 |
self.add_file('hello', 'foo') |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
427 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
428 |
self.do_full_upload(auto=True) |
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
429 |
self.assertUpFileEqual('foo', 'hello') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
430 |
self.assertTrue(self.get_upload_auto()) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
431 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
432 |
# and check that it stays set until it is unset
|
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
433 |
self.add_file('bye', 'bar') |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
434 |
self.do_full_upload() |
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
435 |
self.assertUpFileEqual('bar', 'bye') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
436 |
self.assertTrue(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
437 |
|
438 |
def test_upload_noauto(self): |
|
439 |
"""Test that upload --no-auto unsets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
440 |
self.make_branch_and_working_tree() |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
441 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
442 |
self.add_file('hello', 'foo') |
443 |
self.do_full_upload(auto=True) |
|
444 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
445 |
self.assertTrue(self.get_upload_auto()) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
446 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
447 |
self.add_file('bye', 'bar') |
448 |
self.do_full_upload(auto=False) |
|
449 |
self.assertUpFileEqual('bar', 'bye') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
450 |
self.assertFalse(self.get_upload_auto()) |
|
0.158.12
by Gary van der Merwe
In the auto tests, do a upload before checking that auto is not set to handle the from Remote cases correctly. Add some blank line for clarity. |
451 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
452 |
# and check that it stays unset until it is set
|
453 |
self.add_file('again', 'baz') |
|
454 |
self.do_full_upload() |
|
455 |
self.assertUpFileEqual('baz', 'again') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
456 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
457 |
|
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
458 |
def test_upload_from_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
459 |
self.make_branch_and_working_tree() |
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
460 |
self.build_tree(['branch/foo/', 'branch/foo/bar']) |
461 |
self.tree.add(['foo/', 'foo/bar']) |
|
462 |
self.tree.commit("Add directory") |
|
463 |
self.do_full_upload(directory='branch/foo') |
|
464 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
465 |
|
466 |
class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
467 |
||
468 |
do_upload = TestUploadMixin.do_full_upload |
|
469 |
||
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
470 |
def test_full_upload_empty_tree(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
471 |
self.make_branch_and_working_tree() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
472 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
473 |
self.do_full_upload() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
474 |
|
|
0.155.1
by James Westby
Switch most of the logic to a class outside of the command class. |
475 |
self.failUnlessUpFileExists(BzrUploader.bzr_upload_revid_file_name) |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
476 |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
477 |
def test_invalid_revspec(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
478 |
self.make_branch_and_working_tree() |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
479 |
rev1 = revisionspec.RevisionSpec.from_string('1') |
480 |
rev2 = revisionspec.RevisionSpec.from_string('2') |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
481 |
|
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
482 |
self.assertRaises(errors.BzrCommandError, |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
483 |
self.do_incremental_upload, revision=[rev1, rev2]) |
484 |
||
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
485 |
def test_create_remote_dir_twice(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
486 |
self.make_branch_and_working_tree() |
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
487 |
self.add_dir('dir') |
488 |
self.do_full_upload() |
|
489 |
self.add_file('dir/goodbye', 'baz') |
|
490 |
||
491 |
self.failIfUpFileExists('dir/goodbye') |
|
492 |
||
493 |
self.do_full_upload() |
|
494 |
||
495 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
496 |
self.assertUpPathModeEqual('dir', 0775) |
|
497 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
498 |
|
499 |
class TestIncrementalUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
500 |
||
501 |
do_upload = TestUploadMixin.do_incremental_upload |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
502 |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
503 |
# XXX: full upload doesn't handle deletions....
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
504 |
|
505 |
def test_delete_one_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
506 |
self.make_branch_and_working_tree() |
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
507 |
self.add_file('hello', 'foo') |
508 |
self.do_full_upload() |
|
509 |
self.delete_any('hello') |
|
510 |
||
511 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
512 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
513 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
514 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
515 |
self.failIfUpFileExists('hello') |
516 |
||
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
517 |
def test_delete_dir_and_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
518 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
519 |
self.add_dir('dir') |
520 |
self.add_dir('dir/subdir') |
|
521 |
self.add_file('dir/subdir/a', 'foo') |
|
522 |
self.do_full_upload() |
|
523 |
self.rename_any('dir/subdir/a', 'a') |
|
524 |
self.delete_any('dir/subdir') |
|
525 |
self.delete_any('dir') |
|
526 |
||
527 |
self.assertUpFileEqual('foo', 'dir/subdir/a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
528 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
529 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
530 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
531 |
self.failIfUpFileExists('dir/subdir/a') |
532 |
self.failIfUpFileExists('dir/subdir') |
|
533 |
self.failIfUpFileExists('dir') |
|
534 |
self.assertUpFileEqual('foo', 'a') |
|
535 |
||
536 |
def test_delete_one_file_rename_to_deleted(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
537 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
538 |
self.add_file('a', 'foo') |
539 |
self.add_file('b', 'bar') |
|
540 |
self.do_full_upload() |
|
541 |
self.delete_any('a') |
|
542 |
self.rename_any('b', 'a') |
|
543 |
||
544 |
self.assertUpFileEqual('foo', 'a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
545 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
546 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
547 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
548 |
self.failIfUpFileExists('b') |
549 |
self.assertUpFileEqual('bar', 'a') |
|
550 |
||
551 |
def test_rename_outside_dir_delete_dir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
552 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
553 |
self.add_dir('dir') |
554 |
self.add_file('dir/a', 'foo') |
|
555 |
self.do_full_upload() |
|
556 |
self.rename_any('dir/a', 'a') |
|
557 |
self.delete_any('dir') |
|
558 |
||
559 |
self.assertUpFileEqual('foo', 'dir/a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
560 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
561 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
562 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
563 |
self.failIfUpFileExists('dir/a') |
564 |
self.failIfUpFileExists('dir') |
|
565 |
self.assertUpFileEqual('foo', 'a') |
|
566 |
||
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
567 |
def test_upload_for_the_first_time_do_a_full_upload(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
568 |
self.make_branch_and_working_tree() |
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
569 |
self.add_file('hello', 'bar') |
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
570 |
|
|
0.155.1
by James Westby
Switch most of the logic to a class outside of the command class. |
571 |
self.failIfUpFileExists(BzrUploader.bzr_upload_revid_file_name) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
572 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
573 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
574 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
575 |
self.assertUpFileEqual('bar', 'hello') |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
576 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
577 |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
578 |
class TestBranchUploadLocations(branch_implementations.TestCaseWithBranch): |
579 |
||
580 |
def test_get_upload_location_unset(self): |
|
581 |
config = self.get_branch().get_config() |
|
582 |
self.assertEqual(None, config.get_user_option('upload_location')) |
|
583 |
||
584 |
def test_get_push_location_exact(self): |
|
585 |
from bzrlib.config import (locations_config_filename, |
|
586 |
ensure_config_dir_exists) |
|
587 |
ensure_config_dir_exists() |
|
588 |
fn = locations_config_filename() |
|
589 |
b = self.get_branch() |
|
590 |
open(fn, 'wt').write(("[%s]\n" |
|
591 |
"upload_location=foo\n" % |
|
592 |
b.base[:-1])) |
|
593 |
config = b.get_config() |
|
594 |
self.assertEqual("foo", config.get_user_option('upload_location')) |
|
595 |
||
596 |
def test_set_push_location(self): |
|
597 |
config = self.get_branch().get_config() |
|
598 |
config.set_user_option('upload_location', 'foo') |
|
599 |
self.assertEqual('foo', config.get_user_option('upload_location')) |
|
600 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
601 |
|
602 |
class TestUploadFromRemoteBranch(tests.TestCaseWithTransport, |
|
603 |
UploadUtilsMixin): |
|
604 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
605 |
remote_branch_dir = 'remote_branch' |
606 |
||
607 |
def make_remote_branch_without_working_tree(self): |
|
608 |
"""Creates a branch without working tree to upload from. |
|
609 |
||
610 |
It's created from the existing self.branch_dir one which still has its
|
|
611 |
working tree.
|
|
612 |
"""
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
613 |
self.make_branch_and_working_tree() |
614 |
self.add_file('hello', 'foo') |
|
615 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
616 |
remote_branch_url = self.get_url(self.remote_branch_dir) |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
617 |
self.run_bzr(['push', remote_branch_url, |
618 |
'--directory', self.branch_dir]) |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
619 |
return remote_branch_url |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
620 |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
621 |
def test_no_upload_to_remote_working_tree(self): |
622 |
remote_branch_url = self.make_remote_branch_without_working_tree() |
|
623 |
upload = self._get_cmd_upload() |
|
624 |
up_url = self.get_url(self.branch_dir) |
|
625 |
# Let's try to upload from the just created remote branch into the
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
626 |
# branch (with has a working tree).
|
|
0.158.19
by Vincent Ladeuil
Bzr has facilities for exceptions, let's use them. |
627 |
self.assertRaises(CannotUploadToWorkingTreeError, |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
628 |
upload.run, up_url, directory=remote_branch_url) |
629 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
630 |
def test_upload_without_working_tree(self): |
631 |
remote_branch_url = self.make_remote_branch_without_working_tree() |
|
632 |
self.do_full_upload(directory=remote_branch_url) |
|
633 |
self.assertUpFileEqual('foo', 'hello') |
|
634 |