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 # TODO(crbug.com/659449): Refactor the http_client to be required argument. |
|
wrengr
2016/11/22 19:11:53
Can get rid of this todo
Sharu Jiang
2016/11/22 20:15:38
Done.
| |
| 37 def __init__(self, repo_url=None, http_client=None): | 37 def __init__(self, http_client, repo_url=None): |
| 38 super(GitilesRepository, self).__init__() | 38 super(GitilesRepository, self).__init__() |
| 39 if repo_url and repo_url.endswith('/'): | 39 if repo_url and repo_url.endswith('/'): |
| 40 self._repo_url = repo_url[:-1] | 40 self._repo_url = repo_url[:-1] |
| 41 else: | 41 else: |
| 42 self._repo_url = repo_url | 42 self._repo_url = repo_url |
| 43 | 43 |
| 44 self._http_client = http_client | 44 self._http_client = http_client |
| 45 | 45 |
| 46 @property | 46 @property |
| 47 def repo_url(self): | 47 def repo_url(self): |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 222 |
| 223 for log in data['log']: | 223 for log in data['log']: |
| 224 changelogs.append(self._ParseChangeLogFromLogData(log)) | 224 changelogs.append(self._ParseChangeLogFromLogData(log)) |
| 225 | 225 |
| 226 if 'next' in data: | 226 if 'next' in data: |
| 227 next_end_revision = data['next'] | 227 next_end_revision = data['next'] |
| 228 else: | 228 else: |
| 229 next_end_revision = None | 229 next_end_revision = None |
| 230 | 230 |
| 231 return changelogs | 231 return changelogs |
| OLD | NEW |