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

Side by Side Diff: infra/tools/antibody/git_commit_parser.py

Issue 1251323005: Changed parser to identify review urls following Reviewed-on: (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@antibody-stats-generator
Patch Set: Fixed regexps Created 5 years, 5 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 datetime 5 import datetime
6 import dateutil.parser 6 import dateutil.parser
7 import pytz 7 import pytz
8 import re 8 import re
9 import subprocess 9 import subprocess
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 tbr = [x.strip().split('@')[0] for x in tbr.split(',')] 72 tbr = [x.strip().split('@')[0] for x in tbr.split(',')]
73 else: 73 else:
74 tbr = ['NOBODY'] 74 tbr = ['NOBODY']
75 return tbr 75 return tbr
76 76
77 77
78 # TODO(keelerh): scan all review urls in a commit and compare the diffs to 78 # TODO(keelerh): scan all review urls in a commit and compare the diffs to
79 # identify the correct one 79 # identify the correct one
80 def get_review_url(git_line): 80 def get_review_url(git_line):
81 review_url = None 81 review_url = None
82 if re.match(r'^Review:.+$', git_line): 82 if re.match(r'^Review: .+$', git_line):
83 review_url = git_line[8:] 83 review_url = git_line[7:]
84 elif re.match(r'^Review URL:.+$', git_line): 84 elif re.match(r'^Review URL: .+$', git_line):
85 review_url = git_line[11:]
86 elif re.match(r'^Code review URL: .+$', git_line):
87 review_url = git_line[16:]
88 elif re.match(r'^Reviewed-on: .+$', git_line):
85 review_url = git_line[12:] 89 review_url = git_line[12:]
pgervais 2015/07/23 18:50:55 This is consistent but the number in git_line shou
86 elif re.match(r'^Code review URL:.+$', git_line):
87 review_url = git_line[17:]
88 return review_url 90 return review_url
89 91
90 92
91 def get_features_for_git_commit(git_commit): 93 def get_features_for_git_commit(git_commit):
92 """Retrieves the git commit features 94 """Retrieves the git commit features
93 95
94 Arg: 96 Arg:
95 git_commit(dict): a commit message parsed into a dictionary 97 git_commit(dict): a commit message parsed into a dictionary
96 98
97 Return: 99 Return:
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 WHERE type='tbr' 203 WHERE type='tbr'
202 GROUP BY git_commit_hash) tbr_count 204 GROUP BY git_commit_hash) tbr_count
203 ON commit_people.git_commit_hash = tbr_count.git_commit_hash 205 ON commit_people.git_commit_hash = tbr_count.git_commit_hash
204 INNER JOIN git_commit 206 INNER JOIN git_commit
205 ON commit_people.git_commit_hash = git_commit.hash 207 ON commit_people.git_commit_hash = git_commit.hash
206 WHERE tbr_count.c <> 0 208 WHERE tbr_count.c <> 0
207 AND git_commit.review_url IS NOT NULL 209 AND git_commit.review_url IS NOT NULL
208 AND commit_people.type='author'""") 210 AND commit_people.type='author'""")
209 commits_with_review_urls = cc.fetchall() 211 commits_with_review_urls = cc.fetchall()
210 return [x[0] for x in commits_with_review_urls] 212 return [x[0] for x in commits_with_review_urls]
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698