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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/diff_parser.py

Issue 2188623002: Change logging statements to not use the "%" operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 # Copyright (C) 2009 Google Inc. All rights reserved. 1 # Copyright (C) 2009 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if file_declaration: 149 if file_declaration:
150 filename = file_declaration.group('FilePath') 150 filename = file_declaration.group('FilePath')
151 current_file = DiffFile(filename) 151 current_file = DiffFile(filename)
152 files[filename] = current_file 152 files[filename] = current_file
153 state = _DECLARED_FILE_PATH 153 state = _DECLARED_FILE_PATH
154 continue 154 continue
155 155
156 lines_changed = lines_changed_pattern.match(line) 156 lines_changed = lines_changed_pattern.match(line)
157 if lines_changed: 157 if lines_changed:
158 if state != _DECLARED_FILE_PATH and state != _PROCESSING_CHUNK: 158 if state != _DECLARED_FILE_PATH and state != _PROCESSING_CHUNK:
159 _log.error('Unexpected line change without file path ' 159 _log.error('Unexpected line change without file path declara tion: %r', line)
160 'declaration: %r' % line)
161 old_diff_line = int(lines_changed.group('OldStartLine')) 160 old_diff_line = int(lines_changed.group('OldStartLine'))
162 new_diff_line = int(lines_changed.group('NewStartLine')) 161 new_diff_line = int(lines_changed.group('NewStartLine'))
163 state = _PROCESSING_CHUNK 162 state = _PROCESSING_CHUNK
164 continue 163 continue
165 164
166 if state == _PROCESSING_CHUNK: 165 if state == _PROCESSING_CHUNK:
167 if line.startswith('+'): 166 if line.startswith('+'):
168 current_file.add_new_line(new_diff_line, line[1:]) 167 current_file.add_new_line(new_diff_line, line[1:])
169 new_diff_line += 1 168 new_diff_line += 1
170 elif line.startswith('-'): 169 elif line.startswith('-'):
171 current_file.add_deleted_line(old_diff_line, line[1:]) 170 current_file.add_deleted_line(old_diff_line, line[1:])
172 old_diff_line += 1 171 old_diff_line += 1
173 elif line.startswith(' '): 172 elif line.startswith(' '):
174 current_file.add_unchanged_line(old_diff_line, new_diff_line , line[1:]) 173 current_file.add_unchanged_line(old_diff_line, new_diff_line , line[1:])
175 old_diff_line += 1 174 old_diff_line += 1
176 new_diff_line += 1 175 new_diff_line += 1
177 elif line == '\\ No newline at end of file': 176 elif line == '\\ No newline at end of file':
178 # Nothing to do. We may still have some added lines. 177 # Nothing to do. We may still have some added lines.
179 pass 178 pass
180 else: 179 else:
181 _log.error('Unexpected diff format when parsing a ' 180 _log.error('Unexpected diff format when parsing a chunk: %r' , line)
182 'chunk: %r' % line)
183 return files 181 return files
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698