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, |
|
45 |
CannotUploadToWT, |
|
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, |
104 |
TestFullUploadFromRemote, |
|
105 |
TestIncrementalUploadFromRemote)) |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
106 |
transport_adapter = TransportAdapter() |
107 |
||
108 |
is_testing_for_branches = tests.condition_isinstance( |
|
109 |
(TestBranchUploadLocations,)) |
|
110 |
# Generate a list of branch formats and their associated bzrdir formats to
|
|
111 |
# use.
|
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
112 |
# XXX: This was copied from bzrlib.tests.branch_implementations.tests_suite
|
113 |
# and need to be shared in a better way.
|
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
114 |
combinations = [(format, format._matchingbzrdir) for format in |
115 |
branch.BranchFormat._formats.values() + branch._legacy_formats] |
|
116 |
BTPA = branch_implementations.BranchTestProviderAdapter |
|
117 |
branch_adapter = BTPA( |
|
118 |
# None here will cause the default vfs transport server to be used.
|
|
119 |
None, |
|
120 |
# None here will cause a readonly decorator to be created
|
|
121 |
# by the TestCaseWithTransport.get_readonly_transport method.
|
|
122 |
None, |
|
123 |
combinations) |
|
124 |
branch_adapter_for_ss = BTPA( |
|
125 |
smart_server.SmartTCPServer_for_testing, |
|
126 |
smart_server.ReadonlySmartTCPServer_for_testing, |
|
127 |
[(remote.RemoteBranchFormat(), remote.RemoteBzrDirFormat())], |
|
128 |
# XXX: Report to bzr list, this parameter is not used in the
|
|
129 |
# constructor
|
|
130 |
||
131 |
# MemoryServer
|
|
132 |
)
|
|
133 |
||
134 |
for test_class in tests.iter_suite_tests(standard_tests): |
|
135 |
# Each test class is either standalone or testing for some combination
|
|
136 |
# of transport or branch. Use the right adpater (or none) depending on
|
|
137 |
# the class.
|
|
138 |
if is_testing_for_transports(test_class): |
|
139 |
result.addTests(transport_adapter.adapt(test_class)) |
|
140 |
elif is_testing_for_branches(test_class): |
|
141 |
result.addTests(branch_adapter.adapt(test_class)) |
|
142 |
result.addTests(branch_adapter_for_ss.adapt(test_class)) |
|
143 |
else: |
|
144 |
result.addTest(test_class) |
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
145 |
return result |
146 |
||
147 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
148 |
class UploadUtilsMixin(object): |
149 |
"""Helper class to write upload tests. |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
150 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
151 |
This class provides helpers to simplify test writing. The emphasis is on
|
152 |
easy test writing, so each tree modification is committed. This doesn't
|
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
153 |
preclude writing tests spawning several revisions to upload more complex
|
154 |
changes.
|
|
155 |
"""
|
|
156 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
157 |
upload_dir = 'upload' |
158 |
branch_dir = 'branch' |
|
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
159 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
160 |
def make_branch_and_working_tree(self): |
161 |
t = transport.get_transport(self.branch_dir) |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
162 |
t.ensure_base() |
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
163 |
branch = bzrdir.BzrDir.create_branch_convenience( |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
164 |
t.base, |
165 |
format=bzrdir.format_registry.make_bzrdir('default'), |
|
166 |
force_new_tree=False) |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
167 |
self.tree = branch.bzrdir.create_workingtree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
168 |
self.tree.commit('initial empty tree') |
169 |
||
170 |
def assertUpFileEqual(self, content, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
171 |
self.assertFileEqual(content, osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
172 |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
173 |
def assertUpPathModeEqual(self, path, expected_mode, base=upload_dir): |
174 |
# FIXME: the tests needing that assertion should depend on the server
|
|
175 |
# ability to handle chmod so that they don't fail (or be skipped)
|
|
176 |
# against servers that can't. Note that some bzrlib transports define
|
|
177 |
# _can_roundtrip_unix_modebits in a incomplete way, this property
|
|
178 |
# 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. |
179 |
full_path = osutils.pathjoin(base, path) |
180 |
st = os.stat(full_path) |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
181 |
mode = st.st_mode & 0777 |
182 |
if expected_mode == mode: |
|
183 |
return
|
|
184 |
raise AssertionError( |
|
185 |
'For path %s, mode is %s not %s' % |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
186 |
(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 |
187 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
188 |
def failIfUpFileExists(self, path, base=upload_dir): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
189 |
self.failIfExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
190 |
|
191 |
def failUnlessUpFileExists(self, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
192 |
self.failUnlessExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
193 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
194 |
def set_file_content(self, path, content, base=branch_dir): |
195 |
f = file(osutils.pathjoin(base, path), 'wb') |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
196 |
try: |
197 |
f.write(content) |
|
198 |
finally: |
|
199 |
f.close() |
|
200 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
201 |
def add_file(self, path, content, base=branch_dir): |
202 |
self.set_file_content(path, content, base) |
|
203 |
self.tree.add(path) |
|
204 |
self.tree.commit('add file %s' % path) |
|
205 |
||
206 |
def modify_file(self, path, content, base=branch_dir): |
|
207 |
self.set_file_content(path, content, base) |
|
208 |
self.tree.commit('modify file %s' % path) |
|
209 |
||
210 |
def chmod_file(self, path, mode, base=branch_dir): |
|
211 |
full_path = osutils.pathjoin(base, path) |
|
212 |
os.chmod(full_path, mode) |
|
213 |
self.tree.commit('change file %s mode to %s' % (path, oct(mode))) |
|
214 |
||
215 |
def delete_any(self, path, base=branch_dir): |
|
216 |
self.tree.remove([path], keep_files=False) |
|
217 |
self.tree.commit('delete %s' % path) |
|
218 |
||
219 |
def add_dir(self, path, base=branch_dir): |
|
220 |
os.mkdir(osutils.pathjoin(base, path)) |
|
221 |
self.tree.add(path) |
|
222 |
self.tree.commit('add directory %s' % path) |
|
223 |
||
224 |
def rename_any(self, old_path, new_path): |
|
225 |
self.tree.rename_one(old_path, new_path) |
|
226 |
self.tree.commit('rename %s into %s' % (old_path, new_path)) |
|
227 |
||
228 |
def transform_dir_into_file(self, path, content, base=branch_dir): |
|
229 |
osutils.delete_any(osutils.pathjoin(base, path)) |
|
230 |
self.set_file_content(path, content, base) |
|
231 |
self.tree.commit('change %s from dir to file' % path) |
|
232 |
||
233 |
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). |
234 |
# bzr can't handle that kind change in a single commit without an
|
235 |
# intervening bzr status (see bug #205636).
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
236 |
self.tree.remove([path], keep_files=False) |
237 |
os.mkdir(osutils.pathjoin(base, path)) |
|
238 |
self.tree.add(path) |
|
239 |
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. |
240 |
|
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
241 |
def _get_cmd_upload(self): |
242 |
upload = cmd_upload() |
|
243 |
# We don't want to use run_bzr here because redirected output are a
|
|
244 |
# pain to debug. But we need to provides a valid outf.
|
|
245 |
# XXX: Should a bug against bzr be filled about that ?
|
|
246 |
upload._setup_outf() |
|
247 |
return upload |
|
248 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
249 |
def do_full_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
250 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
251 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
252 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
253 |
kwargs['directory'] = self.branch_dir |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
254 |
kwargs['full'] = True |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
255 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
256 |
upload.run(up_url, *args, **kwargs) |
257 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
258 |
def do_incremental_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
259 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
260 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
261 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
262 |
kwargs['directory'] = self.branch_dir |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
263 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
264 |
upload.run(up_url, *args, **kwargs) |
265 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
266 |
|
267 |
class TestUploadMixin(UploadUtilsMixin): |
|
268 |
"""Helper class to share tests between full and incremental uploads.""" |
|
269 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
270 |
def test_create_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
271 |
self.make_branch_and_working_tree() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
272 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
273 |
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). |
274 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
275 |
self.do_upload() |
276 |
||
277 |
self.assertUpFileEqual('foo', 'hello') |
|
278 |
||
279 |
def test_create_file_in_subdir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
280 |
self.make_branch_and_working_tree() |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
281 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
282 |
self.add_dir('dir') |
283 |
self.add_file('dir/goodbye', 'baz') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
284 |
|
285 |
self.failIfUpFileExists('dir/goodbye') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
286 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
287 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
288 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
289 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
290 |
self.assertUpPathModeEqual('dir', 0775) |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
291 |
|
292 |
def test_modify_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
293 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
294 |
self.add_file('hello', 'foo') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
295 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
296 |
self.modify_file('hello', 'bar') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
297 |
|
298 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
299 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
300 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
301 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
302 |
self.assertUpFileEqual('bar', 'hello') |
303 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
304 |
def test_rename_one_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
305 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
306 |
self.add_file('hello', 'foo') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
307 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
308 |
self.rename_any('hello', 'goodbye') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
309 |
|
310 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
311 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
312 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
313 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
314 |
self.assertUpFileEqual('foo', 'goodbye') |
315 |
||
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
316 |
def test_rename_and_change_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
317 |
self.make_branch_and_working_tree() |
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
318 |
self.add_file('hello', 'foo') |
319 |
self.do_full_upload() |
|
320 |
self.rename_any('hello', 'goodbye') |
|
321 |
self.modify_file('goodbye', 'bar') |
|
322 |
||
323 |
self.assertUpFileEqual('foo', 'hello') |
|
324 |
||
325 |
self.do_upload() |
|
326 |
||
327 |
self.assertUpFileEqual('bar', 'goodbye') |
|
328 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
329 |
def test_rename_two_files(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
330 |
self.make_branch_and_working_tree() |
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
331 |
self.add_file('a', 'foo') |
332 |
self.add_file('b', 'qux') |
|
333 |
self.do_full_upload() |
|
334 |
# We rely on the assumption that bzr will topologically sort the
|
|
335 |
# renames which will cause a -> b to appear *before* b -> c
|
|
336 |
self.rename_any('b', 'c') |
|
337 |
self.rename_any('a', 'b') |
|
338 |
||
339 |
self.assertUpFileEqual('foo', 'a') |
|
340 |
self.assertUpFileEqual('qux', 'b') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
341 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
342 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
343 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
344 |
self.assertUpFileEqual('foo', 'b') |
345 |
self.assertUpFileEqual('qux', 'c') |
|
346 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
347 |
def test_upload_revision(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
348 |
self.make_branch_and_working_tree() # rev1 |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
349 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
350 |
self.add_file('hello', 'foo') # rev2 |
351 |
self.modify_file('hello', 'bar') # rev3 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
352 |
|
353 |
self.failIfUpFileExists('hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
354 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
355 |
revspec = revisionspec.RevisionSpec.from_string('2') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
356 |
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). |
357 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
358 |
self.assertUpFileEqual('foo', 'hello') |
359 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
360 |
def test_no_upload_when_changes(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
361 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
362 |
self.add_file('a', 'foo') |
363 |
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). |
364 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
365 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
366 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
367 |
def test_no_upload_when_conflicts(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
368 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
369 |
self.add_file('a', 'foo') |
370 |
self.run_bzr('branch branch other') |
|
371 |
self.modify_file('a', 'bar') |
|
372 |
other_tree = workingtree.WorkingTree.open('other') |
|
373 |
self.set_file_content('a', 'baz', 'other/') |
|
374 |
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). |
375 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
376 |
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). |
377 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
378 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
379 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
380 |
def test_change_file_into_dir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
381 |
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). |
382 |
self.add_file('hello', 'foo') |
383 |
self.do_full_upload() |
|
384 |
self.transform_file_into_dir('hello') |
|
385 |
self.add_file('hello/file', 'bar') |
|
386 |
||
387 |
self.assertUpFileEqual('foo', 'hello') |
|
388 |
||
389 |
self.do_upload() |
|
390 |
||
391 |
self.assertUpFileEqual('bar', 'hello/file') |
|
392 |
||
393 |
def test_change_dir_into_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
394 |
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). |
395 |
self.add_dir('hello') |
396 |
self.add_file('hello/file', 'foo') |
|
397 |
self.do_full_upload() |
|
398 |
self.delete_any('hello/file') |
|
399 |
self.transform_dir_into_file('hello', 'bar') |
|
400 |
||
401 |
self.assertUpFileEqual('foo', 'hello/file') |
|
402 |
||
403 |
self.do_upload() |
|
404 |
||
405 |
self.assertUpFileEqual('bar', 'hello') |
|
406 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
407 |
def test_make_file_executable(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
408 |
self.make_branch_and_working_tree() |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
409 |
self.add_file('hello', 'foo') |
410 |
self.chmod_file('hello', 0664) |
|
411 |
self.do_full_upload() |
|
412 |
self.chmod_file('hello', 0755) |
|
413 |
||
414 |
self.assertUpPathModeEqual('hello', 0664) |
|
415 |
||
416 |
self.do_upload() |
|
417 |
||
418 |
self.assertUpPathModeEqual('hello', 0775) |
|
419 |
||
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
420 |
def get_upload_auto(self): |
421 |
return get_upload_auto(self.tree.branch) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
422 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
423 |
def test_upload_auto(self): |
424 |
"""Test that upload --auto sets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
425 |
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. |
426 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
427 |
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. |
428 |
self.do_full_upload() |
429 |
self.assertUpFileEqual('foo', 'hello') |
|
430 |
self.assertFalse(self.get_upload_auto()) |
|
431 |
||
432 |
self.add_file('bye', 'bar') |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
433 |
self.do_full_upload(auto=True) |
|
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. |
434 |
self.assertUpFileEqual('bar', 'bye') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
435 |
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. |
436 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
437 |
# and check that it stays set until it is unset
|
|
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. |
438 |
self.add_file('again', 'baz') |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
439 |
self.do_full_upload() |
|
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. |
440 |
self.assertUpFileEqual('baz', 'again') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
441 |
self.assertTrue(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
442 |
|
443 |
def test_upload_noauto(self): |
|
444 |
"""Test that upload --no-auto unsets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
445 |
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. |
446 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
447 |
self.add_file('hello', 'foo') |
448 |
self.do_full_upload(auto=True) |
|
449 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
450 |
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. |
451 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
452 |
self.add_file('bye', 'bar') |
453 |
self.do_full_upload(auto=False) |
|
454 |
self.assertUpFileEqual('bar', 'bye') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
455 |
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. |
456 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
457 |
# and check that it stays unset until it is set
|
458 |
self.add_file('again', 'baz') |
|
459 |
self.do_full_upload() |
|
460 |
self.assertUpFileEqual('baz', 'again') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
461 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
462 |
|
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
463 |
def test_upload_from_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
464 |
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. |
465 |
self.build_tree(['branch/foo/', 'branch/foo/bar']) |
466 |
self.tree.add(['foo/', 'foo/bar']) |
|
467 |
self.tree.commit("Add directory") |
|
468 |
self.do_full_upload(directory='branch/foo') |
|
469 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
470 |
|
471 |
class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
472 |
||
473 |
do_upload = TestUploadMixin.do_full_upload |
|
474 |
||
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
475 |
def test_full_upload_empty_tree(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
476 |
self.make_branch_and_working_tree() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
477 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
478 |
self.do_full_upload() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
479 |
|
|
0.155.1
by James Westby
Switch most of the logic to a class outside of the command class. |
480 |
self.failUnlessUpFileExists(BzrUploader.bzr_upload_revid_file_name) |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
481 |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
482 |
def test_invalid_revspec(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
483 |
self.make_branch_and_working_tree() |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
484 |
rev1 = revisionspec.RevisionSpec.from_string('1') |
485 |
rev2 = revisionspec.RevisionSpec.from_string('2') |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
486 |
|
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
487 |
self.assertRaises(errors.BzrCommandError, |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
488 |
self.do_incremental_upload, revision=[rev1, rev2]) |
489 |
||
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
490 |
def test_create_remote_dir_twice(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
491 |
self.make_branch_and_working_tree() |
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
492 |
self.add_dir('dir') |
493 |
self.do_full_upload() |
|
494 |
self.add_file('dir/goodbye', 'baz') |
|
495 |
||
496 |
self.failIfUpFileExists('dir/goodbye') |
|
497 |
||
498 |
self.do_full_upload() |
|
499 |
||
500 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
501 |
self.assertUpPathModeEqual('dir', 0775) |
|
502 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
503 |
|
504 |
class TestIncrementalUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
505 |
||
506 |
do_upload = TestUploadMixin.do_incremental_upload |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
507 |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
508 |
# XXX: full upload doesn't handle deletions....
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
509 |
|
510 |
def test_delete_one_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
511 |
self.make_branch_and_working_tree() |
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
512 |
self.add_file('hello', 'foo') |
513 |
self.do_full_upload() |
|
514 |
self.delete_any('hello') |
|
515 |
||
516 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
517 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
518 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
519 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
520 |
self.failIfUpFileExists('hello') |
521 |
||
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
522 |
def test_delete_dir_and_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
523 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
524 |
self.add_dir('dir') |
525 |
self.add_dir('dir/subdir') |
|
526 |
self.add_file('dir/subdir/a', 'foo') |
|
527 |
self.do_full_upload() |
|
528 |
self.rename_any('dir/subdir/a', 'a') |
|
529 |
self.delete_any('dir/subdir') |
|
530 |
self.delete_any('dir') |
|
531 |
||
532 |
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). |
533 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
534 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
535 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
536 |
self.failIfUpFileExists('dir/subdir/a') |
537 |
self.failIfUpFileExists('dir/subdir') |
|
538 |
self.failIfUpFileExists('dir') |
|
539 |
self.assertUpFileEqual('foo', 'a') |
|
540 |
||
541 |
def test_delete_one_file_rename_to_deleted(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
542 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
543 |
self.add_file('a', 'foo') |
544 |
self.add_file('b', 'bar') |
|
545 |
self.do_full_upload() |
|
546 |
self.delete_any('a') |
|
547 |
self.rename_any('b', 'a') |
|
548 |
||
549 |
self.assertUpFileEqual('foo', 'a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
550 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
551 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
552 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
553 |
self.failIfUpFileExists('b') |
554 |
self.assertUpFileEqual('bar', 'a') |
|
555 |
||
556 |
def test_rename_outside_dir_delete_dir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
557 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
558 |
self.add_dir('dir') |
559 |
self.add_file('dir/a', 'foo') |
|
560 |
self.do_full_upload() |
|
561 |
self.rename_any('dir/a', 'a') |
|
562 |
self.delete_any('dir') |
|
563 |
||
564 |
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). |
565 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
566 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
567 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
568 |
self.failIfUpFileExists('dir/a') |
569 |
self.failIfUpFileExists('dir') |
|
570 |
self.assertUpFileEqual('foo', 'a') |
|
571 |
||
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
572 |
def test_upload_for_the_first_time_do_a_full_upload(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
573 |
self.make_branch_and_working_tree() |
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
574 |
self.add_file('hello', 'bar') |
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
575 |
|
|
0.155.1
by James Westby
Switch most of the logic to a class outside of the command class. |
576 |
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). |
577 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
578 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
579 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
580 |
self.assertUpFileEqual('bar', 'hello') |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
581 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
582 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
583 |
class TestUploadFromRemote(TestUploadMixin): |
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
584 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
585 |
def do_full_upload(self, *args, **kwargs): |
|
0.158.15
by Vincent Ladeuil
Just use run_bzr to push. |
586 |
up_url = self.get_url(self.upload_dir) |
587 |
self.run_bzr(['push', up_url, '--directory=branch']) |
|
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
588 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
589 |
upload = self._get_cmd_upload() |
590 |
if kwargs.get('directory', None) is None: |
|
591 |
kwargs['directory'] = up_url |
|
592 |
kwargs['full'] = True |
|
593 |
kwargs['quiet'] = True |
|
594 |
upload.run(up_url, *args, **kwargs) |
|
595 |
||
596 |
def do_incremental_upload(self, *args, **kwargs): |
|
|
0.158.15
by Vincent Ladeuil
Just use run_bzr to push. |
597 |
up_url = self.get_url(self.upload_dir) |
598 |
self.run_bzr(['push', up_url, '--directory=branch']) |
|
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
599 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
600 |
upload = self._get_cmd_upload() |
601 |
if kwargs.get('directory', None) is None: |
|
602 |
kwargs['directory'] = up_url |
|
603 |
kwargs['quiet'] = True |
|
604 |
upload.run(up_url, *args, **kwargs) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
605 |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
606 |
def test_no_upload_when_changes(self): |
607 |
raise tests.TestNotApplicable() |
|
608 |
||
609 |
def test_no_upload_when_conflicts(self): |
|
610 |
raise tests.TestNotApplicable() |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
611 |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
612 |
remote_branch = None |
613 |
def get_upload_auto(self): |
|
614 |
if not self.remote_branch: |
|
615 |
self.remote_branch = branch.Branch.open_from_transport(\ |
|
616 |
self.get_transport(self.upload_dir)) |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
617 |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
618 |
return get_upload_auto(self.remote_branch) |
619 |
||
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
620 |
|
621 |
class TestFullUploadFromRemote(tests.TestCaseWithTransport, |
|
622 |
TestUploadFromRemote): |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
623 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
624 |
do_upload = TestUploadFromRemote.do_full_upload |
625 |
||
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
626 |
|
627 |
class TestIncrementalUploadFromRemote(tests.TestCaseWithTransport, |
|
628 |
TestUploadFromRemote): |
|
|
0.158.7
by Gary van der Merwe
Clean up white space. |
629 |
|
|
0.158.3
by Gary van der Merwe
Add test for upload from remote. Not working. |
630 |
do_upload = TestUploadFromRemote.do_incremental_upload |
|
0.153.1
by Vincent Ladeuil
Clean up references to verbose. |
631 |
|
|
0.158.13
by Vincent Ladeuil
Fix PEP8 violations. |
632 |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
633 |
class TestBranchUploadLocations(branch_implementations.TestCaseWithBranch): |
634 |
||
635 |
def test_get_upload_location_unset(self): |
|
636 |
config = self.get_branch().get_config() |
|
637 |
self.assertEqual(None, config.get_user_option('upload_location')) |
|
638 |
||
639 |
def test_get_push_location_exact(self): |
|
640 |
from bzrlib.config import (locations_config_filename, |
|
641 |
ensure_config_dir_exists) |
|
642 |
ensure_config_dir_exists() |
|
643 |
fn = locations_config_filename() |
|
644 |
b = self.get_branch() |
|
645 |
open(fn, 'wt').write(("[%s]\n" |
|
646 |
"upload_location=foo\n" % |
|
647 |
b.base[:-1])) |
|
648 |
config = b.get_config() |
|
649 |
self.assertEqual("foo", config.get_user_option('upload_location')) |
|
650 |
||
651 |
def test_set_push_location(self): |
|
652 |
config = self.get_branch().get_config() |
|
653 |
config.set_user_option('upload_location', 'foo') |
|
654 |
self.assertEqual('foo', config.get_user_option('upload_location')) |
|
655 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
656 |
|
657 |
class TestUploadFromRemoteBranch(tests.TestCaseWithTransport, |
|
658 |
UploadUtilsMixin): |
|
659 |
||
660 |
def test_no_upload_to_remote_working_tree(self): |
|
661 |
self.make_branch_and_working_tree() |
|
662 |
self.add_file('hello', 'foo') |
|
663 |
||
664 |
remote_branch_url = self.get_url('remote_branch') |
|
665 |
self.run_bzr(['push', remote_branch_url, |
|
666 |
'--directory', self.branch_dir]) |
|
667 |
||
668 |
# Now, let's try to upload from the just created remote branch into the
|
|
669 |
# branch (with has a working tree).
|
|
670 |
upload = self._get_cmd_upload() |
|
671 |
up_url = self.get_url(self.branch_dir) |
|
672 |
self.assertRaises(CannotUploadToWT, |
|
673 |
upload.run, up_url, directory=remote_branch_url) |
|
674 |
||
675 |
# Tests from remote branch:
|
|
676 |
# - smoke test
|
|
677 |
# - works without a working tree
|