[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 11:44:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c987126f76375f9e1e4c5daa80f786d41f288651
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 13:41:17 2010 +0000

    2010-08-05  Kenichi Ishibashi  <bashi at google.com>
    
            Reviewed by Shinichiro Hamaji.
    
            check-webkit-style returns non-zero when patch is entirely minus lines.
            https://bugs.webkit.org/show_bug.cgi?id=38169
    
            * Scripts/check-webkit-style:
            Check whether a patch contains modified files that are entirely minus lines.
            * Scripts/webkitpy/style/filereader.py:
            Add a variable that holds number of files that contain only deleted lines.
            * Scripts/webkitpy/style/patchreader.py:
            Count up modified files that contain only deleted lines.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64743 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 74a7dad..2366d7c 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-05  Kenichi Ishibashi  <bashi at google.com>
+
+        Reviewed by Shinichiro Hamaji.
+
+        check-webkit-style returns non-zero when patch is entirely minus lines.
+        https://bugs.webkit.org/show_bug.cgi?id=38169
+
+        * Scripts/check-webkit-style:
+        Check whether a patch contains modified files that are entirely minus lines.
+        * Scripts/webkitpy/style/filereader.py:
+        Add a variable that holds number of files that contain only deleted lines.
+        * Scripts/webkitpy/style/patchreader.py:
+        Count up modified files that contain only deleted lines.
+
 2010-08-05  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebKitTools/Scripts/check-webkit-style b/WebKitTools/Scripts/check-webkit-style
index 9a1ae1e..e29d4b1 100755
--- a/WebKitTools/Scripts/check-webkit-style
+++ b/WebKitTools/Scripts/check-webkit-style
@@ -121,11 +121,12 @@ def main():
 
     error_count = style_processor.error_count
     file_count = file_reader.file_count
+    delete_only_file_count = file_reader.delete_only_file_count
 
     _log.info("Total errors found: %d in %d files"
               % (error_count, file_count))
     # We fail when style errors are found or there are no checked files.
-    sys.exit(error_count > 0 or file_count == 0)
+    sys.exit(error_count > 0 or (file_count == 0 and delete_only_file_count == 0))
 
 
 if __name__ == "__main__":
diff --git a/WebKitTools/Scripts/webkitpy/style/filereader.py b/WebKitTools/Scripts/webkitpy/style/filereader.py
index 48455b3..1a24cb5 100644
--- a/WebKitTools/Scripts/webkitpy/style/filereader.py
+++ b/WebKitTools/Scripts/webkitpy/style/filereader.py
@@ -47,6 +47,10 @@ class TextFileReader(object):
          file_count: The total number of files passed to this instance
                      for processing, including non-text files and files
                      that should be skipped.
+         delete_only_file_count: The total number of files that are not
+                                 processed this instance actually because
+                                 the files don't have any modified lines
+                                 but should be treated as processed.
 
     """
 
@@ -59,6 +63,7 @@ class TextFileReader(object):
         """
         self._processor = processor
         self.file_count = 0
+        self.delete_only_file_count = 0
 
     def _read_lines(self, file_path):
         """Read the file at a path, and return its lines.
@@ -146,3 +151,12 @@ class TextFileReader(object):
                 self._process_directory(directory=path)
             else:
                 self.process_file(path)
+
+    def count_delete_only_file(self):
+        """Count up files that contains only deleted lines.
+
+        Files which has no modified or newly-added lines don't need
+        to check style, but should be treated as checked. For that
+        purpose, we just count up the number of such files.
+        """
+        self.delete_only_file_count += 1
diff --git a/WebKitTools/Scripts/webkitpy/style/filereader_unittest.py b/WebKitTools/Scripts/webkitpy/style/filereader_unittest.py
index 558ec5a..6328337 100644
--- a/WebKitTools/Scripts/webkitpy/style/filereader_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/filereader_unittest.py
@@ -159,3 +159,8 @@ class TextFileReaderTest(LoggingTestCase):
         processed = [(['bar'], file_path2, None),
                      (['foo'], file_path1, None)]
         self._assert_file_reader(processed, 2)
+
+    def test_count_delete_only_file(self):
+        self._file_reader.count_delete_only_file()
+        delete_only_file_count = self._file_reader.delete_only_file_count
+        self.assertEquals(delete_only_file_count, 1)
diff --git a/WebKitTools/Scripts/webkitpy/style/patchreader.py b/WebKitTools/Scripts/webkitpy/style/patchreader.py
index 7ba2b66..576504a 100644
--- a/WebKitTools/Scripts/webkitpy/style/patchreader.py
+++ b/WebKitTools/Scripts/webkitpy/style/patchreader.py
@@ -73,3 +73,8 @@ class PatchReader(object):
             if line_numbers:
                 self._text_file_reader.process_file(file_path=path,
                                                     line_numbers=line_numbers)
+            else:
+                # We don't check the file which contains deleted lines only
+                # but would like to treat it as to be processed so that
+                # we count up number of such files.
+                self._text_file_reader.count_delete_only_file()
diff --git a/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py b/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py
index 10791e4..2453c6b 100644
--- a/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py
@@ -45,10 +45,15 @@ class PatchReaderTest(unittest.TestCase):
         def __init__(self):
             self.passed_to_process_file = []
             """A list of (file_path, line_numbers) pairs."""
+            self.delete_only_file_count = 0
+            """A number of times count_delete_only_file() called"""
 
         def process_file(self, file_path, line_numbers):
             self.passed_to_process_file.append((file_path, line_numbers))
 
+        def count_delete_only_file(self):
+            self.delete_only_file_count += 1
+
     def setUp(self):
         file_reader = self.MockTextFileReader()
         self._file_reader = file_reader
@@ -57,9 +62,11 @@ class PatchReaderTest(unittest.TestCase):
     def _call_check_patch(self, patch_string):
         self._patch_checker.check(patch_string)
 
-    def _assert_checked(self, passed_to_process_file):
+    def _assert_checked(self, passed_to_process_file, delete_only_file_count):
         self.assertEquals(self._file_reader.passed_to_process_file,
                           passed_to_process_file)
+        self.assertEquals(self._file_reader.delete_only_file_count,
+                          delete_only_file_count)
 
     def test_check_patch(self):
         # The modified line_numbers array for this patch is: [2].
@@ -71,7 +78,7 @@ index ef65bee..e3db70e 100644
  # Required for Python to search this directory for module files
 +# New line
 """)
-        self._assert_checked([("__init__.py", set([2]))])
+        self._assert_checked([("__init__.py", set([2]))], 0)
 
     def test_check_patch_with_deletion(self):
         self._call_check_patch("""Index: __init__.py
@@ -82,4 +89,4 @@ index ef65bee..e3db70e 100644
 -foobar
 """)
         # _mock_check_file should not be called for the deletion patch.
-        self._assert_checked([])
+        self._assert_checked([], 1)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list