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

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

Issue 1839193004: Run auto-formatter (autopep8) on webkitpy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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 18 matching lines...) Expand all
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 _log = logging.getLogger(__name__) 34 _log = logging.getLogger(__name__)
35 35
36 conversion_patterns = ( 36 conversion_patterns = (
37 (re.compile("^diff --git \w/(.+) \w/(?P<FilePath>.+)"), lambda matched: "Ind ex: " + matched.group('FilePath') + "\n"), 37 (re.compile("^diff --git \w/(.+) \w/(?P<FilePath>.+)"), lambda matched: "Ind ex: " + matched.group('FilePath') + "\n"),
38 (re.compile("^new file.*"), lambda matched: "\n"), 38 (re.compile("^new file.*"), lambda matched: "\n"),
39 (re.compile("^index (([0-9a-f]{7}\.\.[0-9a-f]{7})|([0-9a-f]{40}\.\.[0-9a-f]{ 40})) [0-9]{6}"), lambda matched: ("=" * 67) + "\n"), 39 (re.compile("^index (([0-9a-f]{7}\.\.[0-9a-f]{7})|([0-9a-f]{40}\.\.[0-9a-f]{ 40})) [0-9]{6}"),
40 lambda matched: ("=" * 67) + "\n"),
40 (re.compile("^--- \w/(?P<FilePath>.+)"), lambda matched: "--- " + matched.gr oup('FilePath') + "\n"), 41 (re.compile("^--- \w/(?P<FilePath>.+)"), lambda matched: "--- " + matched.gr oup('FilePath') + "\n"),
41 (re.compile("^\+\+\+ \w/(?P<FilePath>.+)"), lambda matched: "+++ " + matched .group('FilePath') + "\n"), 42 (re.compile("^\+\+\+ \w/(?P<FilePath>.+)"), lambda matched: "+++ " + matched .group('FilePath') + "\n"),
42 ) 43 )
43 44
44 index_pattern = re.compile(r"^Index: (?P<FilePath>.+)") 45 index_pattern = re.compile(r"^Index: (?P<FilePath>.+)")
45 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+)? @@")
46 diff_git_pattern = re.compile(r"^diff --git \w/") 47 diff_git_pattern = re.compile(r"^diff --git \w/")
47 48
48 49
49 def git_diff_to_svn_diff(line): 50 def git_diff_to_svn_diff(line):
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 current_file.add_unchanged_line(old_diff_line, new_diff_line , line[1:]) 174 current_file.add_unchanged_line(old_diff_line, new_diff_line , line[1:])
174 old_diff_line += 1 175 old_diff_line += 1
175 new_diff_line += 1 176 new_diff_line += 1
176 elif line == '\\ No newline at end of file': 177 elif line == '\\ No newline at end of file':
177 # Nothing to do. We may still have some added lines. 178 # Nothing to do. We may still have some added lines.
178 pass 179 pass
179 else: 180 else:
180 _log.error('Unexpected diff format when parsing a ' 181 _log.error('Unexpected diff format when parsing a '
181 'chunk: %r' % line) 182 'chunk: %r' % line)
182 return files 183 return files
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698