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

Unified Diff: tools/findit/svn_repository_parser.py

Issue 478763003: [Findit] Bug fixing and implemented some feature requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed a bug in intersection Created 6 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 side-by-side diff with in-line comments
Download patch
« tools/findit/stacktrace.py ('K') | « tools/findit/stacktrace.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/findit/svn_repository_parser.py
diff --git a/tools/findit/svn_repository_parser.py b/tools/findit/svn_repository_parser.py
index be1965d66adc88e585541e77310c1c2adfa56c02..4ed8c92a62eb0e482f4730d9a3980d33460bbcc0 100644
--- a/tools/findit/svn_repository_parser.py
+++ b/tools/findit/svn_repository_parser.py
@@ -1,9 +1,8 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
-import os
import xml.dom.minidom as minidom
from xml.parsers.expat import ExpatError
@@ -80,14 +79,16 @@ class SVNParser(ParserInterface):
for changed_path in paths[0].getElementsByTagName('path'):
# Get path, file action and file name from the xml.
stgao 2014/08/22 06:50:54 comment is not updated.
jeun 2014/08/22 22:58:44 Done.
file_path = changed_path.firstChild.nodeValue
- file_action = changed_path.getAttribute('action')
- changed_file = os.path.basename(file_path)
+ file_change_type = changed_path.getAttribute('action')
+
+ if file_path.startswith('/trunk/'):
+ file_path = file_path[len('/trunk/'):]
# Add file to the map.
- if changed_file not in file_to_revision_map:
- file_to_revision_map[changed_file] = []
- file_to_revision_map[changed_file].append(
- (revision_number, file_action, file_path))
+ if file_path not in file_to_revision_map:
+ file_to_revision_map[file_path] = []
+ file_to_revision_map[file_path].append(
+ (revision_number, file_change_type))
# Set commit message of the CL.
revision_object['message'] = revision.getElementsByTagName('msg')[
@@ -102,7 +103,7 @@ class SVNParser(ParserInterface):
return (revision_map, file_to_revision_map)
- def ParseLineDiff(self, path, component, file_action, revision_number):
+ def ParseLineDiff(self, path, component, file_change_type, revision_number):
changed_line_numbers = []
changed_line_contents = []
@@ -113,7 +114,7 @@ class SVNParser(ParserInterface):
# If the file is added (not modified), treat it as if it is not changed.
backup_url = url_map['revision_url'] % revision_number
- if file_action == 'A':
+ if file_change_type == 'A':
return (backup_url, changed_line_numbers, changed_line_contents)
# Retrieve data from the url. If no data is retrieved, return empty lists.
@@ -219,7 +220,11 @@ class SVNParser(ParserInterface):
# Each of the blame result is in <tr>.
blame_results = blame_html.getElementsByTagName('tr')
- blame_result = blame_results[line]
+ try:
+ blame_result = blame_results[line]
+ except IndexError:
+ logging.error('Failed to retrieve blame information from %s.', url)
+ return None
# There must be 4 <td> for each <tr>. If not, this page is wrong.
tds = blame_result.getElementsByTagName('td')
@@ -257,6 +262,9 @@ class SVNParser(ParserInterface):
except IndexError:
revision = tds[2].firstChild.nodeValue
+ (revision_info, _) = self.ParseChangelog(component, revision, revision)
+ message = revision_info[int(revision)]['message']
+
# Return the parsed information.
revision_url = url_map['revision_url'] % int(revision)
- return (line_content, revision, author, revision_url)
+ return (line_content, revision, author, revision_url, message)
« tools/findit/stacktrace.py ('K') | « tools/findit/stacktrace.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698