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

Side by Side Diff: tools/findit/git_repository_parser.py

Issue 617073010: [Findit] Add timestamp of CL commit and fix two bugs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « tools/findit/findit_for_crash.py ('k') | tools/findit/match_set.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 (c) 2014 The Chromium Authors. All rights reserved. 1 # Copyright (c) 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 import xml.dom.minidom as minidom 6 import xml.dom.minidom as minidom
7 from xml.parsers.expat import ExpatError 7 from xml.parsers.expat import ExpatError
8 8
9 import crash_utils 9 import crash_utils
10 from repository_parser_interface import ParserInterface 10 from repository_parser_interface import ParserInterface
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if len(trs) != 3: 86 if len(trs) != 3:
87 continue 87 continue
88 88
89 # Retrieve git hash. 89 # Retrieve git hash.
90 githash = trs[0].getElementsByTagName('a')[0].firstChild.nodeValue 90 githash = trs[0].getElementsByTagName('a')[0].firstChild.nodeValue
91 91
92 # Retrieve and set author. 92 # Retrieve and set author.
93 author = trs[1].getElementsByTagName( 93 author = trs[1].getElementsByTagName(
94 'td')[0].firstChild.nodeValue.split('<')[0] 94 'td')[0].firstChild.nodeValue.split('<')[0]
95 revision['author'] = author 95 revision['author'] = author
96 revision['time'] = trs[1].getElementsByTagName(
97 'td')[0].firstChild.nodeValue
96 98
97 # Retrive and set message. 99 # Retrive and set message.
98 revision['message'] = pre.firstChild.nodeValue 100 revision['message'] = pre.firstChild.nodeValue
99 101
100 # Set url of this CL. 102 # Set url of this CL.
101 revision_url_part = self.url_parts_map['revision_url'] % githash 103 revision_url_part = self.url_parts_map['revision_url'] % githash
102 revision['url'] = base_url + revision_url_part 104 revision['url'] = base_url + revision_url_part
103 105
104 # Go through changed files, they are in li. 106 # Go through changed files, they are in li.
105 lis = ul.getElementsByTagName('li') 107 lis = ul.getElementsByTagName('li')
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 json_revision = crash_utils.LoadJSON(response[5:]) 178 json_revision = crash_utils.LoadJSON(response[5:])
177 if not json_revision: 179 if not json_revision:
178 return 180 return
179 181
180 # Create a map representing object and get githash from the JSON object. 182 # Create a map representing object and get githash from the JSON object.
181 revision = {} 183 revision = {}
182 githash = json_revision['commit'] 184 githash = json_revision['commit']
183 185
184 # Set author, message and URL of this CL. 186 # Set author, message and URL of this CL.
185 revision['author'] = json_revision['author']['name'] 187 revision['author'] = json_revision['author']['name']
188 revision['time'] = json_revision['author']['time']
186 revision['message'] = json_revision['message'] 189 revision['message'] = json_revision['message']
187 revision['url'] = url 190 revision['url'] = url
188 191
189 # Iterate through the changed files. 192 # Iterate through the changed files.
190 for diff in json_revision['tree_diff']: 193 for diff in json_revision['tree_diff']:
191 file_path = diff['new_path'] 194 file_path = diff['new_path']
192 file_change_type = diff['type'] 195 file_change_type = diff['type']
193 196
194 # Normalize file action so that it fits with svn_repository_parser. 197 # Normalize file action so that it fits with svn_repository_parser.
195 file_change_type = _ConvertToFileChangeType(file_change_type) 198 file_change_type = _ConvertToFileChangeType(file_change_type)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 # If we are in the right region, get the information from the line. 279 # If we are in the right region, get the information from the line.
277 revision = blame_line['commit'] 280 revision = blame_line['commit']
278 author = blame_line['author']['name'] 281 author = blame_line['author']['name']
279 revision_url_parts = self.url_parts_map['revision_url'] % revision 282 revision_url_parts = self.url_parts_map['revision_url'] % revision
280 revision_url = base_url + revision_url_parts 283 revision_url = base_url + revision_url_parts
281 # TODO(jeun): Add a way to get content from JSON object. 284 # TODO(jeun): Add a way to get content from JSON object.
282 content = None 285 content = None
283 286
284 (revision_info, _) = self.ParseChangelog(component, revision, revision) 287 (revision_info, _) = self.ParseChangelog(component, revision, revision)
285 message = revision_info[revision]['message'] 288 message = revision_info[revision]['message']
286 return (content, revision, author, revision_url, message) 289 time = revision_info[revision]['time']
290 return (content, revision, author, revision_url, message, time)
287 291
288 # Return none if the region does not exist. 292 # Return none if the region does not exist.
289 return None 293 return None
OLDNEW
« no previous file with comments | « tools/findit/findit_for_crash.py ('k') | tools/findit/match_set.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698