diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebKitTools/Scripts/svn-create-patch | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebKitTools/Scripts/svn-create-patch')
-rwxr-xr-x | WebKitTools/Scripts/svn-create-patch | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/WebKitTools/Scripts/svn-create-patch b/WebKitTools/Scripts/svn-create-patch index 768a8ed..5aead2e 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($$); @@ -99,9 +101,16 @@ for my $path (keys %paths) { my $svnRoot = determineSVNRoot(); my $prefix = chdirReturningRelativePath($svnRoot); +my $patchSize = 0; + # Generate the diffs, in a order chosen for easy reviewing. for my $path (sort patchpathcmp values %diffFiles) { - generateDiff($path, $prefix); + $patchSize += generateDiff($path, $prefix); +} + +if ($patchSize > 20480) { + print STDERR "WARNING: Patch's size is " . int($patchSize/1024) . " kbytes.\n"; + print STDERR "Patches 20k or smaller are more likely to be reviewed. Larger patches may sit unreviewed for a long time.\n"; } exit 0; @@ -130,6 +139,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) = @_; @@ -196,24 +218,27 @@ sub generateDiff($$) my $file = File::Spec->catdir($prefix, $fileData->{path}); if ($ignoreChangelogs && basename($file) eq "ChangeLog") { - return; + return 0; } - my $patch; + my $patch = ""; if ($fileData->{modificationType} eq "additionWithHistory") { manufacturePatchForAdditionWithHistory($fileData); } - open DIFF, "svn diff --diff-cmd diff -x -uaNp '$file' |" or die; + + my $diffOptions = diffOptionsForFile($file); + open DIFF, "svn diff --diff-cmd diff -x -$diffOptions '$file' |" or die; while (<DIFF>) { $patch .= $_; } close DIFF; $patch = fixChangeLogPatch($patch) if basename($file) eq "ChangeLog"; - print $patch if $patch; + print $patch; if ($fileData->{isBinary}) { print "\n" if ($patch && $patch =~ m/\n\S+$/m); outputBinaryContent($file); } + return length($patch); } sub generateFileList($\%) @@ -252,6 +277,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) = @_; |