Title: [112963] trunk/Tools
- Revision
- 112963
- Author
- [email protected]
- Date
- 2012-04-02 16:54:58 -0700 (Mon, 02 Apr 2012)
Log Message
check-webkit-style errors when removing .png files
https://bugs.webkit.org/show_bug.cgi?id=82933
Reviewed by David Levin.
* Scripts/webkitpy/style/patchreader.py:
(PatchReader.check): Make sure the file exists and pass in a FileSystem() object (for mocking).
* Scripts/webkitpy/style/patchreader_unittest.py:
(test_check_patch_with_png_deletion):
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (112962 => 112963)
--- trunk/Tools/ChangeLog 2012-04-02 23:53:56 UTC (rev 112962)
+++ trunk/Tools/ChangeLog 2012-04-02 23:54:58 UTC (rev 112963)
@@ -1,3 +1,15 @@
+2012-04-02 Tony Chang <[email protected]>
+
+ check-webkit-style errors when removing .png files
+ https://bugs.webkit.org/show_bug.cgi?id=82933
+
+ Reviewed by David Levin.
+
+ * Scripts/webkitpy/style/patchreader.py:
+ (PatchReader.check): Make sure the file exists and pass in a FileSystem() object (for mocking).
+ * Scripts/webkitpy/style/patchreader_unittest.py:
+ (test_check_patch_with_png_deletion):
+
2012-04-02 Sheriff Bot <[email protected]>
Unreviewed, rolling out r112948.
Modified: trunk/Tools/Scripts/webkitpy/style/patchreader.py (112962 => 112963)
--- trunk/Tools/Scripts/webkitpy/style/patchreader.py 2012-04-02 23:53:56 UTC (rev 112962)
+++ trunk/Tools/Scripts/webkitpy/style/patchreader.py 2012-04-02 23:54:58 UTC (rev 112963)
@@ -52,8 +52,9 @@
"""
self._text_file_reader = text_file_reader
- def check(self, patch_string):
+ def check(self, patch_string, fs=None):
"""Check style in the given patch."""
+ fs = fs or FileSystem()
patch_files = DiffParser(patch_string.splitlines()).files
# If the user uses git, checking subversion config file only once is enough.
@@ -65,11 +66,11 @@
if not line_numbers:
match = re.search("\s*png$", path)
- if match:
+ if match and fs.exists(path):
if call_only_once:
self._text_file_reader.process_file(file_path=path, line_numbers=None)
cwd = FileSystem().getcwd()
- detection = SCMDetector(FileSystem(), Executive()).detect_scm_system(cwd)
+ detection = SCMDetector(fs, Executive()).detect_scm_system(cwd)
if detection.display_name() == "git":
call_only_once = False
continue
Modified: trunk/Tools/Scripts/webkitpy/style/patchreader_unittest.py (112962 => 112963)
--- trunk/Tools/Scripts/webkitpy/style/patchreader_unittest.py 2012-04-02 23:53:56 UTC (rev 112962)
+++ trunk/Tools/Scripts/webkitpy/style/patchreader_unittest.py 2012-04-02 23:54:58 UTC (rev 112963)
@@ -33,6 +33,7 @@
import unittest
+from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy.style.patchreader import PatchReader
@@ -90,3 +91,13 @@
""")
# _mock_check_file should not be called for the deletion patch.
self._assert_checked([], 1)
+
+ def test_check_patch_with_png_deletion(self):
+ fs = MockFileSystem()
+ diff_text = """Index: LayoutTests/platform/mac/foo-expected.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = image/png
+"""
+ self._patch_checker.check(diff_text, fs)
+ self._assert_checked([], 1)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes