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

abarth at webkit.org abarth at webkit.org
Wed Dec 22 15:21:13 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 307778454adc1c1c08058c0ee9b34c2f371c908a
Author: abarth at webkit.org <abarth at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 1 22:27:05 2010 +0000

    2010-11-01  Adam Barth  <abarth at webkit.org>
    
            Reviewed by Eric Seidel.
    
            Teach check-webkit-style how to accept a list of files to diff on the
            command line
            https://bugs.webkit.org/show_bug.cgi?id=48784
    
            In a future patch, webkit-patch will use this option to improve
            performance.  I'm landing this in two pieces to avoid causing a version
            skew problem for the style-bot.
    
            * Scripts/check-webkit-style:
            * Scripts/webkitpy/style/optparser.py:
            * Scripts/webkitpy/style/optparser_unittest.py:
            * Scripts/webkitpy/style_references.py:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71064 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index b047da8..48e46d2 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-01  Adam Barth  <abarth at webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Teach check-webkit-style how to accept a list of files to diff on the
+        command line
+        https://bugs.webkit.org/show_bug.cgi?id=48784
+
+        In a future patch, webkit-patch will use this option to improve
+        performance.  I'm landing this in two pieces to avoid causing a version
+        skew problem for the style-bot.
+
+        * Scripts/check-webkit-style:
+        * Scripts/webkitpy/style/optparser.py:
+        * Scripts/webkitpy/style/optparser_unittest.py:
+        * Scripts/webkitpy/style_references.py:
+
 2010-11-01  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by John Sullivan.
diff --git a/WebKitTools/Scripts/check-webkit-style b/WebKitTools/Scripts/check-webkit-style
index e29d4b1..076c712 100755
--- a/WebKitTools/Scripts/check-webkit-style
+++ b/WebKitTools/Scripts/check-webkit-style
@@ -112,10 +112,11 @@ def main():
 
     file_reader = TextFileReader(style_processor)
 
-    if paths:
+    if paths and not options.diff_files:
         file_reader.process_paths(paths)
     else:
-        patch = checkout.create_patch(options.git_commit)
+        changed_files = paths if options.diff_files else None
+        patch = checkout.create_patch(options.git_commit, changed_files=changed_files)
         patch_checker = PatchReader(file_reader)
         patch_checker.check(patch)
 
diff --git a/WebKitTools/Scripts/webkitpy/style/optparser.py b/WebKitTools/Scripts/webkitpy/style/optparser.py
index 3ba0fae..f4e9923 100644
--- a/WebKitTools/Scripts/webkitpy/style/optparser.py
+++ b/WebKitTools/Scripts/webkitpy/style/optparser.py
@@ -145,6 +145,7 @@ class CommandOptionValues(object):
     def __init__(self,
                  filter_rules=None,
                  git_commit=None,
+                 diff_files=None,
                  is_verbose=False,
                  min_confidence=1,
                  output_format="emacs"):
@@ -163,6 +164,7 @@ class CommandOptionValues(object):
 
         self.filter_rules = filter_rules
         self.git_commit = git_commit
+        self.diff_files = diff_files
         self.is_verbose = is_verbose
         self.min_confidence = min_confidence
         self.output_format = output_format
@@ -174,6 +176,8 @@ class CommandOptionValues(object):
             return False
         if self.git_commit != other.git_commit:
             return False
+        if self.diff_files != other.diff_files:
+            return False
         if self.is_verbose != other.is_verbose:
             return False
         if self.min_confidence != other.min_confidence:
@@ -214,6 +218,8 @@ class ArgumentPrinter(object):
             flags['filter'] = ",".join(filter_rules)
         if options.git_commit:
             flags['git-commit'] = options.git_commit
+        if options.diff_files:
+            flags['diff_files'] = options.diff_files
 
         flag_string = ''
         # Alphabetizing lets us unit test this method.
