bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.152.71
by Vincent Ladeuil
Fix failing tests. |
1 |
# Copyright (C) 2008, 2009, 2010 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.32
by Vincent Ladeuil
Restore verbose as the default mode. |
18 |
import sys |
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
19 |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
20 |
|
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
21 |
from bzrlib import ( |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
22 |
bzrdir, |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
23 |
config, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
24 |
errors, |
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
25 |
osutils, |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
26 |
revisionspec, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
27 |
tests, |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
28 |
transport, |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
29 |
workingtree, |
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
30 |
uncommit, |
|
0.152.4
by v.ladeuil+lp at free
Implement a trivial implementation to make one test pass. |
31 |
)
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
32 |
from bzrlib.tests import ( |
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
33 |
per_branch, |
34 |
per_transport, |
|
|
0.152.71
by Vincent Ladeuil
Fix failing tests. |
35 |
stub_sftp, |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
36 |
)
|
|
0.152.65
by Vincent Ladeuil
Fix spurious failures. |
37 |
from bzrlib.transport import ( |
38 |
ftp, |
|
39 |
sftp, |
|
40 |
)
|
|
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
41 |
from bzrlib.plugins.upload import ( |
42 |
cmds, |
|
43 |
)
|
|
|
0.152.1
by Vincent Ladeuil
Empty shell |
44 |
|
45 |
||
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
46 |
def get_transport_scenarios(): |
47 |
result = [] |
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
48 |
basis = per_transport.transport_test_permutations() |
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
49 |
# Keep only the interesting ones for upload
|
|
0.152.59
by Vincent Ladeuil
Make the test suite pass, but not the nearly empty one :). |
50 |
for name, d in basis: |
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
51 |
t_class = d['transport_class'] |
|
0.152.65
by Vincent Ladeuil
Fix spurious failures. |
52 |
if t_class in (ftp.FtpTransport, sftp.SFTPTransport): |
53 |
result.append((name, d)) |
|
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
54 |
try: |
55 |
import bzrlib.plugins.local_test_server |
|
56 |
from bzrlib.plugins.local_test_server import test_server |
|
57 |
if False: |
|
58 |
# XXX: Disable since we can't get chmod working for anonymous
|
|
59 |
# user
|
|
60 |
scenario = ('vsftpd', |
|
61 |
{'transport_class': test_server.FtpTransport, |
|
62 |
'transport_server': test_server.Vsftpd, |
|
63 |
})
|
|
64 |
result.append(scenario) |
|
65 |
from test_server import ProftpdFeature |
|
66 |
if ProftpdFeature().available(): |
|
67 |
scenario = ('proftpd', |
|
68 |
{'transport_class': test_server.FtpTransport, |
|
69 |
'transport_server': test_server.Proftpd, |
|
70 |
})
|
|
71 |
result.append(scenario) |
|
72 |
# XXX: add support for pyftpdlib
|
|
73 |
except ImportError: |
|
74 |
pass
|
|
75 |
return result |
|
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
76 |
|
77 |
||
78 |
def load_tests(standard_tests, module, loader): |
|
79 |
"""Multiply tests for tranport implementations.""" |
|
80 |
result = loader.suiteClass() |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
81 |
|
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
82 |
# one for each transport implementation
|
83 |
t_tests, remaining_tests = tests.split_suite_by_condition( |
|
84 |
standard_tests, tests.condition_isinstance(( |
|
85 |
TestFullUpload, |
|
86 |
TestIncrementalUpload, |
|
87 |
TestUploadFromRemoteBranch, |
|
88 |
)))
|
|
89 |
tests.multiply_tests(t_tests, get_transport_scenarios(), result) |
|
90 |
||
91 |
# one for each branch format
|
|
92 |
b_tests, remaining_tests = tests.split_suite_by_condition( |
|
93 |
remaining_tests, tests.condition_isinstance(( |
|
94 |
TestBranchUploadLocations, |
|
95 |
)))
|
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
96 |
tests.multiply_tests(b_tests, per_branch.branch_scenarios(), |
|
0.152.58
by Vincent Ladeuil
Make the test suite pass again catchiing up bzr.dev changes. |
97 |
result) |
98 |
||
99 |
# No parametrization for the remaining tests
|
|
100 |
result.addTests(remaining_tests) |
|
101 |
||
|
0.152.6
by Vincent Ladeuil
Really use the transports and test against all targeted protocols. |
102 |
return result |
103 |
||
104 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
105 |
class UploadUtilsMixin(object): |
106 |
"""Helper class to write upload tests. |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
107 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
108 |
This class provides helpers to simplify test writing. The emphasis is on
|
109 |
easy test writing, so each tree modification is committed. This doesn't
|
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
110 |
preclude writing tests spawning several revisions to upload more complex
|
111 |
changes.
|
|
112 |
"""
|
|
113 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
114 |
upload_dir = 'upload' |
115 |
branch_dir = 'branch' |
|
|
0.152.2
by v.ladeuil+lp at free
Add failing tests for basic usage. |
116 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
117 |
def make_branch_and_working_tree(self): |
118 |
t = transport.get_transport(self.branch_dir) |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
119 |
t.ensure_base() |
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
120 |
branch = bzrdir.BzrDir.create_branch_convenience( |
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
121 |
t.base, |
122 |
format=bzrdir.format_registry.make_bzrdir('default'), |
|
123 |
force_new_tree=False) |
|
|
0.158.11
by Gary van der Merwe
Revert revision 57: Go back to using the cmd_object. |
124 |
self.tree = branch.bzrdir.create_workingtree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
125 |
self.tree.commit('initial empty tree') |
126 |
||
127 |
def assertUpFileEqual(self, content, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
128 |
self.assertFileEqual(content, osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
129 |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
130 |
def assertUpPathModeEqual(self, path, expected_mode, base=upload_dir): |
131 |
# FIXME: the tests needing that assertion should depend on the server
|
|
132 |
# ability to handle chmod so that they don't fail (or be skipped)
|
|
133 |
# against servers that can't. Note that some bzrlib transports define
|
|
134 |
# _can_roundtrip_unix_modebits in a incomplete way, this property
|
|
135 |
# should depend on both the client and the server, not the client only.
|
|
|
0.152.57
by Vincent Ladeuil
Fix minor 2.4 compatibility bug. |
136 |
# But the client will know or can find if the server support chmod so
|
137 |
# that's the client that will report it anyway.
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
138 |
full_path = osutils.pathjoin(base, path) |
139 |
st = os.stat(full_path) |
|
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
140 |
mode = st.st_mode & 0777 |
141 |
if expected_mode == mode: |
|
142 |
return
|
|
143 |
raise AssertionError( |
|
144 |
'For path %s, mode is %s not %s' % |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
145 |
(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 |
146 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
147 |
def failIfUpFileExists(self, path, base=upload_dir): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
148 |
self.failIfExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
149 |
|
150 |
def failUnlessUpFileExists(self, path, base=upload_dir): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
151 |
self.failUnlessExists(osutils.pathjoin(base, path)) |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
152 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
153 |
def set_file_content(self, path, content, base=branch_dir): |
154 |
f = file(osutils.pathjoin(base, path), 'wb') |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
155 |
try: |
156 |
f.write(content) |
|
157 |
finally: |
|
158 |
f.close() |
|
159 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
160 |
def add_file(self, path, content, base=branch_dir): |
161 |
self.set_file_content(path, content, base) |
|
162 |
self.tree.add(path) |
|
163 |
self.tree.commit('add file %s' % path) |
|
164 |
||
165 |
def modify_file(self, path, content, base=branch_dir): |
|
166 |
self.set_file_content(path, content, base) |
|
167 |
self.tree.commit('modify file %s' % path) |
|
168 |
||
169 |
def chmod_file(self, path, mode, base=branch_dir): |
|
170 |
full_path = osutils.pathjoin(base, path) |
|
171 |
os.chmod(full_path, mode) |
|
172 |
self.tree.commit('change file %s mode to %s' % (path, oct(mode))) |
|
173 |
||
174 |
def delete_any(self, path, base=branch_dir): |
|
175 |
self.tree.remove([path], keep_files=False) |
|
176 |
self.tree.commit('delete %s' % path) |
|
177 |
||
178 |
def add_dir(self, path, base=branch_dir): |
|
179 |
os.mkdir(osutils.pathjoin(base, path)) |
|
180 |
self.tree.add(path) |
|
181 |
self.tree.commit('add directory %s' % path) |
|
182 |
||
183 |
def rename_any(self, old_path, new_path): |
|
184 |
self.tree.rename_one(old_path, new_path) |
|
185 |
self.tree.commit('rename %s into %s' % (old_path, new_path)) |
|
186 |
||
187 |
def transform_dir_into_file(self, path, content, base=branch_dir): |
|
188 |
osutils.delete_any(osutils.pathjoin(base, path)) |
|
189 |
self.set_file_content(path, content, base) |
|
190 |
self.tree.commit('change %s from dir to file' % path) |
|
191 |
||
192 |
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). |
193 |
# bzr can't handle that kind change in a single commit without an
|
194 |
# intervening bzr status (see bug #205636).
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
195 |
self.tree.remove([path], keep_files=False) |
196 |
os.mkdir(osutils.pathjoin(base, path)) |
|
197 |
self.tree.add(path) |
|
198 |
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. |
199 |
|
|
0.162.1
by Vincent Ladeuil
Emit warnings instead of crashing when symlinks are encountered |
200 |
def add_symlink(self, path, target, base=branch_dir): |
201 |
self.requireFeature(tests.SymlinkFeature) |
|
202 |
os.symlink(target, osutils.pathjoin(base, path)) |
|
203 |
self.tree.add(path) |
|
204 |
self.tree.commit('add symlink %s -> %s' % (path, target)) |
|
205 |
||
206 |
def modify_symlink(self, path, target, base=branch_dir): |
|
207 |
self.requireFeature(tests.SymlinkFeature) |
|
208 |
full_path = osutils.pathjoin(base, path) |
|
209 |
os.unlink(full_path) |
|
210 |
os.symlink(target, full_path) |
|
211 |
self.tree.commit('modify symlink %s -> %s' % (path, target)) |
|
212 |
||
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
213 |
def _get_cmd_upload(self): |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
214 |
cmd = cmds.cmd_upload() |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
215 |
# We don't want to use run_bzr here because redirected output are a
|
216 |
# pain to debug. But we need to provides a valid outf.
|
|
217 |
# XXX: Should a bug against bzr be filled about that ?
|
|
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
218 |
|
219 |
# Short story: we don't expect any output so we may just use stdout
|
|
220 |
cmd.outf = sys.stdout |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
221 |
return cmd |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
222 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
223 |
def do_full_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
224 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
225 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
226 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
227 |
kwargs['directory'] = self.branch_dir |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
228 |
kwargs['full'] = True |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
229 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
230 |
upload.run(up_url, *args, **kwargs) |
231 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
232 |
def do_incremental_upload(self, *args, **kwargs): |
|
0.152.32
by Vincent Ladeuil
Restore verbose as the default mode. |
233 |
upload = self._get_cmd_upload() |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
234 |
up_url = self.get_url(self.upload_dir) |
|
0.152.11
by Vincent Ladeuil
Be coherent with bzr push. |
235 |
if kwargs.get('directory', None) is None: |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
236 |
kwargs['directory'] = self.branch_dir |
|
0.152.34
by Martin Albisetti
* Change the default behaviour to be more verbose |
237 |
kwargs['quiet'] = True |
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
238 |
upload.run(up_url, *args, **kwargs) |
239 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
240 |
|
241 |
class TestUploadMixin(UploadUtilsMixin): |
|
242 |
"""Helper class to share tests between full and incremental uploads.""" |
|
243 |
||
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
244 |
def _test_create_file(self, file_name): |
245 |
self.make_branch_and_working_tree() |
|
246 |
self.do_full_upload() |
|
247 |
self.add_file(file_name, 'foo') |
|
248 |
||
249 |
self.do_upload() |
|
250 |
||
251 |
self.assertUpFileEqual('foo', file_name) |
|
252 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
253 |
def test_create_file(self): |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
254 |
self._test_create_file('hello') |
255 |
||
256 |
def test_unicode_create_file(self): |
|
|
0.163.1
by Vincent Ladeuil
Make tests requiring a unicode file system skip where applicable |
257 |
self.requireFeature(tests.UnicodeFilenameFeature) |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
258 |
self._test_create_file(u'hell\u00d8') |
259 |
||
260 |
def _test_create_file_in_dir(self, dir_name, file_name): |
|
261 |
self.make_branch_and_working_tree() |
|
262 |
self.do_full_upload() |
|
263 |
self.add_dir(dir_name) |
|
264 |
fpath = '%s/%s' % (dir_name, file_name) |
|
265 |
self.add_file(fpath, 'baz') |
|
266 |
||
267 |
self.failIfUpFileExists(fpath) |
|
268 |
||
269 |
self.do_upload() |
|
270 |
||
271 |
self.assertUpFileEqual('baz', fpath) |
|
272 |
self.assertUpPathModeEqual(dir_name, 0775) |
|
273 |
||
274 |
def test_create_file_in_dir(self): |
|
275 |
self._test_create_file_in_dir('dir', 'goodbye') |
|
276 |
||
277 |
def test_unicode_create_file_in_dir(self): |
|
|
0.163.1
by Vincent Ladeuil
Make tests requiring a unicode file system skip where applicable |
278 |
self.requireFeature(tests.UnicodeFilenameFeature) |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
279 |
self._test_create_file_in_dir(u'dir\u00d8', u'goodbye\u00d8') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
280 |
|
281 |
def test_modify_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
282 |
self.make_branch_and_working_tree() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
283 |
self.add_file('hello', 'foo') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
284 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
285 |
self.modify_file('hello', 'bar') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
286 |
|
287 |
self.assertUpFileEqual('foo', 'hello') |
|
|
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.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
290 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
291 |
self.assertUpFileEqual('bar', 'hello') |
292 |
||
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
293 |
def _test_rename_one_file(self, old_name, new_name): |
294 |
self.make_branch_and_working_tree() |
|
295 |
self.add_file(old_name, 'foo') |
|
296 |
self.do_full_upload() |
|
297 |
self.rename_any(old_name, new_name) |
|
298 |
||
299 |
self.assertUpFileEqual('foo', old_name) |
|
300 |
||
301 |
self.do_upload() |
|
302 |
||
303 |
self.assertUpFileEqual('foo', new_name) |
|
304 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
305 |
def test_rename_one_file(self): |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
306 |
self._test_rename_one_file('hello', 'goodbye') |
307 |
||
308 |
def test_unicode_rename_one_file(self): |
|
|
0.163.1
by Vincent Ladeuil
Make tests requiring a unicode file system skip where applicable |
309 |
self.requireFeature(tests.UnicodeFilenameFeature) |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
310 |
self._test_rename_one_file(u'hello\u00d8', u'goodbye\u00d8') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
311 |
|
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
312 |
def test_rename_and_change_file(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
313 |
self.make_branch_and_working_tree() |
|
0.152.52
by Vincent Ladeuil
Fix bug #270219 by handling content changes during renames. |
314 |
self.add_file('hello', 'foo') |
315 |
self.do_full_upload() |
|
316 |
self.rename_any('hello', 'goodbye') |
|
317 |
self.modify_file('goodbye', 'bar') |
|
318 |
||
319 |
self.assertUpFileEqual('foo', 'hello') |
|
320 |
||
321 |
self.do_upload() |
|
322 |
||
323 |
self.assertUpFileEqual('bar', 'goodbye') |
|
324 |
||
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
325 |
def test_rename_two_files(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
326 |
self.make_branch_and_working_tree() |
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
327 |
self.add_file('a', 'foo') |
328 |
self.add_file('b', 'qux') |
|
329 |
self.do_full_upload() |
|
330 |
# We rely on the assumption that bzr will topologically sort the
|
|
331 |
# renames which will cause a -> b to appear *before* b -> c
|
|
332 |
self.rename_any('b', 'c') |
|
333 |
self.rename_any('a', 'b') |
|
334 |
||
335 |
self.assertUpFileEqual('foo', 'a') |
|
336 |
self.assertUpFileEqual('qux', 'b') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
337 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
338 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
339 |
|
|
0.152.16
by Vincent Ladeuil
Handle renames. Robust implementation. |
340 |
self.assertUpFileEqual('foo', 'b') |
341 |
self.assertUpFileEqual('qux', 'c') |
|
342 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
343 |
def test_upload_revision(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
344 |
self.make_branch_and_working_tree() # rev1 |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
345 |
self.do_full_upload() |
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
346 |
self.add_file('hello', 'foo') # rev2 |
347 |
self.modify_file('hello', 'bar') # rev3 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
348 |
|
349 |
self.failIfUpFileExists('hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
350 |
|
|
0.152.15
by Vincent Ladeuil
Simplify test writing (for good ?). |
351 |
revspec = revisionspec.RevisionSpec.from_string('2') |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
352 |
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). |
353 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
354 |
self.assertUpFileEqual('foo', 'hello') |
355 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
356 |
def test_no_upload_when_changes(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
357 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
358 |
self.add_file('a', 'foo') |
359 |
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). |
360 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
361 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
362 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
363 |
def test_no_upload_when_conflicts(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
364 |
self.make_branch_and_working_tree() |
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
365 |
self.add_file('a', 'foo') |
366 |
self.run_bzr('branch branch other') |
|
367 |
self.modify_file('a', 'bar') |
|
368 |
other_tree = workingtree.WorkingTree.open('other') |
|
369 |
self.set_file_content('a', 'baz', 'other/') |
|
370 |
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). |
371 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
372 |
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). |
373 |
|
|
0.152.33
by Vincent Ladeuil
Ensure that we refuse to upload if the working tree contains |
374 |
self.assertRaises(errors.UncommittedChanges, self.do_upload) |
375 |
||
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
376 |
def _test_change_file_into_dir(self, file_name): |
377 |
self.make_branch_and_working_tree() |
|
378 |
self.add_file(file_name, 'foo') |
|
379 |
self.do_full_upload() |
|
380 |
self.transform_file_into_dir(file_name) |
|
381 |
fpath = '%s/%s' % (file_name, 'file') |
|
382 |
self.add_file(fpath, 'bar') |
|
383 |
||
384 |
self.assertUpFileEqual('foo', file_name) |
|
385 |
||
386 |
self.do_upload() |
|
387 |
||
388 |
self.assertUpFileEqual('bar', fpath) |
|
389 |
||
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
390 |
def test_change_file_into_dir(self): |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
391 |
self._test_change_file_into_dir('hello') |
392 |
||
393 |
def test_unicode_change_file_into_dir(self): |
|
|
0.163.1
by Vincent Ladeuil
Make tests requiring a unicode file system skip where applicable |
394 |
self.requireFeature(tests.UnicodeFilenameFeature) |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
395 |
self._test_change_file_into_dir(u'hello\u00d8') |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
396 |
|
397 |
def test_change_dir_into_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
398 |
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). |
399 |
self.add_dir('hello') |
400 |
self.add_file('hello/file', 'foo') |
|
401 |
self.do_full_upload() |
|
402 |
self.delete_any('hello/file') |
|
403 |
self.transform_dir_into_file('hello', 'bar') |
|
404 |
||
405 |
self.assertUpFileEqual('foo', 'hello/file') |
|
406 |
||
407 |
self.do_upload() |
|
408 |
||
409 |
self.assertUpFileEqual('bar', 'hello') |
|
410 |
||
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
411 |
def _test_make_file_executable(self, file_name): |
412 |
self.make_branch_and_working_tree() |
|
413 |
self.add_file(file_name, 'foo') |
|
414 |
self.chmod_file(file_name, 0664) |
|
415 |
self.do_full_upload() |
|
416 |
self.chmod_file(file_name, 0755) |
|
417 |
||
418 |
self.assertUpPathModeEqual(file_name, 0664) |
|
419 |
||
420 |
self.do_upload() |
|
421 |
||
422 |
self.assertUpPathModeEqual(file_name, 0775) |
|
423 |
||
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
424 |
def test_make_file_executable(self): |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
425 |
self._test_make_file_executable('hello') |
426 |
||
427 |
def test_unicode_make_file_executable(self): |
|
|
0.163.1
by Vincent Ladeuil
Make tests requiring a unicode file system skip where applicable |
428 |
self.requireFeature(tests.UnicodeFilenameFeature) |
|
0.152.70
by Vincent Ladeuil
Ensure we use the transport API correctly for unicode paths. |
429 |
self._test_make_file_executable(u'hello\u00d8') |
|
0.152.46
by Vincent Ladeuil
Handle x mode bit for files and provides default mode bits for |
430 |
|
|
0.162.1
by Vincent Ladeuil
Emit warnings instead of crashing when symlinks are encountered |
431 |
def test_create_symlink(self): |
432 |
self.make_branch_and_working_tree() |
|
433 |
self.do_full_upload() |
|
434 |
self.add_symlink('link', 'target') |
|
435 |
||
436 |
self.do_upload() |
|
437 |
||
438 |
self.failIfUpFileExists('link') |
|
439 |
||
440 |
def test_rename_symlink(self): |
|
441 |
self.make_branch_and_working_tree() |
|
442 |
old_name, new_name = 'old-link', 'new-link' |
|
443 |
self.add_symlink(old_name, 'target') |
|
444 |
self.do_full_upload() |
|
445 |
self.rename_any(old_name, new_name) |
|
446 |
||
447 |
self.do_upload() |
|
448 |
||
449 |
self.failIfUpFileExists(old_name) |
|
450 |
self.failIfUpFileExists(new_name) |
|
451 |
||
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
452 |
def get_upload_auto(self): |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
453 |
return cmds.get_upload_auto(self.tree.branch) |
|
0.158.7
by Gary van der Merwe
Clean up white space. |
454 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
455 |
def test_upload_auto(self): |
456 |
"""Test that upload --auto sets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
457 |
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. |
458 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
459 |
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. |
460 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
461 |
self.do_full_upload(auto=True) |
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
462 |
self.assertUpFileEqual('foo', 'hello') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
463 |
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. |
464 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
465 |
# and check that it stays set until it is unset
|
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
466 |
self.add_file('bye', 'bar') |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
467 |
self.do_full_upload() |
|
0.158.21
by Vincent Ladeuil
Revert test while keeping Gary's refactoring. |
468 |
self.assertUpFileEqual('bar', 'bye') |
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
469 |
self.assertTrue(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
470 |
|
471 |
def test_upload_noauto(self): |
|
472 |
"""Test that upload --no-auto unsets the upload_auto option""" |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
473 |
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. |
474 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
475 |
self.add_file('hello', 'foo') |
476 |
self.do_full_upload(auto=True) |
|
477 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
478 |
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. |
479 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
480 |
self.add_file('bye', 'bar') |
481 |
self.do_full_upload(auto=False) |
|
482 |
self.assertUpFileEqual('bar', 'bye') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
483 |
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. |
484 |
|
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
485 |
# and check that it stays unset until it is set
|
486 |
self.add_file('again', 'baz') |
|
487 |
self.do_full_upload() |
|
488 |
self.assertUpFileEqual('baz', 'again') |
|
|
0.158.6
by Gary van der Merwe
Correctly test auto when testing remote branches. |
489 |
self.assertFalse(self.get_upload_auto()) |
|
0.155.4
by James Westby
Add the groundwork for --auto that enables the hook for a branch. |
490 |
|
|
0.156.1
by James Westby
Use open_containing rather than open, so that you can upload from a subdir. |
491 |
def test_upload_from_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
492 |
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. |
493 |
self.build_tree(['branch/foo/', 'branch/foo/bar']) |
494 |
self.tree.add(['foo/', 'foo/bar']) |
|
495 |
self.tree.commit("Add directory") |
|
496 |
self.do_full_upload(directory='branch/foo') |
|
497 |
||
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
498 |
def test_upload_revid_path_in_dir(self): |
499 |
self.make_branch_and_working_tree() |
|
500 |
self.add_dir('dir') |
|
501 |
self.add_file('dir/goodbye', 'baz') |
|
502 |
||
503 |
revid_path = 'dir/revid-path' |
|
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
504 |
cmds.set_upload_revid_location(self.tree.branch, revid_path) |
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
505 |
self.failIfUpFileExists(revid_path) |
506 |
||
507 |
self.do_full_upload() |
|
508 |
||
509 |
self.add_file('dir/hello', 'foo') |
|
510 |
||
511 |
self.do_upload() |
|
512 |
||
513 |
self.failUnlessUpFileExists(revid_path) |
|
514 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
515 |
self.assertUpFileEqual('foo', 'dir/hello') |
|
516 |
||
|
0.160.1
by Martin Albisetti
Wrote the test first. TDD, dont fail me now. |
517 |
def test_ignore_file(self): |
518 |
self.make_branch_and_working_tree() |
|
519 |
self.do_full_upload() |
|
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
520 |
self.add_file('.bzrignore-upload', 'foo') |
521 |
self.add_file('foo', 'bar') |
|
522 |
||
523 |
self.do_upload() |
|
524 |
||
525 |
self.failIfUpFileExists('foo') |
|
526 |
||
527 |
def test_ignore_regexp(self): |
|
528 |
self.make_branch_and_working_tree() |
|
529 |
self.do_full_upload() |
|
530 |
self.add_file('.bzrignore-upload', 'f*') |
|
|
0.160.1
by Martin Albisetti
Wrote the test first. TDD, dont fail me now. |
531 |
self.add_file('foo', 'bar') |
532 |
||
533 |
self.do_upload() |
|
534 |
||
535 |
self.failIfUpFileExists('foo') |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
536 |
|
|
0.160.11
by Martin Albisetti
Add test for ignoring a dir |
537 |
def test_ignore_directory(self): |
538 |
self.make_branch_and_working_tree() |
|
539 |
self.do_full_upload() |
|
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
540 |
self.add_file('.bzrignore-upload', 'dir') |
|
0.160.11
by Martin Albisetti
Add test for ignoring a dir |
541 |
self.add_dir('dir') |
542 |
||
543 |
self.do_upload() |
|
544 |
||
545 |
self.failIfUpFileExists('dir') |
|
546 |
||
|
0.161.3
by Martin Albisetti
Write a test that verifies that nested files in ignored dirs dont get uploaded |
547 |
def test_ignore_nested_directory(self): |
548 |
self.make_branch_and_working_tree() |
|
549 |
self.do_full_upload() |
|
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
550 |
self.add_file('.bzrignore-upload', 'dir') |
|
0.161.3
by Martin Albisetti
Write a test that verifies that nested files in ignored dirs dont get uploaded |
551 |
self.add_dir('dir') |
552 |
self.add_dir('dir/foo') |
|
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
553 |
self.add_file('dir/foo/bar', 'bar contents') |
|
0.161.3
by Martin Albisetti
Write a test that verifies that nested files in ignored dirs dont get uploaded |
554 |
|
555 |
self.do_upload() |
|
556 |
||
557 |
self.failIfUpFileExists('dir') |
|
558 |
self.failIfUpFileExists('dir/foo/bar') |
|
559 |
||
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
560 |
def test_ignore_change_file_into_dir(self): |
561 |
self.make_branch_and_working_tree() |
|
562 |
self.add_file('hello', 'foo') |
|
563 |
self.do_full_upload() |
|
564 |
self.add_file('.bzrignore-upload', 'hello') |
|
565 |
self.transform_file_into_dir('hello') |
|
566 |
self.add_file('hello/file', 'bar') |
|
567 |
||
568 |
self.assertUpFileEqual('foo', 'hello') |
|
569 |
||
570 |
self.do_upload() |
|
571 |
||
572 |
self.assertUpFileEqual('foo', 'hello') |
|
573 |
||
574 |
def test_ignore_change_dir_into_file(self): |
|
575 |
self.make_branch_and_working_tree() |
|
576 |
self.add_dir('hello') |
|
577 |
self.add_file('hello/file', 'foo') |
|
578 |
self.do_full_upload() |
|
579 |
||
580 |
self.add_file('.bzrignore-upload', 'hello') |
|
581 |
self.delete_any('hello/file') |
|
582 |
self.transform_dir_into_file('hello', 'bar') |
|
583 |
||
584 |
self.assertUpFileEqual('foo', 'hello/file') |
|
585 |
||
586 |
self.do_upload() |
|
587 |
||
588 |
self.assertUpFileEqual('foo', 'hello/file') |
|
589 |
||
590 |
def test_ignore_delete_dir_in_subdir(self): |
|
591 |
self.make_branch_and_working_tree() |
|
592 |
self.add_dir('dir') |
|
593 |
self.add_dir('dir/subdir') |
|
594 |
self.add_file('dir/subdir/a', 'foo') |
|
595 |
self.do_full_upload() |
|
596 |
self.add_file('.bzrignore-upload', 'dir/subdir') |
|
597 |
self.rename_any('dir/subdir/a', 'dir/a') |
|
598 |
self.delete_any('dir/subdir') |
|
599 |
||
600 |
self.assertUpFileEqual('foo', 'dir/subdir/a') |
|
601 |
||
602 |
self.do_upload() |
|
603 |
||
604 |
# The file in the dir is not ignored. This a bit contrived but
|
|
605 |
# indicates that we may encounter problems when ignored items appear
|
|
606 |
# and disappear... -- vila 100106
|
|
607 |
self.assertUpFileEqual('foo', 'dir/a') |
|
608 |
||
|
0.160.4
by Martin Albisetti
Test passes! |
609 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
610 |
class TestFullUpload(tests.TestCaseWithTransport, TestUploadMixin): |
611 |
||
612 |
do_upload = TestUploadMixin.do_full_upload |
|
613 |
||
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
614 |
def test_full_upload_empty_tree(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
615 |
self.make_branch_and_working_tree() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
616 |
|
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
617 |
self.do_full_upload() |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
618 |
|
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
619 |
revid_path = cmds.get_upload_revid_location(self.tree.branch) |
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
620 |
self.failUnlessUpFileExists(revid_path) |
|
0.152.13
by Vincent Ladeuil
Test uploading an empty tree. |
621 |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
622 |
def test_invalid_revspec(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
623 |
self.make_branch_and_working_tree() |
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
624 |
rev1 = revisionspec.RevisionSpec.from_string('1') |
625 |
rev2 = revisionspec.RevisionSpec.from_string('2') |
|
|
0.152.8
by Vincent Ladeuil
Handle uploading directories. |
626 |
|
|
0.152.9
by Vincent Ladeuil
Recfactoring to simplify tests writing. |
627 |
self.assertRaises(errors.BzrCommandError, |
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
628 |
self.do_incremental_upload, revision=[rev1, rev2]) |
629 |
||
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
630 |
def test_create_remote_dir_twice(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
631 |
self.make_branch_and_working_tree() |
|
0.152.47
by Vincent Ladeuil
Don't fail a full upload on an already existing dir. |
632 |
self.add_dir('dir') |
633 |
self.do_full_upload() |
|
634 |
self.add_file('dir/goodbye', 'baz') |
|
635 |
||
636 |
self.failIfUpFileExists('dir/goodbye') |
|
637 |
||
638 |
self.do_full_upload() |
|
639 |
||
640 |
self.assertUpFileEqual('baz', 'dir/goodbye') |
|
641 |
self.assertUpPathModeEqual('dir', 0775) |
|
642 |
||
|
0.152.14
by Vincent Ladeuil
Handle renames (trivial implementation). |
643 |
|
644 |
class TestIncrementalUpload(tests.TestCaseWithTransport, TestUploadMixin): |
|
645 |
||
646 |
do_upload = TestUploadMixin.do_incremental_upload |
|
|
0.152.5
by v.ladeuil+lp at free
Partial incremental upload implementationm tests pass. |
647 |
|
|
0.152.19
by Vincent Ladeuil
Handle kind_change. Trivial implementation, blocked by bug #205636. |
648 |
# XXX: full upload doesn't handle deletions....
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
649 |
|
650 |
def test_delete_one_file(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
651 |
self.make_branch_and_working_tree() |
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
652 |
self.add_file('hello', 'foo') |
653 |
self.do_full_upload() |
|
654 |
self.delete_any('hello') |
|
655 |
||
656 |
self.assertUpFileEqual('foo', 'hello') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
657 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
658 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
659 |
|
|
0.152.17
by Vincent Ladeuil
Handle deletes (trivial implementation). |
660 |
self.failIfUpFileExists('hello') |
661 |
||
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
662 |
def test_delete_dir_and_subdir(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
663 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
664 |
self.add_dir('dir') |
665 |
self.add_dir('dir/subdir') |
|
666 |
self.add_file('dir/subdir/a', 'foo') |
|
667 |
self.do_full_upload() |
|
668 |
self.rename_any('dir/subdir/a', 'a') |
|
669 |
self.delete_any('dir/subdir') |
|
670 |
self.delete_any('dir') |
|
671 |
||
672 |
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). |
673 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
674 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
675 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
676 |
self.failIfUpFileExists('dir/subdir/a') |
677 |
self.failIfUpFileExists('dir/subdir') |
|
678 |
self.failIfUpFileExists('dir') |
|
679 |
self.assertUpFileEqual('foo', 'a') |
|
680 |
||
681 |
def test_delete_one_file_rename_to_deleted(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
682 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
683 |
self.add_file('a', 'foo') |
684 |
self.add_file('b', 'bar') |
|
685 |
self.do_full_upload() |
|
686 |
self.delete_any('a') |
|
687 |
self.rename_any('b', 'a') |
|
688 |
||
689 |
self.assertUpFileEqual('foo', 'a') |
|
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
690 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
691 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
692 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
693 |
self.failIfUpFileExists('b') |
694 |
self.assertUpFileEqual('bar', 'a') |
|
695 |
||
696 |
def test_rename_outside_dir_delete_dir(self): |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
697 |
self.make_branch_and_working_tree() |
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
698 |
self.add_dir('dir') |
699 |
self.add_file('dir/a', 'foo') |
|
700 |
self.do_full_upload() |
|
701 |
self.rename_any('dir/a', 'a') |
|
702 |
self.delete_any('dir') |
|
703 |
||
704 |
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). |
705 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
706 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
707 |
|
|
0.152.18
by Vincent Ladeuil
Handle deletions. Robust implementation. |
708 |
self.failIfUpFileExists('dir/a') |
709 |
self.failIfUpFileExists('dir') |
|
710 |
self.assertUpFileEqual('foo', 'a') |
|
711 |
||
|
0.162.1
by Vincent Ladeuil
Emit warnings instead of crashing when symlinks are encountered |
712 |
def test_delete_symlink(self): |
713 |
self.make_branch_and_working_tree() |
|
714 |
self.add_symlink('link', 'target') |
|
715 |
self.do_full_upload() |
|
716 |
self.delete_any('link') |
|
717 |
||
718 |
self.do_upload() |
|
719 |
||
720 |
self.failIfUpFileExists('link') |
|
721 |
||
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
722 |
def test_upload_for_the_first_time_do_a_full_upload(self): |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
723 |
self.make_branch_and_working_tree() |
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
724 |
self.add_file('hello', 'bar') |
|
0.152.31
by Vincent Ladeuil
Cosmetic change. |
725 |
|
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
726 |
revid_path = cmds.get_upload_revid_location(self.tree.branch) |
|
0.152.62
by Vincent Ladeuil
Fix bug #423331 by adding a way to configure the path used to |
727 |
self.failIfUpFileExists(revid_path) |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
728 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
729 |
self.do_upload() |
|
0.152.44
by Vincent Ladeuil
More robust full upload (at least regarding files changed to dirs and vice-versa). |
730 |
|
|
0.152.25
by Martin Albisetti
Added test for uploading for the first time to a remote location |
731 |
self.assertUpFileEqual('bar', 'hello') |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
732 |
|
|
0.161.4
by Vincent Ladeuil
Handle regexps in .bzrignore-upload and take parents into account. |
733 |
def test_ignore_delete_one_file(self): |
734 |
self.make_branch_and_working_tree() |
|
735 |
self.add_file('hello', 'foo') |
|
736 |
self.do_full_upload() |
|
737 |
self.add_file('.bzrignore-upload', 'hello') |
|
738 |
self.delete_any('hello') |
|
739 |
||
740 |
self.assertUpFileEqual('foo', 'hello') |
|
741 |
||
742 |
self.do_upload() |
|
743 |
||
744 |
self.assertUpFileEqual('foo', 'hello') |
|
745 |
||
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
746 |
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
747 |
class TestBranchUploadLocations(per_branch.TestCaseWithBranch): |
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
748 |
|
749 |
def test_get_upload_location_unset(self): |
|
750 |
config = self.get_branch().get_config() |
|
751 |
self.assertEqual(None, config.get_user_option('upload_location')) |
|
752 |
||
753 |
def test_get_push_location_exact(self): |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
754 |
config.ensure_config_dir_exists() |
755 |
fn = config.locations_config_filename() |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
756 |
b = self.get_branch() |
757 |
open(fn, 'wt').write(("[%s]\n" |
|
758 |
"upload_location=foo\n" % |
|
759 |
b.base[:-1])) |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
760 |
conf = b.get_config() |
761 |
self.assertEqual("foo", conf.get_user_option('upload_location')) |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
762 |
|
763 |
def test_set_push_location(self): |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
764 |
conf = self.get_branch().get_config() |
765 |
conf.set_user_option('upload_location', 'foo') |
|
766 |
self.assertEqual('foo', conf.get_user_option('upload_location')) |
|
|
0.152.12
by Vincent Ladeuil
Implement 'upload_location' in config files. |
767 |
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
768 |
|
769 |
class TestUploadFromRemoteBranch(tests.TestCaseWithTransport, |
|
770 |
UploadUtilsMixin): |
|
771 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
772 |
remote_branch_dir = 'remote_branch' |
773 |
||
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
774 |
def setUp(self): |
775 |
super(TestUploadFromRemoteBranch, self).setUp() |
|
776 |
self.remote_branch_url = self.make_remote_branch_without_working_tree() |
|
777 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
778 |
def make_remote_branch_without_working_tree(self): |
779 |
"""Creates a branch without working tree to upload from. |
|
780 |
||
781 |
It's created from the existing self.branch_dir one which still has its
|
|
782 |
working tree.
|
|
783 |
"""
|
|
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
784 |
self.make_branch_and_working_tree() |
785 |
self.add_file('hello', 'foo') |
|
786 |
||
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
787 |
remote_branch_url = self.get_url(self.remote_branch_dir) |
|
0.152.71
by Vincent Ladeuil
Fix failing tests. |
788 |
if self.transport_server is stub_sftp.SFTPHomeDirServer: |
|
0.152.65
by Vincent Ladeuil
Fix spurious failures. |
789 |
# FIXME: Some policy search ends up above the user home directory
|
790 |
# and are seen as attemps to escape test isolation
|
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
791 |
raise tests.TestNotApplicable('Escaping test isolation') |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
792 |
self.run_bzr(['push', remote_branch_url, |
793 |
'--directory', self.branch_dir]) |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
794 |
return remote_branch_url |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
795 |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
796 |
def test_no_upload_to_remote_working_tree(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
797 |
cmd = self._get_cmd_upload() |
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
798 |
up_url = self.get_url(self.branch_dir) |
799 |
# Let's try to upload from the just created remote branch into the
|
|
|
0.152.60
by Vincent Ladeuil
bzr.dev has finish renaming the tests modules. |
800 |
# branch (which has a working tree).
|
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
801 |
self.assertRaises(cmds.CannotUploadToWorkingTree, |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
802 |
cmd.run, up_url, directory=self.remote_branch_url) |
|
0.158.16
by Vincent Ladeuil
Start refactoring for remote branch tests. |
803 |
|
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
804 |
def test_upload_without_working_tree(self): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
805 |
self.do_full_upload(directory=self.remote_branch_url) |
|
0.158.17
by Vincent Ladeuil
New remote branch test. |
806 |
self.assertUpFileEqual('foo', 'hello') |
807 |
||
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
808 |
|
|
0.164.1
by Vincent Ladeuil
Add a test to cover bug #600628 but it is already fixed. |
809 |
class TestUploadDiverged(tests.TestCaseWithTransport, UploadUtilsMixin): |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
810 |
|
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
811 |
def setUp(self): |
812 |
super(TestUploadDiverged, self).setUp() |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
813 |
self.diverged_tree = self.make_diverged_tree_and_upload_location() |
814 |
||
815 |
def make_diverged_tree_and_upload_location(self): |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
816 |
tree_a = self.make_branch_and_tree('tree_a') |
817 |
tree_a.commit('message 1', rev_id='rev1') |
|
818 |
tree_a.commit('message 2', rev_id='rev2a') |
|
819 |
tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree() |
|
820 |
uncommit.uncommit(tree_b.branch, tree=tree_b) |
|
821 |
tree_b.commit('message 2', rev_id='rev2b') |
|
822 |
# upload tree a
|
|
823 |
self.do_full_upload(directory=tree_a.basedir) |
|
824 |
return tree_b |
|
825 |
||
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
826 |
def assertRevidUploaded(self, revid): |
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
827 |
t = self.get_transport(self.upload_dir) |
828 |
uploaded_revid = t.get_bytes('.bzr-upload.revid') |
|
829 |
self.assertEqual(revid, uploaded_revid) |
|
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
830 |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
831 |
def test_cant_upload_diverged(self): |
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
832 |
self.assertRaises(cmds.DivergedUploadedTree, |
|
0.152.68
by Vincent Ladeuil
Cleanup some pending changes. |
833 |
self.do_incremental_upload, |
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
834 |
directory=self.diverged_tree.basedir) |
835 |
self.assertRevidUploaded('rev2a') |
|
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
836 |
|
837 |
def test_upload_diverged_with_overwrite(self): |
|
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
838 |
self.do_incremental_upload(directory=self.diverged_tree.basedir, |
|
0.159.3
by Gary van der Merwe
Write tests for checking of diverged uploads. |
839 |
overwrite=True) |
|
0.159.5
by Gary van der Merwe
Some small changes to the tests as per review. |
840 |
self.assertRevidUploaded('rev2b') |
|
0.164.1
by Vincent Ladeuil
Add a test to cover bug #600628 but it is already fixed. |
841 |
|
842 |
||
843 |
class TestUploadBadRemoteReivd(tests.TestCaseWithTransport, UploadUtilsMixin): |
|
844 |
||
845 |
def test_raises_on_wrong_revid(self): |
|
846 |
tree = self.make_branch_and_working_tree() |
|
847 |
self.do_full_upload() |
|
848 |
# Put a fake revid on the remote branch
|
|
849 |
t = self.get_transport(self.upload_dir) |
|
850 |
t.put_bytes('.bzr-upload.revid', 'fake') |
|
851 |
# Make a change
|
|
852 |
self.add_file('foo', 'bar\n') |
|
|
0.165.1
by Jelmer Vernooij
Support lazily loading. |
853 |
self.assertRaises(cmds.DivergedUploadedTree, self.do_full_upload) |
|
0.164.1
by Vincent Ladeuil
Add a test to cover bug #600628 but it is already fixed. |
854 |