Chromium Code Reviews| 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 base64 | 5 import base64 |
| 6 from datetime import datetime | 6 from datetime import datetime |
| 7 from datetime import timedelta | 7 from datetime import timedelta |
| 8 import json | 8 import json |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE) | 26 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE) |
| 27 REVERTED_REVISION_PATTERN = re.compile( | 27 REVERTED_REVISION_PATTERN = re.compile( |
| 28 '^> Committed: https://.+/([0-9a-fA-F]{40})$', re.IGNORECASE) | 28 '^> Committed: https://.+/([0-9a-fA-F]{40})$', re.IGNORECASE) |
| 29 TIMEZONE_PATTERN = re.compile('[-+]\d{4}$') | 29 TIMEZONE_PATTERN = re.compile('[-+]\d{4}$') |
| 30 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60 | 30 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60 |
| 31 | 31 |
| 32 | 32 |
| 33 class GitilesRepository(GitRepository): | 33 class GitilesRepository(GitRepository): |
| 34 """Use Gitiles to access a repository on https://chromium.googlesource.com.""" | 34 """Use Gitiles to access a repository on https://chromium.googlesource.com.""" |
| 35 | 35 |
| 36 # TODO(crbug.com/659449): Refactor the http_client to be required argument. | 36 def __init__(self, http_client, repo_url=None): |
|
chanli
2016/11/23 06:06:06
Any reason you changed the sequence of the argumen
Sharu Jiang
2016/11/23 19:24:39
Because the http_client is required arguments now,
| |
| 37 def __init__(self, repo_url=None, http_client=None): | |
| 38 super(GitilesRepository, self).__init__() | 37 super(GitilesRepository, self).__init__() |
| 39 if repo_url and repo_url.endswith('/'): | 38 if repo_url and repo_url.endswith('/'): |
| 40 self._repo_url = repo_url[:-1] | 39 self._repo_url = repo_url[:-1] |
| 41 else: | 40 else: |
| 42 self._repo_url = repo_url | 41 self._repo_url = repo_url |
| 43 | 42 |
| 44 self._http_client = http_client | 43 self._http_client = http_client |
| 45 | 44 |
| 46 @property | 45 @property |
| 47 def repo_url(self): | 46 def repo_url(self): |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 221 |
| 223 for log in data['log']: | 222 for log in data['log']: |
| 224 changelogs.append(self._ParseChangeLogFromLogData(log)) | 223 changelogs.append(self._ParseChangeLogFromLogData(log)) |
| 225 | 224 |
| 226 if 'next' in data: | 225 if 'next' in data: |
| 227 next_end_revision = data['next'] | 226 next_end_revision = data['next'] |
| 228 else: | 227 else: |
| 229 next_end_revision = None | 228 next_end_revision = None |
| 230 | 229 |
| 231 return changelogs | 230 return changelogs |
| OLD | NEW |