OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from common.git_repository import GitRepository | |
6 from common.http_client_appengine import HttpClientAppengine as HttpClient | 5 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 6 from common.pipeline_wrapper import BasePipeline |
7 from common.pipeline_wrapper import pipeline | 7 from common.pipeline_wrapper import pipeline |
8 from common.pipeline_wrapper import BasePipeline | 8 from lib.gitiles.gitiles_repository import GitilesRepository |
9 | 9 |
10 | 10 |
11 class PullChangelogPipeline(BasePipeline): | 11 class PullChangelogPipeline(BasePipeline): |
12 """A pipeline to pull change log of CLs.""" | 12 """A pipeline to pull change log of CLs.""" |
13 | 13 |
14 # TODO: for files in dependencies(blink, v8, skia, etc), use blame first. | 14 # TODO: for files in dependencies(blink, v8, skia, etc), use blame first. |
15 GIT_REPO = GitRepository( | 15 GIT_REPO = GitilesRepository( |
16 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) | 16 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) |
17 | 17 |
18 # Arguments number differs from overridden method - pylint: disable=W0221 | 18 # Arguments number differs from overridden method - pylint: disable=W0221 |
19 def run(self, failure_info): | 19 def run(self, failure_info): |
20 """ | 20 """ |
21 Args: | 21 Args: |
22 failure_info (dict): Output of pipeline DetectFirstFailurePipeline.run(). | 22 failure_info (dict): Output of pipeline DetectFirstFailurePipeline.run(). |
23 | 23 |
24 Returns: | 24 Returns: |
25 A dict with the following form: | 25 A dict with the following form: |
26 { | 26 { |
27 'git_hash_revision1': common.change_log.ChangeLog.ToDict(), | 27 'git_hash_revision1': common.change_log.ChangeLog.ToDict(), |
28 ... | 28 ... |
29 } | 29 } |
30 """ | 30 """ |
31 change_logs = {} | 31 change_logs = {} |
32 if not failure_info['failed'] or not failure_info['chromium_revision']: | 32 if not failure_info['failed'] or not failure_info['chromium_revision']: |
33 # Bail out if no failed step or no chromium revision. | 33 # Bail out if no failed step or no chromium revision. |
34 return change_logs | 34 return change_logs |
35 | 35 |
36 for build in failure_info.get('builds', {}).values(): | 36 for build in failure_info.get('builds', {}).values(): |
37 for revision in build['blame_list']: | 37 for revision in build['blame_list']: |
38 change_log = self.GIT_REPO.GetChangeLog(revision) | 38 change_log = self.GIT_REPO.GetChangeLog(revision) |
39 if not change_log: # pragma: no cover | 39 if not change_log: # pragma: no cover |
40 raise pipeline.Retry('Failed to get change log for %s' % revision) | 40 raise pipeline.Retry('Failed to get change log for %s' % revision) |
41 | 41 |
42 change_logs[revision] = change_log.ToDict() | 42 change_logs[revision] = change_log.ToDict() |
43 | 43 |
44 return change_logs | 44 return change_logs |
OLD | NEW |