OLD | NEW |
1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 19 matching lines...) Expand all Loading... |
30 import sys | 30 import sys |
31 | 31 |
32 from webkitpy.tool import steps | 32 from webkitpy.tool import steps |
33 | 33 |
34 from webkitpy.common.system.executive import ScriptError | 34 from webkitpy.common.system.executive import ScriptError |
35 | 35 |
36 _log = logging.getLogger(__name__) | 36 _log = logging.getLogger(__name__) |
37 | 37 |
38 | 38 |
39 class StepSequenceErrorHandler(): | 39 class StepSequenceErrorHandler(): |
| 40 |
40 @classmethod | 41 @classmethod |
41 def handle_script_error(cls, tool, patch, script_error): | 42 def handle_script_error(cls, tool, patch, script_error): |
42 raise NotImplementedError, "subclasses must implement" | 43 raise NotImplementedError, "subclasses must implement" |
43 | 44 |
44 @classmethod | 45 @classmethod |
45 def handle_checkout_needs_update(cls, tool, state, options, error): | 46 def handle_checkout_needs_update(cls, tool, state, options, error): |
46 raise NotImplementedError, "subclasses must implement" | 47 raise NotImplementedError, "subclasses must implement" |
47 | 48 |
48 | 49 |
49 class StepSequence(object): | 50 class StepSequence(object): |
| 51 |
50 def __init__(self, steps): | 52 def __init__(self, steps): |
51 self._steps = steps or [] | 53 self._steps = steps or [] |
52 | 54 |
53 def options(self): | 55 def options(self): |
54 collected_options = [ | 56 collected_options = [ |
55 steps.Options.parent_command, | 57 steps.Options.parent_command, |
56 steps.Options.quiet, | 58 steps.Options.quiet, |
57 ] | 59 ] |
58 for step in self._steps: | 60 for step in self._steps: |
59 collected_options = collected_options + step.options() | 61 collected_options = collected_options + step.options() |
(...skipping 18 matching lines...) Expand all Loading... |
78 state = {} | 80 state = {} |
79 try: | 81 try: |
80 self._run(tool, options, state) | 82 self._run(tool, options, state) |
81 except ScriptError, e: | 83 except ScriptError, e: |
82 if not options.quiet: | 84 if not options.quiet: |
83 _log.error(e.message_with_output()) | 85 _log.error(e.message_with_output()) |
84 if options.parent_command: | 86 if options.parent_command: |
85 command = tool.command_by_name(options.parent_command) | 87 command = tool.command_by_name(options.parent_command) |
86 command.handle_script_error(tool, state, e) | 88 command.handle_script_error(tool, state, e) |
87 self.exit_after_handled_error(e) | 89 self.exit_after_handled_error(e) |
OLD | NEW |