[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

aroben at apple.com aroben at apple.com
Thu Apr 8 02:20:32 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 25bfe73d06929826cf5e48243579d3d193aa91c0
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 12 15:12:42 2010 +0000

    Make svn-create-patch's diffs of ObjC header files more readable
    
    Fixes <http://webkit.org/b/36055>.
    
    Reviewed by John Sullivan.
    
    * Scripts/svn-create-patch:
    (diffOptionsForFile): Added. Returns the options that should be passed
    to diff for the given file. All the options are the same for all
    files, except for the option to specify which lines should be used as
    hunk headers.
    (generateDiff): Use diffOptionsForFile to get the options to pass to
    diff.
    (hunkHeaderLineRegExForFile): Added. Returns the regular expression
    that should be used by diff to identify lines that should be included
    after the "@@" in the hunk header lines of the diff. For ObjC[++]
    source files, we use any lines starting with -, +, or
    @implementation/@interface/@protocol. For ObjC[++] header files (which
    we assume to be any .h files in a mac/ or objc/ directory), we use any
    lines starting with @implementation/@interface/@protocol.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 214b17b..a7b24ce 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,26 @@
+2010-03-12  Adam Roben  <aroben at apple.com>
+
+        Make svn-create-patch's diffs of ObjC header files more readable
+
+        Fixes <http://webkit.org/b/36055>.
+
+        Reviewed by John Sullivan.
+
+        * Scripts/svn-create-patch:
+        (diffOptionsForFile): Added. Returns the options that should be passed
+        to diff for the given file. All the options are the same for all
+        files, except for the option to specify which lines should be used as
+        hunk headers.
+        (generateDiff): Use diffOptionsForFile to get the options to pass to
+        diff.
+        (hunkHeaderLineRegExForFile): Added. Returns the regular expression
+        that should be used by diff to identify lines that should be included
+        after the "@@" in the hunk header lines of the diff. For ObjC[++]
+        source files, we use any lines starting with -, +, or
+        @implementation/@interface/@protocol. For ObjC[++] header files (which
+        we assume to be any .h files in a mac/ or objc/ directory), we use any
+        lines starting with @implementation/@interface/@protocol.
+
 2010-03-12  Jochen Eisinger  <jochen at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebKitTools/Scripts/svn-create-patch b/WebKitTools/Scripts/svn-create-patch
index 2361cc5..bbfea6b 100755
--- a/WebKitTools/Scripts/svn-create-patch
+++ b/WebKitTools/Scripts/svn-create-patch
@@ -56,12 +56,14 @@ use Time::gmtime;
 use VCSUtils;
 
 sub binarycmp($$);
+sub diffOptionsForFile($);
 sub findBaseUrl($);
 sub findMimeType($;$);
 sub findModificationType($);
 sub findSourceFileAndRevision($);
 sub generateDiff($$);
 sub generateFileList($\%);
+sub hunkHeaderLineRegExForFile($);
 sub isBinaryMimeType($);
 sub manufacturePatchForAdditionWithHistory($);
 sub numericcmp($$);
@@ -130,6 +132,19 @@ sub binarycmp($$)
     return $fileDataA->{isBinary} <=> $fileDataB->{isBinary};
 }
 
+sub diffOptionsForFile($)
+{
+    my ($file) = @_;
+
+    my $options = "uaNp";
+
+    if (my $hunkHeaderLineRegEx = hunkHeaderLineRegExForFile($file)) {
+        $options .= "F'$hunkHeaderLineRegEx'";
+    }
+
+    return $options;
+}
+
 sub findBaseUrl($)
 {
     my ($infoPath) = @_;
@@ -203,7 +218,9 @@ sub generateDiff($$)
     if ($fileData->{modificationType} eq "additionWithHistory") {
         manufacturePatchForAdditionWithHistory($fileData);
     }
-    open DIFF, "svn diff --diff-cmd diff -x -uaNpF'^[-+@]' '$file' |" or die;
+
+    my $diffOptions = diffOptionsForFile($file);
+    open DIFF, "svn diff --diff-cmd diff -x -$diffOptions '$file' |" or die;
     while (<DIFF>) {
         $patch .= $_;
     }
@@ -252,6 +269,15 @@ sub generateFileList($\%)
     close STAT;
 }
 
+sub hunkHeaderLineRegExForFile($)
+{
+    my ($file) = @_;
+
+    my $startOfObjCInterfaceRegEx = "@(implementation\\|interface\\|protocol)";
+    return "^[-+]\\|$startOfObjCInterfaceRegEx" if $file =~ /\.mm?$/;
+    return "^$startOfObjCInterfaceRegEx" if $file =~ /^(.*\/)?(mac|objc)\// && $file =~ /\.h$/;
+}
+
 sub isBinaryMimeType($)
 {
     my ($file) = @_;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list