Merge lp:~jelmer/brz/move-bzr-tests into lp:brz/3.1
- move-bzr-tests
- Merge into 3.1
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/move-bzr-tests |
Merge into: | lp:brz/3.1 |
Diff against target: |
1192 lines (+239/-198) 29 files modified
breezy/bzr/bundle/serializer/v4.py (+1/-1) breezy/bzr/chk_serializer.py (+3/-2) breezy/bzr/dirstate.py (+1/-1) breezy/bzr/groupcompress.py (+7/-5) breezy/bzr/inventory.py (+12/-3) breezy/bzr/knit.py (+12/-10) breezy/bzr/serializer.py (+22/-1) breezy/bzr/tests/__init__.py (+1/-0) breezy/bzr/tests/per_versionedfile.py (+7/-5) breezy/bzr/tests/test_inv.py (+10/-0) breezy/bzr/tests/test_versionedfile.py (+10/-0) breezy/bzr/tests/test_workingtree.py (+33/-0) breezy/bzr/tests/test_xml.py (+6/-5) breezy/bzr/versionedfile.py (+29/-12) breezy/bzr/vf_repository.py (+1/-1) breezy/bzr/weave.py (+3/-2) breezy/bzr/workingtree.py (+12/-2) breezy/bzr/xml5.py (+1/-2) breezy/bzr/xml_serializer.py (+7/-7) breezy/errors.py (+0/-101) breezy/git/annotate.py (+1/-1) breezy/merge_directive.py (+11/-1) breezy/tests/per_workingtree/test_add.py (+2/-2) breezy/tests/per_workingtree/test_read_working_inventory.py (+2/-2) breezy/tests/test_conflicts.py (+2/-1) breezy/tests/test_errors.py (+0/-19) breezy/tests/test_shelf.py (+1/-4) breezy/tests/test_transform.py (+6/-5) breezy/transform.py (+36/-3) |
To merge this branch: | bzr merge lp:~jelmer/brz/move-bzr-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+386406@code.launchpad.net |
Commit message
Move some more tests to breezy.bzr.
Description of the change
Move some more tests to breezy.bzr.
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/bzr/bundle/serializer/v4.py' |
2 | --- breezy/bzr/bundle/serializer/v4.py 2020-02-09 02:41:42 +0000 |
3 | +++ breezy/bzr/bundle/serializer/v4.py 2020-06-26 01:36:03 +0000 |
4 | @@ -690,7 +690,7 @@ |
5 | delta = target_inv._make_delta(parent_inv) |
6 | self._repository.add_inventory_by_delta(parent_ids[0], |
7 | delta, revision_id, parent_ids) |
8 | - except errors.UnsupportedInventoryKind: |
9 | + except serializer.UnsupportedInventoryKind: |
10 | raise errors.IncompatibleRevision(repr(self._repository)) |
11 | inventory_cache[revision_id] = target_inv |
12 | |
13 | |
14 | === modified file 'breezy/bzr/chk_serializer.py' |
15 | --- breezy/bzr/chk_serializer.py 2020-01-31 10:39:02 +0000 |
16 | +++ breezy/bzr/chk_serializer.py 2020-06-26 01:36:03 +0000 |
17 | @@ -22,6 +22,7 @@ |
18 | lazy_import.lazy_import(globals(), |
19 | """ |
20 | from breezy.bzr import ( |
21 | + serializer, |
22 | xml_serializer, |
23 | ) |
24 | """) |
25 | @@ -183,7 +184,7 @@ |
26 | entry_cache=entry_cache, |
27 | return_from_cache=return_from_cache) |
28 | except xml_serializer.ParseError as e: |
29 | - raise errors.UnexpectedInventoryFormat(e) |
30 | + raise serializer.UnexpectedInventoryFormat(e) |
31 | |
32 | def read_inventory(self, f, revision_id=None): |
33 | """Read an inventory from a file-like object.""" |
34 | @@ -194,7 +195,7 @@ |
35 | finally: |
36 | f.close() |
37 | except xml_serializer.ParseError as e: |
38 | - raise errors.UnexpectedInventoryFormat(e) |
39 | + raise serializer.UnexpectedInventoryFormat(e) |
40 | |
41 | def write_inventory_to_lines(self, inv): |
42 | """Return a list of lines with the encoded inventory.""" |
43 | |
44 | === modified file 'breezy/bzr/dirstate.py' |
45 | --- breezy/bzr/dirstate.py 2019-09-21 17:08:09 +0000 |
46 | +++ breezy/bzr/dirstate.py 2020-06-26 01:36:03 +0000 |
47 | @@ -531,7 +531,7 @@ |
48 | file_id_entry[0][0], file_id_entry[0][1]) |
49 | kind = DirState._minikind_to_kind[file_id_entry[1][0][0]] |
50 | info = '%s:%s' % (kind, path) |
51 | - raise errors.DuplicateFileId(file_id, info) |
52 | + raise inventory.DuplicateFileId(file_id, info) |
53 | first_key = (dirname, basename, b'') |
54 | block_index, present = self._find_block_index_from_key(first_key) |
55 | if present: |
56 | |
57 | === modified file 'breezy/bzr/groupcompress.py' |
58 | --- breezy/bzr/groupcompress.py 2020-02-09 02:20:11 +0000 |
59 | +++ breezy/bzr/groupcompress.py 2020-06-26 01:36:03 +0000 |
60 | @@ -57,8 +57,10 @@ |
61 | adapter_registry, |
62 | AbsentContentFactory, |
63 | ChunkedContentFactory, |
64 | + ExistingContent, |
65 | FulltextContentFactory, |
66 | VersionedFilesWithFallbacks, |
67 | + UnavailableRepresentation, |
68 | ) |
69 | |
70 | # Minimum number of uncompressed bytes to try fetch at once when retrieving |
71 | @@ -490,7 +492,7 @@ |
72 | return self._chunks |
73 | else: |
74 | return osutils.chunks_to_lines(self._chunks) |
75 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
76 | + raise UnavailableRepresentation(self.key, storage_kind, |
77 | self.storage_kind) |
78 | |
79 | def iter_bytes_as(self, storage_kind): |
80 | @@ -500,7 +502,7 @@ |
81 | return iter(self._chunks) |
82 | elif storage_kind == 'lines': |
83 | return iter(osutils.chunks_to_lines(self._chunks)) |
84 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
85 | + raise UnavailableRepresentation(self.key, storage_kind, |
86 | self.storage_kind) |
87 | |
88 | |
89 | @@ -871,7 +873,7 @@ |
90 | """ |
91 | if length == 0: # empty, like a dir entry, etc |
92 | if nostore_sha == _null_sha1: |
93 | - raise errors.ExistingContent() |
94 | + raise ExistingContent() |
95 | return _null_sha1, 0, 0, 'fulltext' |
96 | # we assume someone knew what they were doing when they passed it in |
97 | if expected_sha is not None: |
98 | @@ -880,7 +882,7 @@ |
99 | sha1 = osutils.sha_strings(chunks) |
100 | if nostore_sha is not None: |
101 | if sha1 == nostore_sha: |
102 | - raise errors.ExistingContent() |
103 | + raise ExistingContent() |
104 | if key[-1] is None: |
105 | key = key[:-1] + (b'sha1:' + sha1,) |
106 | |
107 | @@ -1841,7 +1843,7 @@ |
108 | continue |
109 | try: |
110 | chunks = record.get_bytes_as('chunked') |
111 | - except errors.UnavailableRepresentation: |
112 | + except UnavailableRepresentation: |
113 | adapter_key = record.storage_kind, 'chunked' |
114 | adapter = get_adapter(adapter_key) |
115 | chunks = adapter.get_bytes(record, 'chunked') |
116 | |
117 | === modified file 'breezy/bzr/inventory.py' |
118 | --- breezy/bzr/inventory.py 2020-01-30 16:13:31 +0000 |
119 | +++ breezy/bzr/inventory.py 2020-06-26 01:36:03 +0000 |
120 | @@ -59,6 +59,16 @@ |
121 | from ..static_tuple import StaticTuple |
122 | |
123 | |
124 | +class DuplicateFileId(errors.BzrError): |
125 | + |
126 | + _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s" |
127 | + |
128 | + def __init__(self, file_id, entry): |
129 | + errors.BzrError.__init__(self) |
130 | + self.file_id = file_id |
131 | + self.entry = entry |
132 | + |
133 | + |
134 | class InventoryEntry(object): |
135 | """Description of a versioned file. |
136 | |
137 | @@ -1131,7 +1141,7 @@ |
138 | new_entry = replacement |
139 | try: |
140 | self.add(new_entry) |
141 | - except errors.DuplicateFileId: |
142 | + except DuplicateFileId: |
143 | raise errors.InconsistentDelta(new_path, new_entry.file_id, |
144 | "New id is already present in target.") |
145 | except AttributeError: |
146 | @@ -1233,8 +1243,7 @@ |
147 | :return: entry |
148 | """ |
149 | if entry.file_id in self._byid: |
150 | - raise errors.DuplicateFileId(entry.file_id, |
151 | - self._byid[entry.file_id]) |
152 | + raise DuplicateFileId(entry.file_id, self._byid[entry.file_id]) |
153 | if entry.parent_id is None: |
154 | self.root = entry |
155 | else: |
156 | |
157 | === modified file 'breezy/bzr/knit.py' |
158 | --- breezy/bzr/knit.py 2020-01-30 18:07:32 +0000 |
159 | +++ breezy/bzr/knit.py 2020-06-26 01:36:03 +0000 |
160 | @@ -107,7 +107,9 @@ |
161 | adapter_registry, |
162 | ConstantMapper, |
163 | ContentFactory, |
164 | + ExistingContent, |
165 | sort_groupcompress, |
166 | + UnavailableRepresentation, |
167 | VersionedFilesWithFallbacks, |
168 | ) |
169 | |
170 | @@ -225,7 +227,7 @@ |
171 | |
172 | def get_bytes(self, factory, target_storage_kind): |
173 | if target_storage_kind != 'knit-ft-gz': |
174 | - raise errors.UnavailableRepresentation( |
175 | + raise UnavailableRepresentation( |
176 | factory.key, target_storage_kind, factory.storage_kind) |
177 | annotated_compressed_bytes = factory._raw_record |
178 | rec, contents = \ |
179 | @@ -241,7 +243,7 @@ |
180 | |
181 | def get_bytes(self, factory, target_storage_kind): |
182 | if target_storage_kind != 'knit-delta-gz': |
183 | - raise errors.UnavailableRepresentation( |
184 | + raise UnavailableRepresentation( |
185 | factory.key, target_storage_kind, factory.storage_kind) |
186 | annotated_compressed_bytes = factory._raw_record |
187 | rec, contents = \ |
188 | @@ -266,7 +268,7 @@ |
189 | return b''.join(content.text()) |
190 | elif target_storage_kind in ('chunked', 'lines'): |
191 | return content.text() |
192 | - raise errors.UnavailableRepresentation( |
193 | + raise UnavailableRepresentation( |
194 | factory.key, target_storage_kind, factory.storage_kind) |
195 | |
196 | |
197 | @@ -295,7 +297,7 @@ |
198 | return b''.join(basis_content.text()) |
199 | elif target_storage_kind in ('chunked', 'lines'): |
200 | return basis_content.text() |
201 | - raise errors.UnavailableRepresentation( |
202 | + raise UnavailableRepresentation( |
203 | factory.key, target_storage_kind, factory.storage_kind) |
204 | |
205 | |
206 | @@ -312,7 +314,7 @@ |
207 | return b''.join(content.text()) |
208 | elif target_storage_kind in ('chunked', 'lines'): |
209 | return content.text() |
210 | - raise errors.UnavailableRepresentation( |
211 | + raise UnavailableRepresentation( |
212 | factory.key, target_storage_kind, factory.storage_kind) |
213 | |
214 | |
215 | @@ -340,7 +342,7 @@ |
216 | return b''.join(content.text()) |
217 | elif target_storage_kind in ('chunked', 'lines'): |
218 | return content.text() |
219 | - raise errors.UnavailableRepresentation( |
220 | + raise UnavailableRepresentation( |
221 | factory.key, target_storage_kind, factory.storage_kind) |
222 | |
223 | |
224 | @@ -418,7 +420,7 @@ |
225 | return self._knit.get_lines(self.key[0]) |
226 | elif storage_kind == 'fulltext': |
227 | return self._knit.get_text(self.key[0]) |
228 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
229 | + raise UnavailableRepresentation(self.key, storage_kind, |
230 | self.storage_kind) |
231 | |
232 | def iter_bytes_as(self, storage_kind): |
233 | @@ -466,7 +468,7 @@ |
234 | return chunks |
235 | else: |
236 | return b''.join(chunks) |
237 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
238 | + raise UnavailableRepresentation(self.key, storage_kind, |
239 | self.storage_kind) |
240 | |
241 | def iter_bytes_as(self, storage_kind): |
242 | @@ -1068,7 +1070,7 @@ |
243 | # that out. |
244 | digest = sha_string(line_bytes) |
245 | if nostore_sha == digest: |
246 | - raise errors.ExistingContent |
247 | + raise ExistingContent |
248 | |
249 | present_parents = [] |
250 | if parent_texts is None: |
251 | @@ -1793,7 +1795,7 @@ |
252 | try: |
253 | # Try getting a fulltext directly from the record. |
254 | lines = record.get_bytes_as('lines') |
255 | - except errors.UnavailableRepresentation: |
256 | + except UnavailableRepresentation: |
257 | adapter_key = record.storage_kind, 'lines' |
258 | adapter = get_adapter(adapter_key) |
259 | lines = adapter.get_bytes(record, 'lines') |
260 | |
261 | === modified file 'breezy/bzr/serializer.py' |
262 | --- breezy/bzr/serializer.py 2020-01-31 10:39:02 +0000 |
263 | +++ breezy/bzr/serializer.py 2020-06-26 01:36:03 +0000 |
264 | @@ -18,7 +18,28 @@ |
265 | |
266 | from __future__ import absolute_import |
267 | |
268 | -from .. import registry |
269 | +from .. import errors, registry |
270 | + |
271 | + |
272 | +class BadInventoryFormat(errors.BzrError): |
273 | + |
274 | + _fmt = "Root class for inventory serialization errors" |
275 | + |
276 | + |
277 | +class UnexpectedInventoryFormat(BadInventoryFormat): |
278 | + |
279 | + _fmt = "The inventory was not in the expected format:\n %(msg)s" |
280 | + |
281 | + def __init__(self, msg): |
282 | + BadInventoryFormat.__init__(self, msg=msg) |
283 | + |
284 | + |
285 | +class UnsupportedInventoryKind(errors.BzrError): |
286 | + |
287 | + _fmt = """Unsupported entry kind %(kind)s""" |
288 | + |
289 | + def __init__(self, kind): |
290 | + self.kind = kind |
291 | |
292 | |
293 | class Serializer(object): |
294 | |
295 | === modified file 'breezy/bzr/tests/__init__.py' |
296 | --- breezy/bzr/tests/__init__.py 2020-06-17 17:41:09 +0000 |
297 | +++ breezy/bzr/tests/__init__.py 2020-06-26 01:36:03 +0000 |
298 | @@ -84,6 +84,7 @@ |
299 | 'test_versionedfile', |
300 | 'test_vf_search', |
301 | 'test_vfs_ratchet', |
302 | + 'test_workingtree', |
303 | 'test_workingtree_4', |
304 | 'test_weave', |
305 | 'test_xml', |
306 | |
307 | === modified file 'breezy/bzr/tests/per_versionedfile.py' |
308 | --- breezy/bzr/tests/per_versionedfile.py 2020-06-12 17:33:41 +0000 |
309 | +++ breezy/bzr/tests/per_versionedfile.py 2020-06-26 01:36:03 +0000 |
310 | @@ -61,8 +61,10 @@ |
311 | from ..versionedfile import ( |
312 | ChunkedContentFactory, |
313 | ConstantMapper, |
314 | + ExistingContent, |
315 | HashEscapedPrefixMapper, |
316 | PrefixMapper, |
317 | + UnavailableRepresentation, |
318 | VirtualVersionedFiles, |
319 | make_versioned_files_factory, |
320 | ) |
321 | @@ -306,7 +308,7 @@ |
322 | # we now have a copy of all the lines in the vf. |
323 | for sha, (version, lines) in zip( |
324 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): |
325 | - self.assertRaises(errors.ExistingContent, |
326 | + self.assertRaises(ExistingContent, |
327 | vf.add_lines, version + b"2", [], lines, |
328 | nostore_sha=sha) |
329 | # and no new version should have been added. |
330 | @@ -331,7 +333,7 @@ |
331 | raise TestSkipped("add_lines_with_ghosts is optional") |
332 | for sha, (version, lines) in zip( |
333 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): |
334 | - self.assertRaises(errors.ExistingContent, |
335 | + self.assertRaises(ExistingContent, |
336 | vf.add_lines_with_ghosts, version + b"2", [], lines, |
337 | nostore_sha=sha) |
338 | # and no new version should have been added. |
339 | @@ -1647,10 +1649,10 @@ |
340 | for sha, (version, lines) in zip( |
341 | shas, (empty_text, sample_text_nl, sample_text_no_nl)): |
342 | new_key = self.get_simple_key(version + b"2") |
343 | - self.assertRaises(errors.ExistingContent, |
344 | + self.assertRaises(ExistingContent, |
345 | vf.add_lines, new_key, [], lines, |
346 | nostore_sha=sha) |
347 | - self.assertRaises(errors.ExistingContent, |
348 | + self.assertRaises(ExistingContent, |
349 | vf.add_lines, new_key, [], lines, |
350 | nostore_sha=sha) |
351 | # and no new version should have been added. |
352 | @@ -1985,7 +1987,7 @@ |
353 | factory.sha1) |
354 | self.assertEqual(parent_map[factory.key], factory.parents) |
355 | # currently no stream emits mpdiff |
356 | - self.assertRaises(errors.UnavailableRepresentation, |
357 | + self.assertRaises(UnavailableRepresentation, |
358 | factory.get_bytes_as, 'mpdiff') |
359 | self.assertIsInstance(factory.get_bytes_as(factory.storage_kind), |
360 | bytes) |
361 | |
362 | === modified file 'breezy/bzr/tests/test_inv.py' |
363 | --- breezy/bzr/tests/test_inv.py 2020-06-10 21:13:00 +0000 |
364 | +++ breezy/bzr/tests/test_inv.py 2020-06-26 01:36:03 +0000 |
365 | @@ -31,6 +31,7 @@ |
366 | ) |
367 | from ..inventory import ( |
368 | CHKInventory, |
369 | + DuplicateFileId, |
370 | Inventory, |
371 | ROOT_ID, |
372 | InventoryFile, |
373 | @@ -1601,3 +1602,12 @@ |
374 | inv.get_entry(b'thefileid').executable = True |
375 | self.assertFalse(tree.root_inventory.get_entry( |
376 | b'thefileid').executable) |
377 | + |
378 | + |
379 | +class ErrorTests(TestCase): |
380 | + |
381 | + def test_duplicate_file_id(self): |
382 | + error = DuplicateFileId('a_file_id', 'foo') |
383 | + self.assertEqualDiff( |
384 | + 'File id {a_file_id} already exists in inventory as foo', |
385 | + str(error)) |
386 | |
387 | === modified file 'breezy/bzr/tests/test_versionedfile.py' |
388 | --- breezy/bzr/tests/test_versionedfile.py 2020-06-10 02:56:53 +0000 |
389 | +++ breezy/bzr/tests/test_versionedfile.py 2020-06-26 01:36:03 +0000 |
390 | @@ -137,3 +137,13 @@ |
391 | multiparent.MultiParent([multiparent.NewText([b'first\n'])]), |
392 | ] |
393 | self.assertEqual(expected_diffs, diffs) |
394 | + |
395 | + |
396 | +class ErrorTests(tests.TestCase): |
397 | + |
398 | + def test_unavailable_representation(self): |
399 | + error = versionedfile.UnavailableRepresentation( |
400 | + ('key',), "mpdiff", "fulltext") |
401 | + self.assertEqualDiff("The encoding 'mpdiff' is not available for key " |
402 | + "('key',) which is encoded as 'fulltext'.", |
403 | + str(error)) |
404 | |
405 | === added file 'breezy/bzr/tests/test_workingtree.py' |
406 | --- breezy/bzr/tests/test_workingtree.py 1970-01-01 00:00:00 +0000 |
407 | +++ breezy/bzr/tests/test_workingtree.py 2020-06-26 01:36:03 +0000 |
408 | @@ -0,0 +1,33 @@ |
409 | +# Copyright (C) 2007-2012, 2016 Canonical Ltd |
410 | +# |
411 | +# This program is free software; you can redistribute it and/or modify |
412 | +# it under the terms of the GNU General Public License as published by |
413 | +# the Free Software Foundation; either version 2 of the License, or |
414 | +# (at your option) any later version. |
415 | +# |
416 | +# This program is distributed in the hope that it will be useful, |
417 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
418 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
419 | +# GNU General Public License for more details. |
420 | +# |
421 | +# You should have received a copy of the GNU General Public License |
422 | +# along with this program; if not, write to the Free Software |
423 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
424 | + |
425 | +"""Tests for InventoryWorkingTree""" |
426 | + |
427 | +from . import TestCase |
428 | + |
429 | +from ..workingtree import InventoryModified |
430 | + |
431 | + |
432 | +class ErrorTests(TestCase): |
433 | + |
434 | + def test_inventory_modified(self): |
435 | + error = InventoryModified("a tree to be repred") |
436 | + self.assertEqualDiff("The current inventory for the tree 'a tree to " |
437 | + "be repred' has been modified, so a clean inventory cannot be " |
438 | + "read without data loss.", |
439 | + str(error)) |
440 | + |
441 | + |
442 | |
443 | === modified file 'breezy/bzr/tests/test_xml.py' |
444 | --- breezy/bzr/tests/test_xml.py 2020-06-10 02:56:53 +0000 |
445 | +++ breezy/bzr/tests/test_xml.py 2020-06-26 01:36:03 +0000 |
446 | @@ -21,6 +21,7 @@ |
447 | ) |
448 | from .. import ( |
449 | inventory, |
450 | + serializer, |
451 | xml6, |
452 | xml7, |
453 | xml8, |
454 | @@ -409,10 +410,10 @@ |
455 | """Can't accidentally open a file with wrong serializer""" |
456 | s_v6 = breezy.bzr.xml6.serializer_v6 |
457 | s_v7 = xml7.serializer_v7 |
458 | - self.assertRaises(errors.UnexpectedInventoryFormat, |
459 | + self.assertRaises(serializer.UnexpectedInventoryFormat, |
460 | s_v7.read_inventory_from_lines, |
461 | breezy.osutils.split_lines(_expected_inv_v5)) |
462 | - self.assertRaises(errors.UnexpectedInventoryFormat, |
463 | + self.assertRaises(serializer.UnexpectedInventoryFormat, |
464 | s_v6.read_inventory_from_lines, |
465 | breezy.osutils.split_lines(_expected_inv_v7)) |
466 | |
467 | @@ -424,9 +425,9 @@ |
468 | inv.root.revision = b'root-rev' |
469 | inv.add(inventory.TreeReference(b'nested-id', 'nested', b'tree-root-321', |
470 | b'rev-outer', b'rev-inner')) |
471 | - self.assertRaises(errors.UnsupportedInventoryKind, |
472 | + self.assertRaises(serializer.UnsupportedInventoryKind, |
473 | s_v5.write_inventory_to_lines, inv) |
474 | - self.assertRaises(errors.UnsupportedInventoryKind, |
475 | + self.assertRaises(serializer.UnsupportedInventoryKind, |
476 | s_v6.write_inventory_to_lines, inv) |
477 | lines = s_v7.write_inventory_to_chunks(inv) |
478 | inv2 = s_v7.read_inventory_from_lines(lines) |
479 | @@ -528,7 +529,7 @@ |
480 | def test_serialization_error(self): |
481 | s_v5 = breezy.bzr.xml5.serializer_v5 |
482 | e = self.assertRaises( |
483 | - errors.UnexpectedInventoryFormat, |
484 | + serializer.UnexpectedInventoryFormat, |
485 | s_v5.read_inventory_from_lines, [b"<Notquitexml"]) |
486 | self.assertEqual(str(e), "unclosed token: line 1, column 0") |
487 | |
488 | |
489 | === modified file 'breezy/bzr/versionedfile.py' |
490 | --- breezy/bzr/versionedfile.py 2020-06-12 17:33:41 +0000 |
491 | +++ breezy/bzr/versionedfile.py 2020-06-26 01:36:03 +0000 |
492 | @@ -71,6 +71,23 @@ |
493 | 'breezy.bzr.knit', 'DeltaAnnotatedToFullText') |
494 | |
495 | |
496 | +class UnavailableRepresentation(errors.InternalBzrError): |
497 | + |
498 | + _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which " |
499 | + "is encoded as '%(native)s'.") |
500 | + |
501 | + def __init__(self, key, wanted, native): |
502 | + errors.InternalBzrError.__init__(self) |
503 | + self.wanted = wanted |
504 | + self.native = native |
505 | + self.key = key |
506 | + |
507 | + |
508 | +class ExistingContent(errors.BzrError): |
509 | + |
510 | + _fmt = "The content being inserted is already present." |
511 | + |
512 | + |
513 | class ContentFactory(object): |
514 | """Abstract interface for insertion and retrieval from a VersionedFile. |
515 | |
516 | @@ -134,8 +151,8 @@ |
517 | if self._chunks_are_lines: |
518 | return self._chunks |
519 | return list(osutils.chunks_to_lines(self._chunks)) |
520 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
521 | - self.storage_kind) |
522 | + raise UnavailableRepresentation(self.key, storage_kind, |
523 | + self.storage_kind) |
524 | |
525 | def iter_bytes_as(self, storage_kind): |
526 | if storage_kind == 'chunked': |
527 | @@ -144,8 +161,8 @@ |
528 | if self._chunks_are_lines: |
529 | return iter(self._chunks) |
530 | return iter(osutils.chunks_to_lines(self._chunks)) |
531 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
532 | - self.storage_kind) |
533 | + raise UnavailableRepresentation(self.key, storage_kind, |
534 | + self.storage_kind) |
535 | |
536 | class FulltextContentFactory(ContentFactory): |
537 | """Static data content factory. |
538 | @@ -181,16 +198,16 @@ |
539 | return [self._text] |
540 | elif storage_kind == 'lines': |
541 | return osutils.split_lines(self._text) |
542 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
543 | - self.storage_kind) |
544 | + raise UnavailableRepresentation(self.key, storage_kind, |
545 | + self.storage_kind) |
546 | |
547 | def iter_bytes_as(self, storage_kind): |
548 | if storage_kind == 'chunked': |
549 | return iter([self._text]) |
550 | elif storage_kind == 'lines': |
551 | return iter(osutils.split_lines(self._text)) |
552 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
553 | - self.storage_kind) |
554 | + raise UnavailableRepresentation(self.key, storage_kind, |
555 | + self.storage_kind) |
556 | |
557 | |
558 | class FileContentFactory(ContentFactory): |
559 | @@ -213,8 +230,8 @@ |
560 | return list(osutils.file_iterator(self.file)) |
561 | elif storage_kind == 'lines': |
562 | return list(self.file.readlines()) |
563 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
564 | - self.storage_kind) |
565 | + raise UnavailableRepresentation(self.key, storage_kind, |
566 | + self.storage_kind) |
567 | |
568 | def iter_bytes_as(self, storage_kind): |
569 | self.file.seek(0) |
570 | @@ -222,8 +239,8 @@ |
571 | return osutils.file_iterator(self.file) |
572 | elif storage_kind == 'lines': |
573 | return self.file |
574 | - raise errors.UnavailableRepresentation(self.key, storage_kind, |
575 | - self.storage_kind) |
576 | + raise UnavailableRepresentation(self.key, storage_kind, |
577 | + self.storage_kind) |
578 | |
579 | |
580 | class AbsentContentFactory(ContentFactory): |
581 | |
582 | === modified file 'breezy/bzr/vf_repository.py' |
583 | --- breezy/bzr/vf_repository.py 2020-02-09 01:16:06 +0000 |
584 | +++ breezy/bzr/vf_repository.py 2020-06-26 01:36:03 +0000 |
585 | @@ -499,7 +499,7 @@ |
586 | file_id, file_obj, heads, nostore_sha, |
587 | size=(stat_value.st_size if stat_value else None)) |
588 | yield change.path[1], (entry.text_sha1, stat_value) |
589 | - except errors.ExistingContent: |
590 | + except versionedfile.ExistingContent: |
591 | # No content change against a carry_over parent |
592 | # Perhaps this should also yield a fs hash update? |
593 | carried_over = True |
594 | |
595 | === modified file 'breezy/bzr/weave.py' |
596 | --- breezy/bzr/weave.py 2020-06-12 17:33:41 +0000 |
597 | +++ breezy/bzr/weave.py 2020-06-26 01:36:03 +0000 |
598 | @@ -81,7 +81,6 @@ |
599 | from ..errors import ( |
600 | RevisionAlreadyPresent, |
601 | RevisionNotPresent, |
602 | - UnavailableRepresentation, |
603 | ) |
604 | from ..osutils import dirname, sha, sha_strings, split_lines |
605 | from ..revision import NULL_REVISION |
606 | @@ -93,7 +92,9 @@ |
607 | AbsentContentFactory, |
608 | adapter_registry, |
609 | ContentFactory, |
610 | + ExistingContent, |
611 | sort_groupcompress, |
612 | + UnavailableRepresentation, |
613 | VersionedFile, |
614 | ) |
615 | from .weavefile import _read_weave_v5, write_weave_v5 |
616 | @@ -488,7 +489,7 @@ |
617 | if not sha1: |
618 | sha1 = sha_strings(lines) |
619 | if sha1 == nostore_sha: |
620 | - raise errors.ExistingContent |
621 | + raise ExistingContent |
622 | if version_id is None: |
623 | version_id = b"sha1:" + sha1 |
624 | if version_id in self._name_map: |
625 | |
626 | === modified file 'breezy/bzr/workingtree.py' |
627 | --- breezy/bzr/workingtree.py 2020-01-30 16:13:31 +0000 |
628 | +++ breezy/bzr/workingtree.py 2020-06-26 01:36:03 +0000 |
629 | @@ -62,6 +62,7 @@ |
630 | ) |
631 | from breezy.bzr import ( |
632 | inventory, |
633 | + serializer, |
634 | xml5, |
635 | xml7, |
636 | ) |
637 | @@ -101,6 +102,15 @@ |
638 | ERROR_PATH_NOT_FOUND = 3 # WindowsError errno code, equivalent to ENOENT |
639 | |
640 | |
641 | +class InventoryModified(errors.InternalBzrError): |
642 | + |
643 | + _fmt = ("The current inventory for the tree %(tree)r has been modified," |
644 | + " so a clean inventory cannot be read without data loss.") |
645 | + |
646 | + def __init__(self, tree): |
647 | + self.tree = tree |
648 | + |
649 | + |
650 | class InventoryWorkingTree(WorkingTree, MutableInventoryTree): |
651 | """Base class for working trees that are inventory-oriented. |
652 | |
653 | @@ -655,7 +665,7 @@ |
654 | # binary. |
655 | with self.lock_read(): |
656 | if self._inventory_is_modified: |
657 | - raise errors.InventoryModified(self) |
658 | + raise InventoryModified(self) |
659 | with self._transport.get('inventory') as f: |
660 | result = self._deserialize(f) |
661 | self._set_inventory(result, dirty=False) |
662 | @@ -812,7 +822,7 @@ |
663 | if inv.revision_id == revision_id: |
664 | return InventoryRevisionTree( |
665 | self.branch.repository, inv, revision_id) |
666 | - except errors.BadInventoryFormat: |
667 | + except serializer.BadInventoryFormat: |
668 | pass |
669 | # raise if there was no inventory, or if we read the wrong inventory. |
670 | raise errors.NoSuchRevisionInTree(self, revision_id) |
671 | |
672 | === modified file 'breezy/bzr/xml5.py' |
673 | --- breezy/bzr/xml5.py 2020-01-31 02:49:47 +0000 |
674 | +++ breezy/bzr/xml5.py 2020-06-26 01:36:03 +0000 |
675 | @@ -75,8 +75,7 @@ |
676 | raise errors.BzrError("parent_id {%s} not in inventory" |
677 | % (parent_id,)) |
678 | if ie.file_id in byid: |
679 | - raise errors.DuplicateFileId(ie.file_id, |
680 | - byid[ie.file_id]) |
681 | + raise inventory.DuplicateFileId(ie.file_id, byid[ie.file_id]) |
682 | if ie.name in parent.children: |
683 | raise errors.BzrError( |
684 | "%s is already versioned" % ( |
685 | |
686 | === modified file 'breezy/bzr/xml_serializer.py' |
687 | --- breezy/bzr/xml_serializer.py 2020-01-31 10:39:02 +0000 |
688 | +++ breezy/bzr/xml_serializer.py 2020-06-26 01:36:03 +0000 |
689 | @@ -86,7 +86,7 @@ |
690 | entry_cache=entry_cache, |
691 | return_from_cache=return_from_cache) |
692 | except ParseError as e: |
693 | - raise errors.UnexpectedInventoryFormat(str(e)) |
694 | + raise serializer.UnexpectedInventoryFormat(str(e)) |
695 | |
696 | def read_inventory(self, f, revision_id=None): |
697 | try: |
698 | @@ -96,7 +96,7 @@ |
699 | finally: |
700 | f.close() |
701 | except ParseError as e: |
702 | - raise errors.UnexpectedInventoryFormat(str(e)) |
703 | + raise serializer.UnexpectedInventoryFormat(str(e)) |
704 | |
705 | def write_revision_to_string(self, rev): |
706 | return b''.join(self.write_revision_to_lines(rev)) |
707 | @@ -320,7 +320,7 @@ |
708 | ie = inventory.TreeReference(file_id, name, parent_id, revision, |
709 | reference_revision) |
710 | else: |
711 | - raise errors.UnsupportedInventoryKind(kind) |
712 | + raise serializer.UnsupportedInventoryKind(kind) |
713 | ie.revision = revision |
714 | if revision is not None and entry_cache is not None: |
715 | # We cache a copy() because callers like to mutate objects, and |
716 | @@ -344,11 +344,11 @@ |
717 | encountered |
718 | """ |
719 | if elt.tag != 'inventory': |
720 | - raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag) |
721 | + raise serializer.UnexpectedInventoryFormat('Root tag is %r' % elt.tag) |
722 | format = elt.get('format') |
723 | if ((format is None and format_num is not None) or |
724 | format.encode() != format_num): |
725 | - raise errors.UnexpectedInventoryFormat('Invalid format version %r' |
726 | + raise serializer.UnexpectedInventoryFormat('Invalid format version %r' |
727 | % format) |
728 | revision_id = elt.get('revision_id') |
729 | if revision_id is not None: |
730 | @@ -422,7 +422,7 @@ |
731 | parent_str)) |
732 | elif ie.kind == 'tree-reference': |
733 | if ie.kind not in supported_kinds: |
734 | - raise errors.UnsupportedInventoryKind(ie.kind) |
735 | + raise serializer.UnsupportedInventoryKind(ie.kind) |
736 | if not working: |
737 | append(b'<tree-reference file_id="%s" name="%s"%s ' |
738 | b'revision="%s" reference_revision="%s" />\n' % ( |
739 | @@ -437,5 +437,5 @@ |
740 | encode_and_escape(ie.name), |
741 | parent_str)) |
742 | else: |
743 | - raise errors.UnsupportedInventoryKind(ie.kind) |
744 | + raise serializer.UnsupportedInventoryKind(ie.kind) |
745 | append(b'</inventory>\n') |
746 | |
747 | === modified file 'breezy/errors.py' |
748 | --- breezy/errors.py 2020-06-21 02:47:58 +0000 |
749 | +++ breezy/errors.py 2020-06-26 01:36:03 +0000 |
750 | @@ -250,15 +250,6 @@ |
751 | _fmt = "The branch '%(branch)s' is not stacked." |
752 | |
753 | |
754 | -class InventoryModified(InternalBzrError): |
755 | - |
756 | - _fmt = ("The current inventory for the tree %(tree)r has been modified," |
757 | - " so a clean inventory cannot be read without data loss.") |
758 | - |
759 | - def __init__(self, tree): |
760 | - self.tree = tree |
761 | - |
762 | - |
763 | class NoWorkingTree(BzrError): |
764 | |
765 | _fmt = 'No WorkingTree exists for "%(base)s".' |
766 | @@ -406,18 +397,6 @@ |
767 | _fmt = 'Permission denied: "%(path)s"%(extra)s' |
768 | |
769 | |
770 | -class UnavailableRepresentation(InternalBzrError): |
771 | - |
772 | - _fmt = ("The encoding '%(wanted)s' is not available for key %(key)s which " |
773 | - "is encoded as '%(native)s'.") |
774 | - |
775 | - def __init__(self, key, wanted, native): |
776 | - InternalBzrError.__init__(self) |
777 | - self.wanted = wanted |
778 | - self.native = native |
779 | - self.key = key |
780 | - |
781 | - |
782 | class UnsupportedProtocol(PathError): |
783 | |
784 | _fmt = 'Unsupported protocol for url "%(path)s"%(extra)s' |
785 | @@ -1499,16 +1478,6 @@ |
786 | self.file_id = file_id |
787 | |
788 | |
789 | -class DuplicateFileId(BzrError): |
790 | - |
791 | - _fmt = "File id {%(file_id)s} already exists in inventory as %(entry)s" |
792 | - |
793 | - def __init__(self, file_id, entry): |
794 | - BzrError.__init__(self) |
795 | - self.file_id = file_id |
796 | - self.entry = entry |
797 | - |
798 | - |
799 | class DuplicateKey(BzrError): |
800 | |
801 | _fmt = "Key %(key)s is already present in map" |
802 | @@ -1522,23 +1491,6 @@ |
803 | self.prefix = prefix |
804 | |
805 | |
806 | -class MalformedTransform(InternalBzrError): |
807 | - |
808 | - _fmt = "Tree transform is malformed %(conflicts)r" |
809 | - |
810 | - |
811 | -class NoFinalPath(BzrError): |
812 | - |
813 | - _fmt = ("No final name for trans_id %(trans_id)r\n" |
814 | - "file-id: %(file_id)r\n" |
815 | - "root trans-id: %(root_trans_id)r\n") |
816 | - |
817 | - def __init__(self, trans_id, transform): |
818 | - self.trans_id = trans_id |
819 | - self.file_id = transform.final_file_id(trans_id) |
820 | - self.root_trans_id = transform.root |
821 | - |
822 | - |
823 | class BzrBadParameter(InternalBzrError): |
824 | |
825 | _fmt = "Bad parameter: %(param)r" |
826 | @@ -1556,11 +1508,6 @@ |
827 | _fmt = "Parameter %(param)s is neither unicode nor utf8." |
828 | |
829 | |
830 | -class ReusingTransform(BzrError): |
831 | - |
832 | - _fmt = "Attempt to reuse a transform that has already been applied." |
833 | - |
834 | - |
835 | class CantMoveRoot(BzrError): |
836 | |
837 | _fmt = "Moving the root directory is not supported at this time" |
838 | @@ -1706,12 +1653,6 @@ |
839 | _fmt = "Diff3 is not installed on this machine." |
840 | |
841 | |
842 | -class ExistingContent(BzrError): |
843 | - # Added in breezy 0.92, used by VersionedFile.add_lines. |
844 | - |
845 | - _fmt = "The content being inserted is already present." |
846 | - |
847 | - |
848 | class ExistingLimbo(BzrError): |
849 | |
850 | _fmt = """This tree contains left-over files from a failed operation. |
851 | @@ -1733,17 +1674,6 @@ |
852 | BzrError.__init__(self, pending_deletion=pending_deletion) |
853 | |
854 | |
855 | -class ImmortalLimbo(BzrError): |
856 | - |
857 | - _fmt = """Unable to delete transform temporary directory %(limbo_dir)s. |
858 | - Please examine %(limbo_dir)s to see if it contains any files you wish to |
859 | - keep, and delete it when you are done.""" |
860 | - |
861 | - def __init__(self, limbo_dir): |
862 | - BzrError.__init__(self) |
863 | - self.limbo_dir = limbo_dir |
864 | - |
865 | - |
866 | class ImmortalPendingDeletion(BzrError): |
867 | |
868 | _fmt = ("Unable to delete transform temporary directory " |
869 | @@ -1970,19 +1900,6 @@ |
870 | self.other = other |
871 | |
872 | |
873 | -class BadInventoryFormat(BzrError): |
874 | - |
875 | - _fmt = "Root class for inventory serialization errors" |
876 | - |
877 | - |
878 | -class UnexpectedInventoryFormat(BadInventoryFormat): |
879 | - |
880 | - _fmt = "The inventory was not in the expected format:\n %(msg)s" |
881 | - |
882 | - def __init__(self, msg): |
883 | - BadInventoryFormat.__init__(self, msg=msg) |
884 | - |
885 | - |
886 | class RootNotRich(BzrError): |
887 | |
888 | _fmt = """This operation requires rich root data storage""" |
889 | @@ -2045,16 +1962,6 @@ |
890 | " branch location." |
891 | |
892 | |
893 | -class IllegalMergeDirectivePayload(BzrError): |
894 | - """A merge directive contained something other than a patch or bundle""" |
895 | - |
896 | - _fmt = "Bad merge directive payload %(start)r" |
897 | - |
898 | - def __init__(self, start): |
899 | - BzrError(self) |
900 | - self.start = start |
901 | - |
902 | - |
903 | class PatchVerificationFailed(BzrError): |
904 | """A patch from a merge directive could not be verified""" |
905 | |
906 | @@ -2084,14 +1991,6 @@ |
907 | self.location = location |
908 | |
909 | |
910 | -class UnsupportedInventoryKind(BzrError): |
911 | - |
912 | - _fmt = """Unsupported entry kind %(kind)s""" |
913 | - |
914 | - def __init__(self, kind): |
915 | - self.kind = kind |
916 | - |
917 | - |
918 | class BadSubsumeSource(BzrError): |
919 | |
920 | _fmt = "Can't subsume %(other_tree)s into %(tree)s. %(reason)s" |
921 | |
922 | === modified file 'breezy/git/annotate.py' |
923 | --- breezy/git/annotate.py 2020-02-09 01:27:02 +0000 |
924 | +++ breezy/git/annotate.py 2020-06-26 01:36:03 +0000 |
925 | @@ -23,9 +23,9 @@ |
926 | ) |
927 | |
928 | from .. import osutils |
929 | +from ..bzr.versionedfile import UnavailableRepresentation |
930 | from ..errors import ( |
931 | NoSuchRevision, |
932 | - UnavailableRepresentation, |
933 | ) |
934 | from ..graph import Graph |
935 | from ..revision import ( |
936 | |
937 | === modified file 'breezy/merge_directive.py' |
938 | --- breezy/merge_directive.py 2020-01-11 17:41:33 +0000 |
939 | +++ breezy/merge_directive.py 2020-06-26 01:36:03 +0000 |
940 | @@ -49,6 +49,16 @@ |
941 | ) |
942 | |
943 | |
944 | +class IllegalMergeDirectivePayload(errors.BzrError): |
945 | + """A merge directive contained something other than a patch or bundle""" |
946 | + |
947 | + _fmt = "Bad merge directive payload %(start)r" |
948 | + |
949 | + def __init__(self, start): |
950 | + errors.BzrError(self) |
951 | + self.start = start |
952 | + |
953 | + |
954 | class MergeRequestBodyParams(object): |
955 | """Parameter object for the merge_request_body hook.""" |
956 | |
957 | @@ -546,7 +556,7 @@ |
958 | if start.startswith(b'# Begin bundle'): |
959 | bundle = b''.join(line_iter) |
960 | else: |
961 | - raise errors.IllegalMergeDirectivePayload(start) |
962 | + raise IllegalMergeDirectivePayload(start) |
963 | time, timezone = timestamp.parse_patch_date(stanza.get('timestamp')) |
964 | kwargs = {} |
965 | for key in ('revision_id', 'testament_sha1', 'target_branch', |
966 | |
967 | === modified file 'breezy/tests/per_workingtree/test_add.py' |
968 | --- breezy/tests/per_workingtree/test_add.py 2019-06-29 13:16:26 +0000 |
969 | +++ breezy/tests/per_workingtree/test_add.py 2020-06-26 01:36:03 +0000 |
970 | @@ -50,8 +50,8 @@ |
971 | self.skipTest("tree does not support setting file ids") |
972 | self.build_tree(['a', 'b']) |
973 | tree.add(['a']) |
974 | - self.assertRaises(errors.DuplicateFileId, |
975 | - tree.add, ['b'], [tree.path2id('a')]) |
976 | + self.assertRaises( |
977 | + inventory.DuplicateFileId, tree.add, ['b'], [tree.path2id('a')]) |
978 | # And the entry should not have been added. |
979 | self.assertTreeLayout(['', 'a'], tree) |
980 | |
981 | |
982 | === modified file 'breezy/tests/per_workingtree/test_read_working_inventory.py' |
983 | --- breezy/tests/per_workingtree/test_read_working_inventory.py 2018-11-11 04:08:32 +0000 |
984 | +++ breezy/tests/per_workingtree/test_read_working_inventory.py 2020-06-26 01:36:03 +0000 |
985 | @@ -20,7 +20,7 @@ |
986 | from breezy.bzr import inventory |
987 | from breezy.tests import TestNotApplicable |
988 | from breezy.tests.per_workingtree import TestCaseWithWorkingTree |
989 | -from breezy.bzr.workingtree import InventoryWorkingTree |
990 | +from breezy.bzr.workingtree import InventoryWorkingTree, InventoryModified |
991 | |
992 | |
993 | class TestReadWorkingInventory(TestCaseWithWorkingTree): |
994 | @@ -49,7 +49,7 @@ |
995 | # OR, the call can be ignored and the changes preserved |
996 | try: |
997 | tree.read_working_inventory() |
998 | - except errors.InventoryModified: |
999 | + except InventoryModified: |
1000 | pass |
1001 | else: |
1002 | self.assertEqual(b'new-root', tree.path2id('')) |
1003 | |
1004 | === modified file 'breezy/tests/test_conflicts.py' |
1005 | --- breezy/tests/test_conflicts.py 2018-11-11 04:08:32 +0000 |
1006 | +++ breezy/tests/test_conflicts.py 2020-06-26 01:36:03 +0000 |
1007 | @@ -23,6 +23,7 @@ |
1008 | option, |
1009 | osutils, |
1010 | tests, |
1011 | + transform, |
1012 | ) |
1013 | from ..sixish import text_type |
1014 | from . import ( |
1015 | @@ -1077,7 +1078,7 @@ |
1016 | # This is nearly like TestResolveNonDirectoryParent but with branch and |
1017 | # trunk switched. As such it should certainly produce the same |
1018 | # conflict. |
1019 | - self.assertRaises(errors.MalformedTransform, |
1020 | + self.assertRaises(transform.MalformedTransform, |
1021 | self.run_script, """ |
1022 | $ brz init trunk |
1023 | ... |
1024 | |
1025 | === modified file 'breezy/tests/test_errors.py' |
1026 | --- breezy/tests/test_errors.py 2019-03-04 00:16:27 +0000 |
1027 | +++ breezy/tests/test_errors.py 2020-06-26 01:36:03 +0000 |
1028 | @@ -67,11 +67,6 @@ |
1029 | "^Filename b?'bad/filen\\\\xe5me' is not valid in your current" |
1030 | " filesystem encoding UTF-8$") |
1031 | |
1032 | - def test_duplicate_file_id(self): |
1033 | - error = errors.DuplicateFileId('a_file_id', 'foo') |
1034 | - self.assertEqualDiff('File id {a_file_id} already exists in inventory' |
1035 | - ' as foo', str(error)) |
1036 | - |
1037 | def test_duplicate_help_prefix(self): |
1038 | error = errors.DuplicateHelpPrefix('foo') |
1039 | self.assertEqualDiff('The prefix foo is in the help search path twice.', |
1040 | @@ -125,13 +120,6 @@ |
1041 | self.assertEqual("Invalid range access in path at 12: bad range", |
1042 | str(error)) |
1043 | |
1044 | - def test_inventory_modified(self): |
1045 | - error = errors.InventoryModified("a tree to be repred") |
1046 | - self.assertEqualDiff("The current inventory for the tree 'a tree to " |
1047 | - "be repred' has been modified, so a clean inventory cannot be " |
1048 | - "read without data loss.", |
1049 | - str(error)) |
1050 | - |
1051 | def test_jail_break(self): |
1052 | error = errors.JailBreak("some url") |
1053 | self.assertEqualDiff("An attempt to access a url outside the server" |
1054 | @@ -199,13 +187,6 @@ |
1055 | "the currently open request.", |
1056 | str(error)) |
1057 | |
1058 | - def test_unavailable_representation(self): |
1059 | - error = errors.UnavailableRepresentation( |
1060 | - ('key',), "mpdiff", "fulltext") |
1061 | - self.assertEqualDiff("The encoding 'mpdiff' is not available for key " |
1062 | - "('key',) which is encoded as 'fulltext'.", |
1063 | - str(error)) |
1064 | - |
1065 | def test_unstackable_location(self): |
1066 | error = errors.UnstackableLocationError('foo', 'bar') |
1067 | self.assertEqualDiff("The branch 'foo' cannot be stacked on 'bar'.", |
1068 | |
1069 | === modified file 'breezy/tests/test_shelf.py' |
1070 | --- breezy/tests/test_shelf.py 2019-09-27 02:48:17 +0000 |
1071 | +++ breezy/tests/test_shelf.py 2020-06-26 01:36:03 +0000 |
1072 | @@ -32,9 +32,6 @@ |
1073 | features, |
1074 | KnownFailure, |
1075 | ) |
1076 | -from ..errors import ( |
1077 | - MalformedTransform, |
1078 | - ) |
1079 | |
1080 | |
1081 | EMPTY_SHELF = (b"Bazaar pack format 1 (introduced in 0.18)\n" |
1082 | @@ -254,7 +251,7 @@ |
1083 | try: |
1084 | creator.transform() |
1085 | self.check_shelve_creation(creator, tree) |
1086 | - except MalformedTransform: |
1087 | + except transform.MalformedTransform: |
1088 | raise KnownFailure( |
1089 | 'shelving directory with ignored file: see bug #611739') |
1090 | |
1091 | |
1092 | === modified file 'breezy/tests/test_transform.py' |
1093 | --- breezy/tests/test_transform.py 2019-09-21 23:05:12 +0000 |
1094 | +++ breezy/tests/test_transform.py 2020-06-26 01:36:03 +0000 |
1095 | @@ -51,11 +51,8 @@ |
1096 | DuplicateKey, |
1097 | ExistingLimbo, |
1098 | ExistingPendingDeletion, |
1099 | - ImmortalLimbo, |
1100 | ImmortalPendingDeletion, |
1101 | LockError, |
1102 | - MalformedTransform, |
1103 | - ReusingTransform, |
1104 | ) |
1105 | from ..osutils import ( |
1106 | file_kind, |
1107 | @@ -86,6 +83,10 @@ |
1108 | resolve_conflicts, |
1109 | resolve_checkout, |
1110 | ROOT_PARENT, |
1111 | + ImmortalLimbo, |
1112 | + MalformedTransform, |
1113 | + NoFinalPath, |
1114 | + ReusingTransform, |
1115 | TransformPreview, |
1116 | TreeTransform, |
1117 | ) |
1118 | @@ -982,7 +983,7 @@ |
1119 | self.assertEqual(('missing parent', 'Created directory', 'new-1'), |
1120 | raw_conflicts.pop()) |
1121 | # apply fail since the missing directory doesn't exist |
1122 | - self.assertRaises(errors.NoFinalPath, tt.apply) |
1123 | + self.assertRaises(NoFinalPath, tt.apply) |
1124 | |
1125 | def test_moving_versioned_directories(self): |
1126 | create, root = self.get_transform() |
1127 | @@ -2445,7 +2446,7 @@ |
1128 | branch, tt = self.get_branch_and_transform() |
1129 | parent_id = tt.trans_id_file_id(b'parent-id') |
1130 | tt.new_file('file', parent_id, [b'contents'], b'file-id') |
1131 | - self.assertRaises(errors.MalformedTransform, tt.commit, branch, |
1132 | + self.assertRaises(MalformedTransform, tt.commit, branch, |
1133 | 'message') |
1134 | |
1135 | def test_commit_rich_revision_data(self): |
1136 | |
1137 | === modified file 'breezy/transform.py' |
1138 | --- breezy/transform.py 2020-02-09 17:10:01 +0000 |
1139 | +++ breezy/transform.py 2020-06-26 01:36:03 +0000 |
1140 | @@ -51,9 +51,9 @@ |
1141 | ) |
1142 | from breezy.i18n import gettext |
1143 | """) |
1144 | -from .errors import (DuplicateKey, MalformedTransform, |
1145 | - ReusingTransform, CantMoveRoot, |
1146 | - ImmortalLimbo, NoFinalPath) |
1147 | +from .errors import (DuplicateKey, |
1148 | + CantMoveRoot, |
1149 | + BzrError, InternalBzrError) |
1150 | from .filters import filtered_output_bytes, ContentFilterContext |
1151 | from .mutabletree import MutableTree |
1152 | from .osutils import ( |
1153 | @@ -79,6 +79,39 @@ |
1154 | ROOT_PARENT = "root-parent" |
1155 | |
1156 | |
1157 | +class NoFinalPath(BzrError): |
1158 | + |
1159 | + _fmt = ("No final name for trans_id %(trans_id)r\n" |
1160 | + "file-id: %(file_id)r\n" |
1161 | + "root trans-id: %(root_trans_id)r\n") |
1162 | + |
1163 | + def __init__(self, trans_id, transform): |
1164 | + self.trans_id = trans_id |
1165 | + self.file_id = transform.final_file_id(trans_id) |
1166 | + self.root_trans_id = transform.root |
1167 | + |
1168 | + |
1169 | +class ReusingTransform(BzrError): |
1170 | + |
1171 | + _fmt = "Attempt to reuse a transform that has already been applied." |
1172 | + |
1173 | + |
1174 | +class MalformedTransform(InternalBzrError): |
1175 | + |
1176 | + _fmt = "Tree transform is malformed %(conflicts)r" |
1177 | + |
1178 | + |
1179 | +class ImmortalLimbo(BzrError): |
1180 | + |
1181 | + _fmt = """Unable to delete transform temporary directory %(limbo_dir)s. |
1182 | + Please examine %(limbo_dir)s to see if it contains any files you wish to |
1183 | + keep, and delete it when you are done.""" |
1184 | + |
1185 | + def __init__(self, limbo_dir): |
1186 | + BzrError.__init__(self) |
1187 | + self.limbo_dir = limbo_dir |
1188 | + |
1189 | + |
1190 | def unique_add(map, key, value): |
1191 | if key in map: |
1192 | raise DuplicateKey(key=key) |
Running landing tests failed /ci.breezy- vcs.org/ job/brz- 3.1/job/ brz-3.1- land/158/
https:/