| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 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 21 matching lines...) Expand all Loading... |
| 32 from webkitpy.tool.steps.options import Options | 32 from webkitpy.tool.steps.options import Options |
| 33 from webkitpy.common.prettypatch import PrettyPatch | 33 from webkitpy.common.prettypatch import PrettyPatch |
| 34 from webkitpy.common.system import logutils | 34 from webkitpy.common.system import logutils |
| 35 from webkitpy.common.system.executive import ScriptError | 35 from webkitpy.common.system.executive import ScriptError |
| 36 | 36 |
| 37 | 37 |
| 38 _log = logutils.get_logger(__file__) | 38 _log = logutils.get_logger(__file__) |
| 39 | 39 |
| 40 | 40 |
| 41 class ConfirmDiff(AbstractStep): | 41 class ConfirmDiff(AbstractStep): |
| 42 |
| 42 @classmethod | 43 @classmethod |
| 43 def options(cls): | 44 def options(cls): |
| 44 return AbstractStep.options() + [ | 45 return AbstractStep.options() + [ |
| 45 Options.confirm, | 46 Options.confirm, |
| 46 ] | 47 ] |
| 47 | 48 |
| 48 def _show_pretty_diff(self): | 49 def _show_pretty_diff(self): |
| 49 if not self._tool.user.can_open_url(): | 50 if not self._tool.user.can_open_url(): |
| 50 return None | 51 return None |
| 51 | 52 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 if self._tool.platform.is_cygwin(): | 67 if self._tool.platform.is_cygwin(): |
| 67 assert file_path.endswith('.html') | 68 assert file_path.endswith('.html') |
| 68 self._tool.executive.run_command(['cygstart', file_path]) | 69 self._tool.executive.run_command(['cygstart', file_path]) |
| 69 return | 70 return |
| 70 url = "file://%s" % urllib.quote(file_path) | 71 url = "file://%s" % urllib.quote(file_path) |
| 71 self._tool.user.open_url(url) | 72 self._tool.user.open_url(url) |
| 72 | 73 |
| 73 def diff(self): | 74 def diff(self): |
| 74 changed_files = self._tool.scm().changed_files(self._options.git_commit) | 75 changed_files = self._tool.scm().changed_files(self._options.git_commit) |
| 75 return self._tool.scm().create_patch(self._options.git_commit, | 76 return self._tool.scm().create_patch(self._options.git_commit, |
| 76 changed_files=changed_files) | 77 changed_files=changed_files) |
| 77 | 78 |
| 78 def run(self, state): | 79 def run(self, state): |
| 79 if not self._options.confirm: | 80 if not self._options.confirm: |
| 80 return | 81 return |
| 81 pretty_diff_file = self._show_pretty_diff() | 82 pretty_diff_file = self._show_pretty_diff() |
| 82 if pretty_diff_file: | 83 if pretty_diff_file: |
| 83 diff_correct = self._tool.user.confirm("Was that diff correct?") | 84 diff_correct = self._tool.user.confirm("Was that diff correct?") |
| 84 pretty_diff_file.close() | 85 pretty_diff_file.close() |
| 85 if not diff_correct: | 86 if not diff_correct: |
| 86 self._exit(1) | 87 self._exit(1) |
| OLD | NEW |