Merge lp:~jelmer/brz/move-errors-1 into lp:brz
- move-errors-1
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | Jelmer Vernooij |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/move-errors-1 |
Merge into: | lp:brz |
Diff against target: |
624 lines (+107/-85) 21 files modified
breezy/bzr/bzrdir.py (+12/-3) breezy/bzr/inventorytree.py (+6/-2) breezy/bzr/workingtree.py (+2/-2) breezy/bzr/workingtree_4.py (+2/-1) breezy/commands.py (+6/-2) breezy/diff.py (+4/-2) breezy/errors.py (+0/-41) breezy/help.py (+11/-2) breezy/option.py (+10/-2) breezy/tests/per_workingtree/test_get_file_mtime.py (+2/-1) breezy/tests/test_bzrdir.py (+3/-3) breezy/tests/test_commands.py (+1/-1) breezy/tests/test_conflicts.py (+1/-1) breezy/tests/test_errors.py (+0/-11) breezy/tests/test_help.py (+10/-1) breezy/tests/test_options.py (+2/-2) breezy/tests/test_repository.py (+2/-2) breezy/tests/test_revisiontree.py (+2/-1) breezy/tests/test_tree.py (+16/-2) breezy/tests/test_workingtree.py (+1/-1) breezy/tree.py (+14/-2) |
To merge this branch: | bzr merge lp:~jelmer/brz/move-errors-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+327485@code.launchpad.net |
Commit message
Move some more errors out of breezy.errors.
Description of the change
Move some more errors out of breezy.errors.
Jelmer Vernooij (jelmer) wrote : | # |
The attempt to merge lp:~jelmer/brz/move-errors-1 into lp:brz failed. Below is the output from the failed tests.
brz selftest: /tmp/tarmac/
/tmp/
bzr-3.0.0dev1 python-2.7.13 Linux-4.
ERROR: blackbox.
log: {{{
23.520 creating repository in file://
23.521 creating branch <breezy.
23.527 trying to create missing lock '/tmp/testbzr-
23.527 opening working tree '/tmp/testbzr-
23.536 preparing to commit
INFO Committing to: /tmp/testbzr-
23.537 Selecting files for commit with filter None
INFO added hello
INFO Committed revision 1.
23.547 Committed revid <email address hidden> as revno 1.
23.554 preparing to commit
INFO Committing to: /tmp/testbzr-
23.555 Selecting files for commit with filter None
INFO added goodbye
INFO Committed revision 2.
23.569 Committed revid <email address hidden> as revno 2.
23.573 opening working tree '/tmp/testbzr-
23.580 creating repository in file://
23.582 Using fetch logic to copy between CHKInventoryRep
23.582 fetching: <PendingAncestr
23.594 creating branch <breezy.
23.598 created new branch BzrBranch7(
23.600 trying to create missing lock '/tmp/testbzr-
23.600 opening working tree '/tmp/testbzr-
23.611 opening working tree '/tmp/testbzr-
23.615 preparing to commit
INFO Committing to: /tmp/testb...
Preview Diff
1 | === modified file 'breezy/bzr/bzrdir.py' |
2 | --- breezy/bzr/bzrdir.py 2017-06-14 22:34:05 +0000 |
3 | +++ breezy/bzr/bzrdir.py 2017-07-15 13:18:35 +0000 |
4 | @@ -34,7 +34,6 @@ |
5 | import breezy |
6 | from breezy import ( |
7 | cleanup, |
8 | - errors, |
9 | fetch, |
10 | graph, |
11 | lockable_files, |
12 | @@ -72,10 +71,20 @@ |
13 | from .. import ( |
14 | config, |
15 | controldir, |
16 | + errors, |
17 | registry, |
18 | ) |
19 | |
20 | |
21 | +class MissingFeature(errors.BzrError): |
22 | + |
23 | + _fmt = ("Missing feature %(feature)s not provided by this " |
24 | + "version of Bazaar or any plugin.") |
25 | + |
26 | + def __init__(self, feature): |
27 | + self.feature = feature |
28 | + |
29 | + |
30 | class BzrDir(controldir.ControlDir): |
31 | """A .bzr control diretory. |
32 | |
33 | @@ -1149,11 +1158,11 @@ |
34 | mutter("ignoring optional missing feature %s", name) |
35 | continue |
36 | elif necessity == "required": |
37 | - raise errors.MissingFeature(name) |
38 | + raise MissingFeature(name) |
39 | else: |
40 | mutter("treating unknown necessity as require for %s", |
41 | name) |
42 | - raise errors.MissingFeature(name) |
43 | + raise MissingFeature(name) |
44 | |
45 | @classmethod |
46 | def get_format_string(cls): |
47 | |
48 | === modified file 'breezy/bzr/inventorytree.py' |
49 | --- breezy/bzr/inventorytree.py 2017-06-11 01:22:16 +0000 |
50 | +++ breezy/bzr/inventorytree.py 2017-07-15 13:18:35 +0000 |
51 | @@ -50,7 +50,11 @@ |
52 | from ..sixish import ( |
53 | viewvalues, |
54 | ) |
55 | -from ..tree import InterTree, Tree |
56 | +from ..tree import ( |
57 | + FileTimestampUnavailable, |
58 | + InterTree, |
59 | + Tree, |
60 | + ) |
61 | |
62 | |
63 | class InventoryTree(Tree): |
64 | @@ -611,7 +615,7 @@ |
65 | try: |
66 | revision = self._repository.get_revision(ie.revision) |
67 | except errors.NoSuchRevision: |
68 | - raise errors.FileTimestampUnavailable(self.id2path(file_id)) |
69 | + raise FileTimestampUnavailable(self.id2path(file_id)) |
70 | return revision.timestamp |
71 | |
72 | def get_file_size(self, file_id): |
73 | |
74 | === modified file 'breezy/bzr/workingtree.py' |
75 | --- breezy/bzr/workingtree.py 2017-07-02 21:51:21 +0000 |
76 | +++ breezy/bzr/workingtree.py 2017-07-15 13:18:35 +0000 |
77 | @@ -30,7 +30,6 @@ |
78 | """ |
79 | |
80 | |
81 | - |
82 | from __future__ import absolute_import |
83 | |
84 | import breezy |
85 | @@ -74,6 +73,7 @@ |
86 | text_type, |
87 | ) |
88 | from ..trace import mutter |
89 | +from ..tree import FileTimestampUnavailable |
90 | from ..workingtree import ( |
91 | TreeDirectory, |
92 | TreeFile, |
93 | @@ -580,7 +580,7 @@ |
94 | return os.lstat(self.abspath(path)).st_mtime |
95 | except OSError as e: |
96 | if e.errno == errno.ENOENT: |
97 | - raise errors.FileTimestampUnavailable(path) |
98 | + raise FileTimestampUnavailable(path) |
99 | raise |
100 | |
101 | def _is_executable_from_path_and_stat_from_basis(self, path, stat_result): |
102 | |
103 | === modified file 'breezy/bzr/workingtree_4.py' |
104 | --- breezy/bzr/workingtree_4.py 2017-06-14 23:29:06 +0000 |
105 | +++ breezy/bzr/workingtree_4.py 2017-07-15 13:18:35 +0000 |
106 | @@ -81,6 +81,7 @@ |
107 | ) |
108 | from ..transport.local import LocalTransport |
109 | from ..tree import ( |
110 | + FileTimestampUnavailable, |
111 | InterTree, |
112 | ) |
113 | from ..workingtree import ( |
114 | @@ -1868,7 +1869,7 @@ |
115 | try: |
116 | rev = self._repository.get_revision(last_changed_revision) |
117 | except errors.NoSuchRevision: |
118 | - raise errors.FileTimestampUnavailable(self.id2path(file_id)) |
119 | + raise FileTimestampUnavailable(self.id2path(file_id)) |
120 | return rev.timestamp |
121 | |
122 | def get_file_sha1(self, file_id, path=None, stat_value=None): |
123 | |
124 | === modified file 'breezy/commands.py' |
125 | --- breezy/commands.py 2017-06-05 20:48:31 +0000 |
126 | +++ breezy/commands.py 2017-07-15 13:18:35 +0000 |
127 | @@ -37,7 +37,6 @@ |
128 | cleanup, |
129 | cmdline, |
130 | debug, |
131 | - errors, |
132 | i18n, |
133 | option, |
134 | osutils, |
135 | @@ -51,12 +50,17 @@ |
136 | # Compatibility - Option used to be in commands. |
137 | from .option import Option |
138 | from .plugin import disable_plugins, load_plugins, plugin_name |
139 | -from . import registry |
140 | +from . import errors, registry |
141 | from .sixish import ( |
142 | string_types, |
143 | ) |
144 | |
145 | |
146 | +class BzrOptionError(errors.BzrCommandError): |
147 | + |
148 | + _fmt = "Error in command line options" |
149 | + |
150 | + |
151 | class CommandInfo(object): |
152 | """Information about a command.""" |
153 | |
154 | |
155 | === modified file 'breezy/diff.py' |
156 | --- breezy/diff.py 2017-06-11 00:27:48 +0000 |
157 | +++ breezy/diff.py 2017-07-15 13:18:35 +0000 |
158 | @@ -48,6 +48,8 @@ |
159 | Registry, |
160 | ) |
161 | from .trace import mutter, note, warning |
162 | +from .tree import FileTimestampUnavailable |
163 | + |
164 | |
165 | DEFAULT_CONTEXT_AMOUNT = 3 |
166 | |
167 | @@ -484,7 +486,7 @@ |
168 | """Returns a timestamp suitable for use in a patch header.""" |
169 | try: |
170 | mtime = tree.get_file_mtime(file_id, path) |
171 | - except errors.FileTimestampUnavailable: |
172 | + except FileTimestampUnavailable: |
173 | mtime = 0 |
174 | return timestamp.format_patch_date(mtime) |
175 | |
176 | @@ -825,7 +827,7 @@ |
177 | source.close() |
178 | try: |
179 | mtime = tree.get_file_mtime(file_id) |
180 | - except errors.FileTimestampUnavailable: |
181 | + except FileTimestampUnavailable: |
182 | pass |
183 | else: |
184 | os.utime(full_path, (mtime, mtime)) |
185 | |
186 | === modified file 'breezy/errors.py' |
187 | --- breezy/errors.py 2017-07-12 21:40:01 +0000 |
188 | +++ breezy/errors.py 2017-07-15 13:18:35 +0000 |
189 | @@ -259,15 +259,6 @@ |
190 | BzrError.__init__(self, branch_url=public_location) |
191 | |
192 | |
193 | -class NoHelpTopic(BzrError): |
194 | - |
195 | - _fmt = ("No help could be found for '%(topic)s'. " |
196 | - "Please use 'brz help topics' to obtain a list of topics.") |
197 | - |
198 | - def __init__(self, topic): |
199 | - self.topic = topic |
200 | - |
201 | - |
202 | class NoSuchId(BzrError): |
203 | |
204 | _fmt = 'The file id "%(file_id)s" is not present in the tree %(tree)s.' |
205 | @@ -351,11 +342,6 @@ |
206 | self.not_locked = not_locked |
207 | |
208 | |
209 | -class BzrOptionError(BzrCommandError): |
210 | - |
211 | - _fmt = "Error in command line options" |
212 | - |
213 | - |
214 | class BadIndexFormatSignature(BzrError): |
215 | |
216 | _fmt = "%(value)s is not an index of type %(_type)s." |
217 | @@ -412,14 +398,6 @@ |
218 | self.value = value |
219 | |
220 | |
221 | -class BadOptionValue(BzrError): |
222 | - |
223 | - _fmt = """Bad value "%(value)s" for option "%(name)s".""" |
224 | - |
225 | - def __init__(self, name, value): |
226 | - BzrError.__init__(self, name=name, value=value) |
227 | - |
228 | - |
229 | class StrictCommitFailed(BzrError): |
230 | |
231 | _fmt = "Commit refused because there are unknown files in the tree" |
232 | @@ -3037,16 +3015,6 @@ |
233 | self.target_branch = target_branch |
234 | |
235 | |
236 | -class FileTimestampUnavailable(BzrError): |
237 | - |
238 | - _fmt = "The filestamp for %(path)s is not available." |
239 | - |
240 | - internal_error = True |
241 | - |
242 | - def __init__(self, path): |
243 | - self.path = path |
244 | - |
245 | - |
246 | class NoColocatedBranchSupport(BzrError): |
247 | |
248 | _fmt = ("%(controldir)r does not support co-located branches.") |
249 | @@ -3121,15 +3089,6 @@ |
250 | self.format = format |
251 | |
252 | |
253 | -class MissingFeature(BzrError): |
254 | - |
255 | - _fmt = ("Missing feature %(feature)s not provided by this " |
256 | - "version of Bazaar or any plugin.") |
257 | - |
258 | - def __init__(self, feature): |
259 | - self.feature = feature |
260 | - |
261 | - |
262 | class PatchSyntax(BzrError): |
263 | """Base class for patch syntax errors.""" |
264 | |
265 | |
266 | === modified file 'breezy/help.py' |
267 | --- breezy/help.py 2017-06-05 20:48:31 +0000 |
268 | +++ breezy/help.py 2017-07-15 13:18:35 +0000 |
269 | @@ -36,6 +36,15 @@ |
270 | ) |
271 | |
272 | |
273 | +class NoHelpTopic(errors.BzrError): |
274 | + |
275 | + _fmt = ("No help could be found for '%(topic)s'. " |
276 | + "Please use 'brz help topics' to obtain a list of topics.") |
277 | + |
278 | + def __init__(self, topic): |
279 | + self.topic = topic |
280 | + |
281 | + |
282 | def help(topic=None, outfile=None): |
283 | """Write the help for the specific topic to outfile""" |
284 | if outfile is None: |
285 | @@ -52,7 +61,7 @@ |
286 | topic_obj.get_help_topic())) |
287 | source = topics[0][1] |
288 | outfile.write(source.get_help_text(shadowed_terms)) |
289 | - except errors.NoHelpTopic: |
290 | + except NoHelpTopic: |
291 | if alias is None: |
292 | raise |
293 | |
294 | @@ -162,6 +171,6 @@ |
295 | for index in self.search_path: |
296 | result.extend([(index, _topic) for _topic in index.get_topics(topic)]) |
297 | if not result: |
298 | - raise errors.NoHelpTopic(topic) |
299 | + raise NoHelpTopic(topic) |
300 | else: |
301 | return result |
302 | |
303 | === modified file 'breezy/option.py' |
304 | --- breezy/option.py 2017-05-22 00:56:52 +0000 |
305 | +++ breezy/option.py 2017-07-15 13:18:35 +0000 |
306 | @@ -25,13 +25,13 @@ |
307 | from .lazy_import import lazy_import |
308 | lazy_import(globals(), """ |
309 | from breezy import ( |
310 | - errors, |
311 | revisionspec, |
312 | i18n, |
313 | ) |
314 | """) |
315 | |
316 | from . import ( |
317 | + errors, |
318 | registry as _mod_registry, |
319 | ) |
320 | from .sixish import ( |
321 | @@ -39,6 +39,14 @@ |
322 | ) |
323 | |
324 | |
325 | +class BadOptionValue(errors.BzrError): |
326 | + |
327 | + _fmt = """Bad value "%(value)s" for option "%(name)s".""" |
328 | + |
329 | + def __init__(self, name, value): |
330 | + BzrError.__init__(self, name=name, value=value) |
331 | + |
332 | + |
333 | def _parse_revision_str(revstr): |
334 | """This handles a revision string -> revno. |
335 | |
336 | @@ -306,7 +314,7 @@ |
337 | def validate_value(self, value): |
338 | """Validate a value name""" |
339 | if value not in self.registry: |
340 | - raise errors.BadOptionValue(self.name, value) |
341 | + raise BadOptionValue(self.name, value) |
342 | |
343 | def convert(self, value): |
344 | """Convert a value name into an output type""" |
345 | |
346 | === modified file 'breezy/tests/per_workingtree/test_get_file_mtime.py' |
347 | --- breezy/tests/per_workingtree/test_get_file_mtime.py 2017-05-21 18:10:28 +0000 |
348 | +++ breezy/tests/per_workingtree/test_get_file_mtime.py 2017-07-15 13:18:35 +0000 |
349 | @@ -19,6 +19,7 @@ |
350 | import os |
351 | |
352 | from breezy import errors |
353 | +from breezy.tree import FileTimestampUnavailable |
354 | from breezy.tests.per_workingtree import TestCaseWithWorkingTree |
355 | |
356 | |
357 | @@ -106,7 +107,7 @@ |
358 | os.remove('tree/one') |
359 | tree.lock_read() |
360 | try: |
361 | - self.assertRaises(errors.FileTimestampUnavailable, |
362 | + self.assertRaises(FileTimestampUnavailable, |
363 | tree.get_file_mtime, file_id='one-id') |
364 | finally: |
365 | tree.unlock() |
366 | |
367 | === modified file 'breezy/tests/test_bzrdir.py' |
368 | --- breezy/tests/test_bzrdir.py 2017-06-14 22:34:05 +0000 |
369 | +++ breezy/tests/test_bzrdir.py 2017-07-15 13:18:35 +0000 |
370 | @@ -1032,7 +1032,7 @@ |
371 | def test_with_features(self): |
372 | tree = self.make_branch_and_tree('tree', format='2a') |
373 | tree.controldir.update_feature_flags({"bar": "required"}) |
374 | - self.assertRaises(errors.MissingFeature, bzrdir.BzrDir.open, 'tree') |
375 | + self.assertRaises(bzrdir.MissingFeature, bzrdir.BzrDir.open, 'tree') |
376 | bzrdir.BzrDirMetaFormat1.register_feature('bar') |
377 | self.addCleanup(bzrdir.BzrDirMetaFormat1.unregister_feature, 'bar') |
378 | dir = bzrdir.BzrDir.open('tree') |
379 | @@ -1536,7 +1536,7 @@ |
380 | # Optional, so trigger an exception |
381 | format = SampleBzrFormat() |
382 | format.features = {"nested-trees": "required"} |
383 | - self.assertRaises(errors.MissingFeature, format.check_support_status, |
384 | + self.assertRaises(bzrdir.MissingFeature, format.check_support_status, |
385 | True) |
386 | self.addCleanup(SampleBzrFormat.unregister_feature, "nested-trees") |
387 | SampleBzrFormat.register_feature("nested-trees") |
388 | @@ -1546,7 +1546,7 @@ |
389 | # treat unknown necessity as required |
390 | format = SampleBzrFormat() |
391 | format.features = {"nested-trees": "unknown"} |
392 | - self.assertRaises(errors.MissingFeature, format.check_support_status, |
393 | + self.assertRaises(bzrdir.MissingFeature, format.check_support_status, |
394 | True) |
395 | self.addCleanup(SampleBzrFormat.unregister_feature, "nested-trees") |
396 | SampleBzrFormat.register_feature("nested-trees") |
397 | |
398 | === modified file 'breezy/tests/test_commands.py' |
399 | --- breezy/tests/test_commands.py 2017-05-22 00:56:52 +0000 |
400 | +++ breezy/tests/test_commands.py 2017-07-15 13:18:35 +0000 |
401 | @@ -429,7 +429,7 @@ |
402 | def pre_command(cmd): |
403 | hook_calls.append('pre') |
404 | # verify that all subclasses of BzrCommandError caught too |
405 | - raise errors.BzrOptionError() |
406 | + raise commands.BzrOptionError() |
407 | |
408 | def post_command(cmd, e): |
409 | self.fail('post_command should not be called') |
410 | |
411 | === modified file 'breezy/tests/test_conflicts.py' |
412 | --- breezy/tests/test_conflicts.py 2017-06-10 00:17:06 +0000 |
413 | +++ breezy/tests/test_conflicts.py 2017-07-15 13:18:35 +0000 |
414 | @@ -1178,7 +1178,7 @@ |
415 | return self.parser.parse_args(args) |
416 | |
417 | def test_unknown_action(self): |
418 | - self.assertRaises(errors.BadOptionValue, |
419 | + self.assertRaises(option.BadOptionValue, |
420 | self.parse, ['--action', 'take-me-to-the-moon']) |
421 | |
422 | def test_done(self): |
423 | |
424 | === modified file 'breezy/tests/test_errors.py' |
425 | --- breezy/tests/test_errors.py 2017-07-12 21:40:01 +0000 |
426 | +++ breezy/tests/test_errors.py 2017-07-15 13:18:35 +0000 |
427 | @@ -202,12 +202,6 @@ |
428 | "smart protocol.", |
429 | str(error)) |
430 | |
431 | - def test_no_help_topic(self): |
432 | - error = errors.NoHelpTopic("topic") |
433 | - self.assertEqualDiff("No help could be found for 'topic'. " |
434 | - "Please use 'brz help topics' to obtain a list of topics.", |
435 | - str(error)) |
436 | - |
437 | def test_no_such_id(self): |
438 | error = errors.NoSuchId("atree", "anid") |
439 | self.assertEqualDiff("The file id \"anid\" is not present in the tree " |
440 | @@ -669,11 +663,6 @@ |
441 | str(e), |
442 | r'Cannot bind address "example\.com:22":.*Permission denied') |
443 | |
444 | - def test_file_timestamp_unavailable(self): |
445 | - e = errors.FileTimestampUnavailable("/path/foo") |
446 | - self.assertEqual("The filestamp for /path/foo is not available.", |
447 | - str(e)) |
448 | - |
449 | def test_transform_rename_failed(self): |
450 | e = errors.TransformRenameFailed(u"from", u"to", "readonly file", 2) |
451 | self.assertEqual( |
452 | |
453 | === modified file 'breezy/tests/test_help.py' |
454 | --- breezy/tests/test_help.py 2017-05-22 00:56:52 +0000 |
455 | +++ breezy/tests/test_help.py 2017-07-15 13:18:35 +0000 |
456 | @@ -34,6 +34,15 @@ |
457 | import re |
458 | |
459 | |
460 | +class ErrorTests(tests.TestCase): |
461 | + |
462 | + def test_no_help_topic(self): |
463 | + error = help.NoHelpTopic("topic") |
464 | + self.assertEqualDiff("No help could be found for 'topic'. " |
465 | + "Please use 'brz help topics' to obtain a list of topics.", |
466 | + str(error)) |
467 | + |
468 | + |
469 | class TestCommandHelp(tests.TestCase): |
470 | """Tests for help on commands.""" |
471 | |
472 | @@ -660,7 +669,7 @@ |
473 | """Searching for an unknown topic should raise NoHelpTopic.""" |
474 | indices = help.HelpIndices() |
475 | indices.search_path = [] |
476 | - error = self.assertRaises(errors.NoHelpTopic, indices.search, 'foo') |
477 | + error = self.assertRaises(help.NoHelpTopic, indices.search, 'foo') |
478 | self.assertEqual('foo', error.topic) |
479 | |
480 | def test_search_calls_get_topic(self): |
481 | |
482 | === modified file 'breezy/tests/test_options.py' |
483 | --- breezy/tests/test_options.py 2017-06-15 23:37:02 +0000 |
484 | +++ breezy/tests/test_options.py 2017-07-15 13:18:35 +0000 |
485 | @@ -128,7 +128,7 @@ |
486 | self.assertEqual({'format':'one'}, opts) |
487 | opts, args = self.parse(options, ['--format', 'two']) |
488 | self.assertEqual({'format':'two'}, opts) |
489 | - self.assertRaises(errors.BadOptionValue, self.parse, options, |
490 | + self.assertRaises(option.BadOptionValue, self.parse, options, |
491 | ['--format', 'three']) |
492 | self.assertRaises(errors.BzrCommandError, self.parse, options, |
493 | ['--two']) |
494 | @@ -172,7 +172,7 @@ |
495 | opts, args = self.parse(options, ['--format', 'knit']) |
496 | self.assertEqual({'format': 'knit'}, opts) |
497 | self.assertRaises( |
498 | - errors.BadOptionValue, self.parse, options, ['--format', 'BAD']) |
499 | + option.BadOptionValue, self.parse, options, ['--format', 'BAD']) |
500 | |
501 | def test_from_kwargs(self): |
502 | my_option = option.RegistryOption.from_kwargs('my-option', |
503 | |
504 | === modified file 'breezy/tests/test_repository.py' |
505 | --- breezy/tests/test_repository.py 2017-06-10 16:40:42 +0000 |
506 | +++ breezy/tests/test_repository.py 2017-07-15 13:18:35 +0000 |
507 | @@ -173,7 +173,7 @@ |
508 | found_format = bzrrepository.RepositoryFormatMetaDir.find_format(tree.controldir) |
509 | self.assertIsInstance(found_format, bzrrepository.RepositoryFormatMetaDir) |
510 | self.assertEqual(found_format.features.get("name"), "necessity") |
511 | - self.assertRaises(errors.MissingFeature, found_format.check_support_status, |
512 | + self.assertRaises(bzrdir.MissingFeature, found_format.check_support_status, |
513 | True) |
514 | self.addCleanup(bzrrepository.RepositoryFormatMetaDir.unregister_feature, |
515 | "name") |
516 | @@ -1721,5 +1721,5 @@ |
517 | repo = self.make_repository('.') |
518 | repo.lock_write() |
519 | repo._format.features["makes-cheese-sandwich"] = "required" |
520 | - self.assertRaises(errors.MissingFeature, |
521 | + self.assertRaises(bzrdir.MissingFeature, |
522 | repo._format.check_support_status, False) |
523 | |
524 | === modified file 'breezy/tests/test_revisiontree.py' |
525 | --- breezy/tests/test_revisiontree.py 2017-05-25 01:35:55 +0000 |
526 | +++ breezy/tests/test_revisiontree.py 2017-07-15 13:18:35 +0000 |
527 | @@ -21,6 +21,7 @@ |
528 | errors, |
529 | revision, |
530 | ) |
531 | +from breezy.tree import FileTimestampUnavailable |
532 | from breezy.tests import TestCaseWithTransport |
533 | |
534 | |
535 | @@ -76,5 +77,5 @@ |
536 | def test_get_file_mtime_ghost(self): |
537 | file_id = next(iter(self.rev_tree.all_file_ids())) |
538 | self.rev_tree.root_inventory[file_id].revision = 'ghostrev' |
539 | - self.assertRaises(errors.FileTimestampUnavailable, |
540 | + self.assertRaises(FileTimestampUnavailable, |
541 | self.rev_tree.get_file_mtime, file_id) |
542 | |
543 | === modified file 'breezy/tests/test_tree.py' |
544 | --- breezy/tests/test_tree.py 2017-05-25 01:35:55 +0000 |
545 | +++ breezy/tests/test_tree.py 2017-07-15 13:18:35 +0000 |
546 | @@ -21,8 +21,22 @@ |
547 | revision, |
548 | tree as _mod_tree, |
549 | ) |
550 | -from breezy.tests import TestCaseWithTransport |
551 | -from breezy.tree import InterTree |
552 | +from breezy.tests import ( |
553 | + TestCase, |
554 | + TestCaseWithTransport, |
555 | + ) |
556 | +from breezy.tree import ( |
557 | + FileTimestampUnavailable, |
558 | + InterTree, |
559 | + ) |
560 | + |
561 | + |
562 | +class ErrorTests(TestCase): |
563 | + |
564 | + def test_file_timestamp_unavailable(self): |
565 | + e = FileTimestampUnavailable("/path/foo") |
566 | + self.assertEqual("The filestamp for /path/foo is not available.", |
567 | + str(e)) |
568 | |
569 | |
570 | class TestInterTree(TestCaseWithTransport): |
571 | |
572 | === modified file 'breezy/tests/test_workingtree.py' |
573 | --- breezy/tests/test_workingtree.py 2017-06-10 16:40:42 +0000 |
574 | +++ breezy/tests/test_workingtree.py 2017-07-15 13:18:35 +0000 |
575 | @@ -228,7 +228,7 @@ |
576 | tree.controldir) |
577 | self.assertIsInstance(found_format, workingtree.WorkingTreeFormat) |
578 | self.assertEqual(found_format.features.get("name"), "necessity") |
579 | - self.assertRaises(errors.MissingFeature, found_format.check_support_status, |
580 | + self.assertRaises(bzrdir.MissingFeature, found_format.check_support_status, |
581 | True) |
582 | self.addCleanup(bzrworkingtree.WorkingTreeFormatMetaDir.unregister_feature, |
583 | "name") |
584 | |
585 | === modified file 'breezy/tree.py' |
586 | --- breezy/tree.py 2017-06-10 23:37:36 +0000 |
587 | +++ breezy/tree.py 2017-07-15 13:18:35 +0000 |
588 | @@ -29,9 +29,7 @@ |
589 | conflicts as _mod_conflicts, |
590 | debug, |
591 | delta, |
592 | - errors, |
593 | filters, |
594 | - osutils, |
595 | revision as _mod_revision, |
596 | rules, |
597 | trace, |
598 | @@ -42,6 +40,10 @@ |
599 | from breezy.i18n import gettext |
600 | """) |
601 | |
602 | +from . import ( |
603 | + errors, |
604 | + osutils, |
605 | + ) |
606 | from .decorators import needs_read_lock |
607 | from .inter import InterObject |
608 | from .sixish import ( |
609 | @@ -49,6 +51,16 @@ |
610 | ) |
611 | |
612 | |
613 | +class FileTimestampUnavailable(errors.BzrError): |
614 | + |
615 | + _fmt = "The filestamp for %(path)s is not available." |
616 | + |
617 | + internal_error = True |
618 | + |
619 | + def __init__(self, path): |
620 | + self.path = path |
621 | + |
622 | + |
623 | class Tree(object): |
624 | """Abstract file tree. |
625 |
Looks good. One side effect of this is on translations I think? May need to modify breezy.export_pot to look in more places for error subclasess, or come up with a better scheme.