Merge lp:~jelmer/brz/more-foreign-3 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 6852
Proposed branch: lp:~jelmer/brz/more-foreign-3
Merge into: lp:brz
Diff against target: 299 lines (+71/-69)
10 files modified
breezy/tests/per_branch/test_branch.py (+1/-1)
breezy/tests/per_tree/__init__.py (+8/-15)
breezy/tests/per_tree/test_test_trees.py (+21/-31)
breezy/tests/per_tree/test_walkdirs.py (+7/-7)
breezy/tests/per_workingtree/test_mkdir.py (+10/-3)
breezy/tests/per_workingtree/test_move.py (+5/-2)
breezy/tests/per_workingtree/test_parents.py (+1/-4)
breezy/tests/per_workingtree/test_paths2ids.py (+2/-0)
breezy/tests/per_workingtree/test_rename_one.py (+5/-2)
breezy/tests/per_workingtree/test_smart_add.py (+11/-4)
To merge this branch: bzr merge lp:~jelmer/brz/more-foreign-3
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+337115@code.launchpad.net

Description of the change

More foreign branch test fixes.

This brings the number of brz-git test failures down to 338.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/per_branch/test_branch.py'
2--- breezy/tests/per_branch/test_branch.py 2017-11-21 00:34:39 +0000
3+++ breezy/tests/per_branch/test_branch.py 2018-02-03 13:43:32 +0000
4@@ -644,7 +644,7 @@
5 try:
6 this_branch._format.set_reference(this_branch.controldir, None,
7 other_branch)
8- except NotImplementedError:
9+ except (NotImplementedError, errors.IncompatibleFormat):
10 # that's ok
11 pass
12 else:
13
14=== modified file 'breezy/tests/per_tree/__init__.py'
15--- breezy/tests/per_tree/__init__.py 2017-10-08 02:49:53 +0000
16+++ breezy/tests/per_tree/__init__.py 2018-02-03 13:43:32 +0000
17@@ -246,13 +246,13 @@
18 by breezy.osutils.has_symlinks() function.
19
20 The returned tree has the following inventory:
21- [('', inventory.ROOT_ID),
22- ('0file', '2file'),
23- ('1top-dir', '1top-dir'),
24- (u'2utf\u1234file', u'0utf\u1234file'),
25- ('symlink', 'symlink'), # only if symlinks arg is True
26- ('1top-dir/0file-in-1topdir', '1file-in-1topdir'),
27- ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir')]
28+ ['',
29+ '0file',
30+ '1top-dir',
31+ u'2utf\u1234file',
32+ 'symlink', # only if symlinks arg is True
33+ '1top-dir/0file-in-1topdir',
34+ '1top-dir/1dir-in-1topdir']
35 where each component has the type of its name -
36 i.e. '1file..' is afile.
37
38@@ -267,15 +267,8 @@
39 '1top-dir/0file-in-1topdir',
40 '1top-dir/1dir-in-1topdir/'
41 ]
42- ids = [
43- '2file',
44- '1top-dir',
45- u'0utf\u1234file'.encode('utf8'),
46- '1file-in-1topdir',
47- '0dir-in-1topdir'
48- ]
49 self.build_tree(paths)
50- tree.add(paths, ids)
51+ tree.add(paths)
52 tt = transform.TreeTransform(tree)
53 if symlinks:
54 root_transaction_id = tt.trans_id_tree_path('')
55
56=== modified file 'breezy/tests/per_tree/test_test_trees.py'
57--- breezy/tests/per_tree/test_test_trees.py 2018-01-12 08:52:43 +0000
58+++ breezy/tests/per_tree/test_test_trees.py 2018-02-03 13:43:32 +0000
59@@ -163,26 +163,21 @@
60 # __iter__ has no strongly defined order
61 tree_root = tree.path2id('')
62 self.assertEqual(
63- {tree_root,
64- '2file',
65- '1top-dir',
66- '1file-in-1topdir',
67- '0dir-in-1topdir',
68- u'0utf\u1234file'.encode('utf8'),
69- 'symlink',
70- },
71+ {tree.path2id(p) for p in [
72+ '', '0file', '1top-dir', '1top-dir/1dir-in-1topdir',
73+ '1top-dir/0file-in-1topdir', 'symlink', u'2utf\u1234file']},
74 set(tree.all_file_ids()))
75 # note that the order of the paths and fileids is deliberately
76 # mismatched to ensure that the result order is path based.
77 self.assertEqual(
78- [('', tree_root, 'directory'),
79- ('0file', '2file', 'file'),
80- ('1top-dir', '1top-dir', 'directory'),
81- (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
82- ('symlink', 'symlink', 'symlink'),
83- ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
84- ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
85- [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
86+ [('', 'directory'),
87+ ('0file', 'file'),
88+ ('1top-dir', 'directory'),
89+ (u'2utf\u1234file', 'file'),
90+ ('symlink', 'symlink'),
91+ ('1top-dir/0file-in-1topdir', 'file'),
92+ ('1top-dir/1dir-in-1topdir', 'directory')],
93+ [(path, node.kind) for path, node in tree.iter_entries_by_dir()])
94
95 def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
96 # currently this test tree requires unicode. It might be good
97@@ -197,24 +192,19 @@
98 # __iter__ has no strongly defined order
99 tree_root = tree.path2id('')
100 self.assertEqual(
101- {tree_root,
102- '2file',
103- '1top-dir',
104- '1file-in-1topdir',
105- '0dir-in-1topdir',
106- u'0utf\u1234file'.encode('utf8'),
107- },
108- set(tree.all_file_ids()))
109+ {'', '0file', '1top-dir', '1top-dir/0file-in-1topdir',
110+ '1top-dir/1dir-in-1topdir', u'2utf\u1234file'},
111+ set(tree.all_versioned_paths()))
112 # note that the order of the paths and fileids is deliberately
113 # mismatched to ensure that the result order is path based.
114 self.assertEqual(
115- [('', tree_root, 'directory'),
116- ('0file', '2file', 'file'),
117- ('1top-dir', '1top-dir', 'directory'),
118- (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
119- ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
120- ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
121- [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
122+ [('', 'directory'),
123+ ('0file', 'file'),
124+ ('1top-dir', 'directory'),
125+ (u'2utf\u1234file', 'file'),
126+ ('1top-dir/0file-in-1topdir', 'file'),
127+ ('1top-dir/1dir-in-1topdir', 'directory')],
128+ [(path, node.kind) for path, node in tree.iter_entries_by_dir()])
129
130 def test_tree_with_utf8(self):
131 tree = self.make_branch_and_tree('.')
132
133=== modified file 'breezy/tests/per_tree/test_walkdirs.py'
134--- breezy/tests/per_tree/test_walkdirs.py 2017-10-08 02:49:53 +0000
135+++ breezy/tests/per_tree/test_walkdirs.py 2018-02-03 13:43:32 +0000
136@@ -28,19 +28,19 @@
137 def get_all_subdirs_expected(self, tree, symlinks):
138 dirblocks = [
139 (('', tree.path2id('')),
140- [('0file', '0file', 'file', None, '2file', 'file'),
141+ [('0file', '0file', 'file', None, tree.path2id('0file'), 'file'),
142 ('1top-dir', '1top-dir', 'directory', None,
143- '1top-dir', 'directory'),
144+ tree.path2id('1top-dir'), 'directory'),
145 (u'2utf\u1234file', u'2utf\u1234file', 'file', None,
146- u'0utf\u1234file'.encode('utf8'), 'file'),
147+ tree.path2id(u'2utf\u1234file'), 'file'),
148 ]),
149- (('1top-dir', '1top-dir'),
150+ (('1top-dir', tree.path2id('1top-dir')),
151 [('1top-dir/0file-in-1topdir', '0file-in-1topdir',
152- 'file', None, '1file-in-1topdir', 'file'),
153+ 'file', None, tree.path2id('1top-dir/0file-in-1topdir'), 'file'),
154 ('1top-dir/1dir-in-1topdir', '1dir-in-1topdir',
155- 'directory', None, '0dir-in-1topdir', 'directory'),
156+ 'directory', None, tree.path2id('1top-dir/1dir-in-1topdir'), 'directory'),
157 ]),
158- (('1top-dir/1dir-in-1topdir', '0dir-in-1topdir'),
159+ (('1top-dir/1dir-in-1topdir', tree.path2id('1top-dir/1dir-in-1topdir')),
160 []),
161 ]
162 if symlinks:
163
164=== modified file 'breezy/tests/per_workingtree/test_mkdir.py'
165--- breezy/tests/per_workingtree/test_mkdir.py 2017-11-12 20:07:32 +0000
166+++ breezy/tests/per_workingtree/test_mkdir.py 2018-02-03 13:43:32 +0000
167@@ -19,6 +19,8 @@
168
169 from breezy.tests.per_workingtree import TestCaseWithWorkingTree
170
171+from breezy.workingtree import SettingFileIdUnsupported
172+
173
174 class TestMkdir(TestCaseWithWorkingTree):
175
176@@ -33,6 +35,11 @@
177 t = self.make_branch_and_tree('t1')
178 t.lock_write()
179 self.addCleanup(t.unlock)
180- file_id = t.mkdir('path', 'my-id')
181- self.assertEqual('my-id', file_id)
182- self.assertEqual('directory', t.kind('path', file_id))
183+ if not t.supports_setting_file_ids():
184+ self.assertRaises(
185+ SettingFileIdUnsupported,
186+ t.mkdir, 'path', 'my-id')
187+ else:
188+ file_id = t.mkdir('path', 'my-id')
189+ self.assertEqual('my-id', file_id)
190+ self.assertEqual('directory', t.kind('path', file_id))
191
192=== modified file 'breezy/tests/per_workingtree/test_move.py'
193--- breezy/tests/per_workingtree/test_move.py 2018-01-22 01:01:48 +0000
194+++ breezy/tests/per_workingtree/test_move.py 2018-02-03 13:43:32 +0000
195@@ -105,8 +105,11 @@
196 self.build_tree(['a/', 'b'])
197 tree.add(['b'])
198 tree.commit('initial')
199- self.assertRaises(errors.BzrMoveFailedError,
200- tree.move, ['b'], 'a')
201+ if tree.has_versioned_directories():
202+ self.assertRaises(errors.BzrMoveFailedError,
203+ tree.move, ['b'], 'a')
204+ else:
205+ tree.move(['b'], 'a')
206 tree._validate()
207
208 def test_move_unversioned(self):
209
210=== modified file 'breezy/tests/per_workingtree/test_parents.py'
211--- breezy/tests/per_workingtree/test_parents.py 2018-01-15 06:07:39 +0000
212+++ breezy/tests/per_workingtree/test_parents.py 2018-02-03 13:43:32 +0000
213@@ -430,8 +430,7 @@
214 def get_file(self, path, file_id=None):
215 return BytesIO(self.get_file_text(path, file_id))
216
217- tree.lock_write()
218- try:
219+ with tree.lock_write():
220 if shape.root.revision is None:
221 shape.root.revision = revid
222 builder = tree.branch.get_commit_builder(
223@@ -449,8 +448,6 @@
224 base_tree.get_revision_id(), changes))
225 builder.finish_inventory()
226 builder.commit("Message")
227- finally:
228- tree.unlock()
229
230 def add_entry(self, inv, rev_id, entry):
231 entry.revision = rev_id
232
233=== modified file 'breezy/tests/per_workingtree/test_paths2ids.py'
234--- breezy/tests/per_workingtree/test_paths2ids.py 2018-01-22 01:01:48 +0000
235+++ breezy/tests/per_workingtree/test_paths2ids.py 2018-02-03 13:43:32 +0000
236@@ -172,6 +172,8 @@
237 # should not raise an error: it must be unversioned in *all* trees to
238 # error.
239 tree = self.make_branch_and_tree('tree')
240+ if not tree.supports_setting_file_ids():
241+ raise TestNotApplicable('tree does not support setting file ids')
242 tree.commit('make basis')
243 basis = tree.basis_tree()
244 self.build_tree(['tree/in-one'])
245
246=== modified file 'breezy/tests/per_workingtree/test_rename_one.py'
247--- breezy/tests/per_workingtree/test_rename_one.py 2017-11-13 18:40:41 +0000
248+++ breezy/tests/per_workingtree/test_rename_one.py 2018-02-03 13:43:32 +0000
249@@ -61,8 +61,11 @@
250 self.build_tree(['a/', 'b'])
251 tree.add(['b'])
252 tree.commit('initial')
253- self.assertRaises(errors.BzrMoveFailedError,
254- tree.rename_one, 'b', 'a/b')
255+ if tree.has_versioned_directories():
256+ self.assertRaises(errors.BzrMoveFailedError,
257+ tree.rename_one, 'b', 'a/b')
258+ else:
259+ tree.rename_one('b', 'a/b')
260
261 def test_rename_one_unversioned(self):
262 tree = self.make_branch_and_tree('.')
263
264=== modified file 'breezy/tests/per_workingtree/test_smart_add.py'
265--- breezy/tests/per_workingtree/test_smart_add.py 2017-11-12 13:53:51 +0000
266+++ breezy/tests/per_workingtree/test_smart_add.py 2018-02-03 13:43:32 +0000
267@@ -25,6 +25,7 @@
268 osutils,
269 tests,
270 trace,
271+ workingtree,
272 )
273 from ...sixish import (
274 BytesIO,
275@@ -259,14 +260,20 @@
276 self.build_tree(['file1', 'dir1/', 'dir1/file2'])
277
278 wt = self.make_branch_and_tree('.')
279+ if not wt._format.supports_setting_file_ids:
280+ self.assertRaises(
281+ workingtree.SettingFileIdUnsupported,
282+ wt.smart_add, ['.'], action=action)
283+ return
284+
285 wt.smart_add(['.'], action=action)
286 # The order of adds is not strictly fixed:
287 sio.seek(0)
288 lines = sorted(sio.readlines())
289- self.assertEqualDiff(['added dir1 with id directory-dir1\n',
290- 'added dir1/file2 with id file-dir1%file2\n',
291- 'added file1 with id file-file1\n',
292- ], lines)
293+ self.assertEqual(['added dir1 with id directory-dir1\n',
294+ 'added dir1/file2 with id file-dir1%file2\n',
295+ 'added file1 with id file-file1\n', ]
296+ , lines)
297 wt.lock_read()
298 self.addCleanup(wt.unlock)
299 self.assertEqual([('', wt.path2id('')),

Subscribers

People subscribed via source and target branches