[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

cjerdonek at webkit.org cjerdonek at webkit.org
Thu Feb 4 21:25:12 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 557623193e3051f3e2000b6158ac9d8f39d8d248
Author: cjerdonek at webkit.org <cjerdonek at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 22 22:04:51 2010 +0000

    33791: Proposed patch 1 (amended with preferred license)
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53715 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3aaa51f..2977bc7 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,24 @@
+2010-01-22  Chris Jerdonek  <cjerdonek at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Made check-webkit-style able to check patches when script not
+        run from source root. Also consolidated external references
+        to a single file.
+
+        https://bugs.webkit.org/show_bug.cgi?id=33791
+
+        * Scripts/check-webkit-style:
+          - Changed to import style_references.py.
+
+        * Scripts/webkitpy/style/__init__.py:
+          - Removed __path__ hack that allowed searching Scripts/ directory.
+
+        * Scripts/webkitpy/style/checker.py:
+          - Changed to import style_references.py.
+
+        * Scripts/webkitpy/style_references.py: Added.
+
 2010-01-22  Dmitry Titov  <dimich at chromium.org>
 
         Reviewed by Maciej Stachowiak.
diff --git a/WebKitTools/Scripts/check-webkit-style b/WebKitTools/Scripts/check-webkit-style
index a2b584f..245d834 100755
--- a/WebKitTools/Scripts/check-webkit-style
+++ b/WebKitTools/Scripts/check-webkit-style
@@ -48,8 +48,7 @@ import os.path
 import sys
 
 import webkitpy.style.checker as checker
-from webkitpy.scm import detect_scm_system
-
+from webkitpy.style_references import SimpleScm
 
 def main():
     # Change stderr to write with replacement characters so we don't die
@@ -71,8 +70,9 @@ def main():
             style_checker.check_file(filename)
 
     else:
-        cwd = os.path.abspath('.')
-        scm = detect_scm_system(cwd)
+        scm = SimpleScm()
+
+        os.chdir(scm.checkout_root())
 
         if options.git_commit:
             commit = options.git_commit
diff --git a/WebKitTools/Scripts/webkitpy/style/__init__.py b/WebKitTools/Scripts/webkitpy/style/__init__.py
index 35cbe4c..ef65bee 100644
--- a/WebKitTools/Scripts/webkitpy/style/__init__.py
+++ b/WebKitTools/Scripts/webkitpy/style/__init__.py
@@ -1,6 +1 @@
 # Required for Python to search this directory for module files
-
-import os
-
-# Add containing "webkitpy" package directory to search path.
-__path__.append(os.path.join(__path__[0], ".."))
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py
index 68c5abe..9e142b8 100644
--- a/WebKitTools/Scripts/webkitpy/style/checker.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker.py
@@ -34,7 +34,7 @@ import getopt
 import os.path
 import sys
 
-from diff_parser import DiffParser
+from .. style_references import parse_patch
 from cpp_style import CppProcessor
 from text_style import TextProcessor
 
@@ -889,8 +889,8 @@ class StyleChecker(object):
           patch_string: A string that is a patch string.
 
         """
-        patch = DiffParser(patch_string.splitlines())
-        for file_path, diff in patch.files.iteritems():
+        patch_files = parse_patch(patch_string)
+        for file_path, diff in patch_files.iteritems():
             line_numbers = set()
 
             def error_for_patch(file_path, line_number, category, confidence, message):
diff --git a/WebKitTools/Scripts/webkitpy/style_references.py b/WebKitTools/Scripts/webkitpy/style_references.py
new file mode 100644
index 0000000..2528c4d
--- /dev/null
+++ b/WebKitTools/Scripts/webkitpy/style_references.py
@@ -0,0 +1,72 @@
+# Copyright (C) 2010 Chris Jerdonek (cjerdonek at webkit.org)
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""References to non-style modules used by the style package."""
+
+# This module is a simple facade to the functionality used by the
+# style package that comes from WebKit modules outside the style
+# package.
+#
+# With this module, the only intra-package references (i.e.
+# references to webkitpy modules outside the style folder) that
+# the style package needs to make are relative references to
+# this module. For example--
+#
+# > from .. style_references import parse_patch
+#
+# Similarly, people maintaining non-style code are not beholden
+# to the contents of the style package when refactoring or
+# otherwise changing non-style code. They only have to be aware
+# of this module.
+
+import os
+
+from diff_parser import DiffParser
+from scm import detect_scm_system
+
+
+def parse_patch(patch_string):
+
+    """Parse a patch string and return the affected files."""
+
+    patch = DiffParser(patch_string.splitlines())
+    return patch.files
+
+
+class SimpleScm(object):
+
+    """Simple facade to SCM for use by style package."""
+
+    def __init__(self):
+        cwd = os.path.abspath('.')
+        self._scm = detect_scm_system(cwd)
+
+    def checkout_root(self):
+        """Return the source control root as an absolute path."""
+        return self._scm.checkout_root
+
+    def create_patch(self):
+        return self._scm.create_patch()
+
+    def create_patch_since_local_commit(self, commit):
+        return self._scm.create_patch_since_local_commit(commit)
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list