@@ -308,6 +314,9 @@ class ArgumentParser(object):
         parser.add_option("-g", "--git-diff", "--git-commit",
                           metavar="COMMIT", dest="git_commit", help=git_commit_help,)
 
+        diff_files_help = "diff the files passed on the command line rather than checking the style of every line"
+        parser.add_option("--diff-files", action="store_true", dest="diff_files", default=False, help=diff_files_help)
+
         min_confidence_help = ("set the minimum confidence of style errors "
                                "to report.  Can be an integer 1-5, with 1 "
                                "displaying all errors.  Defaults to %default.")
@@ -409,6 +418,7 @@ class ArgumentParser(object):
 
         filter_value = options.filter_value
         git_commit = options.git_commit
+        diff_files = options.diff_files
         is_verbose = options.is_verbose
         min_confidence = options.min_confidence
         output_format = options.output_format
@@ -420,10 +430,6 @@ class ArgumentParser(object):
 
         # Validate user-provided values.
 
-        if paths and git_commit:
-            self._parse_error('You cannot provide both paths and a git '
-                              'commit at the same time.')
-
         min_confidence = int(min_confidence)
         if (min_confidence < 1) or (min_confidence > 5):
             self._parse_error('option --min-confidence: invalid integer: '
@@ -442,6 +448,7 @@ class ArgumentParser(object):
 
         options = CommandOptionValues(filter_rules=filter_rules,
                                       git_commit=git_commit,
+                                      diff_files=diff_files,
                                       is_verbose=is_verbose,
                                       min_confidence=min_confidence,
                                       output_format=output_format)
diff --git a/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py b/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py
index b7e3eda..a6b64da 100644
--- a/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/optparser_unittest.py
@@ -136,11 +136,6 @@ class ArgumentParserTest(LoggingTestCase):
         self.assertLog(['ERROR: Invalid filter rule "build": '
                         'every rule must start with + or -.\n'])
         parse(['--filter=+build']) # works
-        # Pass files and git-commit at the same time.
-        self.assertRaises(SystemExit, parse, ['--git-commit=committish',
-                                              'file.txt'])
-        self.assertLog(['ERROR: You cannot provide both paths and '
-                        'a git commit at the same time.\n'])
 
     def test_parse_default_arguments(self):
         parse = self._parse
@@ -151,6 +146,7 @@ class ArgumentParserTest(LoggingTestCase):
 
         self.assertEquals(options.filter_rules, [])
         self.assertEquals(options.git_commit, None)
+        self.assertEquals(options.diff_files, False)
         self.assertEquals(options.is_verbose, False)
         self.assertEquals(options.min_confidence, 3)
         self.assertEquals(options.output_format, 'vs7')
@@ -171,6 +167,8 @@ class ArgumentParserTest(LoggingTestCase):
         self.assertEquals(options.git_commit, 'commit')
         (files, options) = parse(['--verbose'])
         self.assertEquals(options.is_verbose, True)
+        (files, options) = parse(['--diff-files', 'file.txt'])
+        self.assertEquals(options.diff_files, True)
 
         # Pass user_rules.
         (files, options) = parse(['--filter=+build,-whitespace'])
diff --git a/WebKitTools/Scripts/webkitpy/style_references.py b/WebKitTools/Scripts/webkitpy/style_references.py
index 34f3bff..a21e931 100644
--- a/WebKitTools/Scripts/webkitpy/style_references.py
+++ b/WebKitTools/Scripts/webkitpy/style_references.py
@@ -69,6 +69,6 @@ class WebKitCheckout(object):
         """Return the checkout root as an absolute path."""
         return self._scm.checkout_root
 
-    def create_patch(self, git_commit):
-        return self._scm.create_patch(git_commit)
-
+    def create_patch(self, git_commit, changed_files=None):
+        # FIXME: SCM.create_patch should understand how to handle None.
+        return self._scm.create_patch(git_commit, changed_files=changed_files or [])

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list