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

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

Issue 2248653002: Revert of Fix pylint warnings in webkitpy/common/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manual Revert (Patch Set 1 causes patch failure in read_checksum_from_png_unittest.py) 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 13 matching lines...) Expand all
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 28
29 """WebKit's Python module for interacting with patches.""" 29 """WebKit's Python module for interacting with patches."""
30 30
31 import logging 31 import logging
32 import re 32 import re
33 33
34
35 _log = logging.getLogger(__name__) 34 _log = logging.getLogger(__name__)
36 35
37
38 conversion_patterns = ( 36 conversion_patterns = (
39 (re.compile(r"^diff --git \w/(.+) \w/(?P<FilePath>.+)"), lambda matched: "In dex: " + matched.group('FilePath') + "\n"), 37 (re.compile("^diff --git \w/(.+) \w/(?P<FilePath>.+)"), lambda matched: "Ind ex: " + matched.group('FilePath') + "\n"),
40 (re.compile(r"^new file.*"), lambda matched: "\n"), 38 (re.compile("^new file.*"), lambda matched: "\n"),
41 (re.compile(r"^index (([0-9a-f]{7}\.\.[0-9a-f]{7})|([0-9a-f]{40}\.\.[0-9a-f] {40})) [0-9]{6}"), 39 (re.compile("^index (([0-9a-f]{7}\.\.[0-9a-f]{7})|([0-9a-f]{40}\.\.[0-9a-f]{ 40})) [0-9]{6}"),
42 lambda matched: ("=" * 67) + "\n"), 40 lambda matched: ("=" * 67) + "\n"),
43 (re.compile(r"^--- \w/(?P<FilePath>.+)"), lambda matched: "--- " + matched.g roup('FilePath') + "\n"), 41 (re.compile("^--- \w/(?P<FilePath>.+)"), lambda matched: "--- " + matched.gr oup('FilePath') + "\n"),
44 (re.compile(r"^\+\+\+ \w/(?P<FilePath>.+)"), lambda matched: "+++ " + matche d.group('FilePath') + "\n"), 42 (re.compile("^\+\+\+ \w/(?P<FilePath>.+)"), lambda matched: "+++ " + matched .group('FilePath') + "\n"),
45 ) 43 )
46 44
47 index_pattern = re.compile(r"^Index: (?P<FilePath>.+)") 45 index_pattern = re.compile(r"^Index: (?P<FilePath>.+)")
48 lines_changed_pattern = re.compile(r"^@@ -(?P<OldStartLine>\d+)(,\d+)? \+(?P<New StartLine>\d+)(,\d+)? @@") 46 lines_changed_pattern = re.compile(r"^@@ -(?P<OldStartLine>\d+)(,\d+)? \+(?P<New StartLine>\d+)(,\d+)? @@")
49 diff_git_pattern = re.compile(r"^diff --git \w/") 47 diff_git_pattern = re.compile(r"^diff --git \w/")
50 48
51 49
52 def git_diff_to_svn_diff(line): 50 def git_diff_to_svn_diff(line):
53 """Converts a git formatted diff line to a svn formatted line. 51 """Converts a git formatted diff line to a svn formatted line.
54 52
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 elif line.startswith(' '): 172 elif line.startswith(' '):
175 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:])
176 old_diff_line += 1 174 old_diff_line += 1
177 new_diff_line += 1 175 new_diff_line += 1
178 elif line == '\\ No newline at end of file': 176 elif line == '\\ No newline at end of file':
179 # Nothing to do. We may still have some added lines. 177 # Nothing to do. We may still have some added lines.
180 pass 178 pass
181 else: 179 else:
182 _log.error('Unexpected diff format when parsing a chunk: %r' , line) 180 _log.error('Unexpected diff format when parsing a chunk: %r' , line)
183 return files 181 return files
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698