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

Side by Side Diff: dashboard/dashboard/pinpoint/models/change.py

Issue 2998883002: [pinpoint] Strip '.git' from the end of repository URLs in DEPS files. (Closed)
Patch Set: Created 3 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/models/change_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 collections 5 import collections
6 6
7 from dashboard.common import namespaced_stored_object 7 from dashboard.common import namespaced_stored_object
8 from dashboard.services import gitiles_service 8 from dashboard.services import gitiles_service
9 9
10 10
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 def id_string(self): 284 def id_string(self):
285 return '%s/%d/%d' % (self.server, self.issue, self.patchset) 285 return '%s/%d/%d' % (self.server, self.issue, self.patchset)
286 286
287 @classmethod 287 @classmethod
288 def FromDict(cls, data): 288 def FromDict(cls, data):
289 # TODO: Validate to ensure the patch exists on the server. 289 # TODO: Validate to ensure the patch exists on the server.
290 return cls(data['server'], data['issue'], data['patchset']) 290 return cls(data['server'], data['issue'], data['patchset'])
291 291
292 292
293 def _Repository(repository_url): 293 def _Repository(repository_url):
294 if repository_url.endswith('.git'):
295 repository_url = repository_url[:-4]
296
294 repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY) 297 repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY)
295 for repo_label, repo_info in repositories.iteritems(): 298 for repo_label, repo_info in repositories.iteritems():
296 if repository_url == repo_info['repository_url']: 299 if repository_url == repo_info['repository_url']:
297 return repo_label 300 return repo_label
298 301
299 return None 302 return None
300 303
301 304
302 def _AddRepository(repository_url): 305 def _AddRepository(repository_url):
306 if repository_url.endswith('.git'):
307 repository_url = repository_url[:-4]
308
303 repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY) 309 repositories = namespaced_stored_object.Get(_REPOSITORIES_KEY)
304 repository = repository_url.split('/')[-1] 310 repository = repository_url.split('/')[-1]
305 if repository.endswith('.git'):
306 repository = repository[:-4]
307 311
308 if repository in repositories: 312 if repository in repositories:
309 raise AssertionError("Attempted to add a repository that's already in the " 313 raise AssertionError("Attempted to add a repository that's already in the "
310 'Datastore: %s: %s' % (repository, repository_url)) 314 'Datastore: %s: %s' % (repository, repository_url))
311 315
312 repositories[repository] = {'repository_url': repository_url} 316 repositories[repository] = {'repository_url': repository_url}
313 namespaced_stored_object.Set(_REPOSITORIES_KEY, repositories) 317 namespaced_stored_object.Set(_REPOSITORIES_KEY, repositories)
OLDNEW
« no previous file with comments | « no previous file | dashboard/dashboard/pinpoint/models/change_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698