| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 import hashlib | 6 import hashlib |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 authentication=authentication) | 142 authentication=authentication) |
| 143 elif storage == PATCH_STORAGE_SVN: | 143 elif storage == PATCH_STORAGE_SVN: |
| 144 return self.apply_from_svn(cwd) | 144 return self.apply_from_svn(cwd) |
| 145 elif storage == PATCH_STORAGE_GIT: | 145 elif storage == PATCH_STORAGE_GIT: |
| 146 return self.apply_from_git(cwd) | 146 return self.apply_from_git(cwd) |
| 147 else: | 147 else: |
| 148 # Since this method is "maybe", we don't raise an Exception. | 148 # Since this method is "maybe", we don't raise an Exception. |
| 149 pass | 149 pass |
| 150 | 150 |
| 151 def get_files_affected_by_patch(self): | 151 def get_files_affected_by_patch(self): |
| 152 # DO NOT USE THIS. Use same method in gclient recipe_module. |
| 153 # TODO(tandrii): remove this method completely. |
| 152 git_diff_kwargs = {} | 154 git_diff_kwargs = {} |
| 153 issue_root = self.m.rietveld.calculate_issue_root() | 155 issue_root = self.m.rietveld.calculate_issue_root() |
| 154 if issue_root: | 156 if issue_root: |
| 155 git_diff_kwargs['cwd'] = self.m.path['checkout'].join(issue_root) | 157 git_diff_kwargs['cwd'] = self.m.path['checkout'].join(issue_root) |
| 156 step_result = self.m.git('diff', '--cached', '--name-only', | 158 step_result = self.m.git('diff', '--cached', '--name-only', |
| 157 name='git diff to analyze patch', | 159 name='git diff to analyze patch', |
| 158 stdout=self.m.raw_io.output(), | 160 stdout=self.m.raw_io.output(), |
| 159 step_test_data=lambda: | 161 step_test_data=lambda: |
| 160 self.m.raw_io.test_api.stream_output('foo.cc'), | 162 self.m.raw_io.test_api.stream_output('foo.cc'), |
| 161 **git_diff_kwargs) | 163 **git_diff_kwargs) |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 self.add_failure_reason(e.reason) | 240 self.add_failure_reason(e.reason) |
| 239 | 241 |
| 240 failure_hash = hashlib.sha1() | 242 failure_hash = hashlib.sha1() |
| 241 failure_hash.update(self.m.json.dumps(self._failure_reasons)) | 243 failure_hash.update(self.m.json.dumps(self._failure_reasons)) |
| 242 | 244 |
| 243 step_result = self.m.step.active_result | 245 step_result = self.m.step.active_result |
| 244 step_result.presentation.properties['failure_hash'] = \ | 246 step_result.presentation.properties['failure_hash'] = \ |
| 245 failure_hash.hexdigest() | 247 failure_hash.hexdigest() |
| 246 | 248 |
| 247 raise | 249 raise |
| OLD | NEW |