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

Unified Diff: dashboard/dashboard/pinpoint/handlers/gitiles.py

Issue 3013683002: [pinpoint] Add a mapping from repository URLs to repository names. (Closed)
Patch Set: /api/gitiles Created 3 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: dashboard/dashboard/pinpoint/handlers/gitiles.py
diff --git a/dashboard/dashboard/pinpoint/handlers/gitiles.py b/dashboard/dashboard/pinpoint/handlers/gitiles.py
index f4820d68ff664b9d0d20cfa7da2f0b8bf7875bf3..84ef1624a21d5ac1eba56e0796934162e5790d5a 100644
--- a/dashboard/dashboard/pinpoint/handlers/gitiles.py
+++ b/dashboard/dashboard/pinpoint/handlers/gitiles.py
@@ -5,12 +5,12 @@
import json
import webapp2
-from dashboard.common import namespaced_stored_object
+from dashboard.pinpoint.models.change import repository
from dashboard.services import gitiles_service
-_REPOSITORIES_KEY = 'repositories'
-
+# TODO: Remove this module. Cache commit git details in the Datastore and
+# include them in Commit.AsDict().
class Gitiles(webapp2.RequestHandler):
"""Handler that exposes gitiles service to UI."""
@@ -19,14 +19,13 @@ class Gitiles(webapp2.RequestHandler):
git_hash_1 = self.request.get('git_hash', self.request.get('git_hash_1'))
git_hash_2 = self.request.get('git_hash_2')
- repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY)
- if repo not in repositories:
+ try:
+ repository_url = repository.RepositoryUrl(repo)
+ except KeyError:
self.response.out.write(json.dumps(
{'error': 'Unknown repository: %s' % repo}))
return
- repository_url = repositories[repo]['repository_url']
-
if not git_hash_1:
self.response.out.write(json.dumps(
{'error': "No 'git_hash' parameter specified."}))

Powered by Google App Engine
This is Rietveld 408576698