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/common/repo_util.py

Issue 2432113002: [Findit] Add local_git_repository (Closed)
Patch Set: . Created 4 years, 2 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
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 json 5 import json
6 import re 6 import re
7 import urllib2 7 import urllib2
8 8
9 CODE_REVIEW_URL_PATTERN = re.compile( 9 CODE_REVIEW_URL_PATTERN = re.compile(
10 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE) 10 '^(?:Review URL|Review-Url): (.*\d+).*$', re.IGNORECASE)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 """Parse message to get the reverted revision if there is one.""" 65 """Parse message to get the reverted revision if there is one."""
66 lines = message.strip().splitlines() 66 lines = message.strip().splitlines()
67 if not lines[0].lower().startswith('revert'): 67 if not lines[0].lower().startswith('revert'):
68 return None 68 return None
69 69
70 for line in reversed(lines): # pragma: no cover 70 for line in reversed(lines): # pragma: no cover
71 # TODO: Handle cases where no reverted_revision in reverting message. 71 # TODO: Handle cases where no reverted_revision in reverting message.
72 reverted_revision_match = REVERTED_REVISION_PATTERN.match(line) 72 reverted_revision_match = REVERTED_REVISION_PATTERN.match(line)
73 if reverted_revision_match: 73 if reverted_revision_match:
74 return reverted_revision_match.group(1) 74 return reverted_revision_match.group(1)
75
76
77 def GetRepoToCloneUrlDict(host_url):
stgao 2016/10/22 00:43:35 If this is not needed, we should delete in the oth
Sharu Jiang 2016/10/25 06:45:16 Done.
78 # Gerrit prepends )]}' to json-formatted response.
79 content = urllib2.urlopen('%s?format=json' % host_url).read()
80 prefix = ')]}\'\n'
81 repo_infos = json.loads(content[len(prefix):])
82
83 repo_to_clone_url = {}
84 for repo, repo_info in repo_infos.iteritems():
85 repo_to_clone_url[repo] = repo_info['clone_url']
86
87 return repo_to_clone_url
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698