| 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 from slave import recipe_api | 5 from recipe_engine import recipe_api |
| 6 | 6 |
| 7 import base64 | 7 import base64 |
| 8 | 8 |
| 9 | 9 |
| 10 class Gitiles(recipe_api.RecipeApi): | 10 class Gitiles(recipe_api.RecipeApi): |
| 11 """Module for polling a git repository using the Gitiles web interface.""" | 11 """Module for polling a git repository using the Gitiles web interface.""" |
| 12 | 12 |
| 13 def _fetch(self, url, step_name, attempts=None): | 13 def _fetch(self, url, step_name, attempts=None): |
| 14 args = [ | 14 args = [ |
| 15 '--json-file', self.m.json.output(), | 15 '--json-file', self.m.json.output(), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 step_name: (str) If not None, override the step name. | 86 step_name: (str) If not None, override the step name. |
| 87 | 87 |
| 88 Returns: | 88 Returns: |
| 89 Raw file content. | 89 Raw file content. |
| 90 """ | 90 """ |
| 91 kwargs.setdefault('step_name', 'Gitiles fetch %s' % file_path) | 91 kwargs.setdefault('step_name', 'Gitiles fetch %s' % file_path) |
| 92 full_url = '%s/+/%s/%s?format=text' % (repository_url.rstrip('/'), branch, | 92 full_url = '%s/+/%s/%s?format=text' % (repository_url.rstrip('/'), branch, |
| 93 file_path.lstrip('/')) | 93 file_path.lstrip('/')) |
| 94 b64_data = self.m.url.fetch(full_url, **kwargs) | 94 b64_data = self.m.url.fetch(full_url, **kwargs) |
| 95 return base64.b64decode(b64_data) | 95 return base64.b64decode(b64_data) |
| OLD | NEW |