Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Side by Side Diff: appengine/findit/lib/gitiles/gitiles_repository.py

Issue 2344443005: [Findit] Factoring the gitiles (etc) stuff out into its own directory (Closed)
Patch Set: reordering imports Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 from common import diff 11 # TODO(http://crbug.com/660466): We should try to break dependencies.
12 from common.blame import Blame 12 from lib.cache_decorator import Cached
13 from common.blame import Region 13 from lib.cache_decorator import CompressedMemCacher
14 from common.cache_decorator import Cached 14 from lib.gitiles import diff
15 from common.cache_decorator import CompressedMemCacher 15 from lib.gitiles.blame import Blame
16 from common.change_log import ChangeLog 16 from lib.gitiles.blame import Region
17 from common.change_log import FileChangeInfo 17 from lib.gitiles.change_log import ChangeLog
18 from common.repository import Repository 18 from lib.gitiles.change_log import FileChangeInfo
19 19 from lib.gitiles.git_repository import GitRepository
20 20
21 COMMIT_POSITION_PATTERN = re.compile( 21 COMMIT_POSITION_PATTERN = re.compile(
22 '^Cr-Commit-Position: refs/heads/master@{#(\d+)}$', re.IGNORECASE) 22 '^Cr-Commit-Position: refs/heads/master@{#(\d+)}$', re.IGNORECASE)
23 CODE_REVIEW_URL_PATTERN = re.compile( 23 CODE_REVIEW_URL_PATTERN = re.compile(
24 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE) 24 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE)
25 REVERTED_REVISION_PATTERN = re.compile( 25 REVERTED_REVISION_PATTERN = re.compile(
26 '^> Committed: https://.+/([0-9a-fA-F]{40})$', re.IGNORECASE) 26 '^> Committed: https://.+/([0-9a-fA-F]{40})$', re.IGNORECASE)
27 TIMEZONE_PATTERN = re.compile('[-+]\d{4}$') 27 TIMEZONE_PATTERN = re.compile('[-+]\d{4}$')
28 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60 28 CACHE_EXPIRE_TIME_SECONDS = 24 * 60 * 60
29 29
30 30
31 class GitRepository(Repository): 31 class GitilesRepository(GitRepository):
32 """Represents a git repository on https://chromium.googlesource.com.""" 32 """Use Gitiles to access a repository on https://chromium.googlesource.com."""
33 33
34 def __init__(self, repo_url=None, http_client=None): 34 def __init__(self, repo_url=None, http_client=None):
35 super(GitRepository, self).__init__() 35 super(GitilesRepository, self).__init__()
36 if repo_url and repo_url.endswith('/'): 36 if repo_url and repo_url.endswith('/'):
37 self._repo_url = repo_url[:-1] 37 self._repo_url = repo_url[:-1]
38 else: 38 else:
39 self._repo_url = repo_url 39 self._repo_url = repo_url
40 40
41 self._http_client = http_client 41 self._http_client = http_client
42 42
43 @property 43 @property
44 def repo_url(self): 44 def repo_url(self):
45 return self._repo_url 45 return self._repo_url
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 282
283 for log in data['log']: 283 for log in data['log']:
284 changelogs.append(self._ParseChangeLogFromLogData(log)) 284 changelogs.append(self._ParseChangeLogFromLogData(log))
285 285
286 if 'next' in data: 286 if 'next' in data:
287 next_end_revision = data['next'] 287 next_end_revision = data['next']
288 else: 288 else:
289 next_end_revision = None 289 next_end_revision = None
290 290
291 return changelogs 291 return changelogs
OLDNEW
« no previous file with comments | « appengine/findit/lib/gitiles/git_repository.py ('k') | appengine/findit/lib/gitiles/test/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698