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