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

Unified Diff: tools/findit/git_repository_parser.py

Issue 504443004: [Findit] Improve output format and cherry-pick bugs fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. 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
« no previous file with comments | « tools/findit/findit_for_crash.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/findit/git_repository_parser.py
diff --git a/tools/findit/git_repository_parser.py b/tools/findit/git_repository_parser.py
index d4564f8ae53bba473092a32e9fa06d6aa8535237..2db75f4ea9b761badb6dda081a1d926e76352728 100644
--- a/tools/findit/git_repository_parser.py
+++ b/tools/findit/git_repository_parser.py
@@ -11,11 +11,18 @@ from repository_parser_interface import ParserInterface
FILE_CHANGE_TYPE_MAP = {
'add': 'A',
+ 'copy': 'C',
'delete': 'D',
- 'modify': 'M'
+ 'modify': 'M',
+ 'rename': 'R'
}
+def _ConvertToFileChangeType(file_action):
+ # TODO(stgao): verify impact on code that checks the file change type.
+ return file_action[0].upper()
+
+
class GitParser(ParserInterface):
"""Parser for Git repository in googlesource.
@@ -103,7 +110,7 @@ class GitParser(ParserInterface):
0].getAttribute('class')
# Normalize file action so that it is same as SVN parser.
- file_change_type = FILE_CHANGE_TYPE_MAP[file_change_type]
+ file_change_type = _ConvertToFileChangeType(file_change_type)
# Add the changed file to the map.
if file_path not in file_to_revision_map:
@@ -185,7 +192,7 @@ class GitParser(ParserInterface):
file_change_type = diff['type']
# Normalize file action so that it fits with svn_repository_parser.
- file_change_type = FILE_CHANGE_TYPE_MAP[file_change_type]
+ file_change_type = _ConvertToFileChangeType(file_change_type)
# Add the file to the map.
if file_path not in file_to_revision_map:
@@ -204,7 +211,8 @@ class GitParser(ParserInterface):
backup_url = (base_url + self.url_parts_map['revision_url']) % githash
# If the file is added (not modified), treat it as if it is not changed.
- if file_change_type == 'A':
+ if file_change_type in ('A', 'R'):
aarya 2014/08/26 20:34:18 you forgot 'C'
stgao 2014/08/26 20:50:35 Done.
+ # TODO(stgao): Maybe return whole file change for Add, Rename, and Copy?
return (backup_url, changed_line_numbers, changed_line_contents)
# Retrieves the diff data from URL, and if it fails, return emptry lines.
« no previous file with comments | « tools/findit/findit_for_crash.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698