[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
eric at webkit.org
eric at webkit.org
Wed Apr 7 23:08:14 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 8f70b35fb74f60c6243f7a2c50ea691e50644904
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 27 10:01:58 2009 +0000
2009-10-27 Eric Seidel <eric at webkit.org>
Reviewed by Adam Barth.
svn-* scripts should share code through VCSUtils.pm
https://bugs.webkit.org/show_bug.cgi?id=30791
Just moving code into a shared location.
* Scripts/VCSUtils.pm:
* Scripts/prepare-ChangeLog:
* Scripts/resolve-ChangeLogs:
* Scripts/svn-apply:
* Scripts/svn-create-patch:
* Scripts/svn-unapply:
* Scripts/update-webkit:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50136 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 93ba6ad..e6024b1 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-27 Eric Seidel <eric at webkit.org>
+
+ Reviewed by Adam Barth.
+
+ svn-* scripts should share code through VCSUtils.pm
+ https://bugs.webkit.org/show_bug.cgi?id=30791
+
+ Just moving code into a shared location.
+
+ * Scripts/VCSUtils.pm:
+ * Scripts/prepare-ChangeLog:
+ * Scripts/resolve-ChangeLogs:
+ * Scripts/svn-apply:
+ * Scripts/svn-create-patch:
+ * Scripts/svn-unapply:
+ * Scripts/update-webkit:
+
2009-10-27 Vadim Zeitlin <vadim at wxwidgets.org>
Suppress a huge number of MSVC warnings when building wxWebKit.
diff --git a/WebKitTools/Scripts/VCSUtils.pm b/WebKitTools/Scripts/VCSUtils.pm
index 306cdd6..e1e0bc2 100644
--- a/WebKitTools/Scripts/VCSUtils.pm
+++ b/WebKitTools/Scripts/VCSUtils.pm
@@ -40,10 +40,13 @@ BEGIN {
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(
+ &canonicalizePath
&chdirReturningRelativePath
&determineSVNRoot
&determineVCSRoot
+ &fixChangeLogPatch
&gitBranch
+ &gitdiff2svndiff
&isGit
&isGitBranchBuild
&isGitDirectory
@@ -51,8 +54,10 @@ BEGIN {
&isSVNDirectory
&isSVNVersion16OrNewer
&makeFilePathRelative
+ &normalizePath
&pathRelativeToSVNRepositoryRootForPath
&svnRevisionForDirectory
+ &svnStatus
);
%EXPORT_TAGS = ( );
@EXPORT_OK = ();
@@ -267,4 +272,131 @@ sub makeFilePathRelative($)
return $gitRoot . $path;
}
+sub normalizePath($)
+{
+ my ($path) = @_;
+ $path =~ s/\\/\//g;
+ return $path;
+}
+
+sub canonicalizePath($)
+{
+ my ($file) = @_;
+
+ # Remove extra slashes and '.' directories in path
+ $file = File::Spec->canonpath($file);
+
+ # Remove '..' directories in path
+ my @dirs = ();
+ foreach my $dir (File::Spec->splitdir($file)) {
+ if ($dir eq '..' && $#dirs >= 0 && $dirs[$#dirs] ne '..') {
+ pop(@dirs);
+ } else {
+ push(@dirs, $dir);
+ }
+ }
+ return ($#dirs >= 0) ? File::Spec->catdir(@dirs) : ".";
+}
+
+sub svnStatus($)
+{
+ my ($fullPath) = @_;
+ my $svnStatus;
+ open SVN, "svn status --non-interactive --non-recursive '$fullPath' |" or die;
+ if (-d $fullPath) {
+ # When running "svn stat" on a directory, we can't assume that only one
+ # status will be returned (since any files with a status below the
+ # directory will be returned), and we can't assume that the directory will
+ # be first (since any files with unknown status will be listed first).
+ my $normalizedFullPath = File::Spec->catdir(File::Spec->splitdir($fullPath));
+ while (<SVN>) {
+ # Input may use a different EOL sequence than $/, so avoid chomp.
+ $_ = removeEOL($_);
+ my $normalizedStatPath = File::Spec->catdir(File::Spec->splitdir(substr($_, 7)));
+ if ($normalizedFullPath eq $normalizedStatPath) {
+ $svnStatus = "$_\n";
+ last;
+ }
+ }
+ # Read the rest of the svn command output to avoid a broken pipe warning.
+ local $/ = undef;
+ <SVN>;
+ }
+ else {
+ # Files will have only one status returned.
+ $svnStatus = removeEOL(<SVN>) . "\n";
+ }
+ close SVN;
+ return $svnStatus;
+}
+
+sub gitdiff2svndiff($)
+{
+ $_ = shift @_;
+ if (m#^diff --git a/(.+) b/(.+)#) {
+ return "Index: $1";
+ } elsif (m/^new file.*/) {
+ return "";
+ } elsif (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
+ return "===================================================================";
+ } elsif (m#^--- a/(.+)#) {
+ return "--- $1";
+ } elsif (m#^\+\+\+ b/(.+)#) {
+ return "+++ $1";
+ }
+ return $_;
+}
+
+sub fixChangeLogPatch($)
+{
+ my $patch = shift;
+ my $contextLineCount = 3;
+
+ return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\n( .*\n)+(\+.*\n)+( .*\n){$contextLineCount}$/m;
+ my ($oldLineCount, $newLineCount) = ($1, $2);
+ return $patch if $oldLineCount <= $contextLineCount;
+
+ # The diff(1) command is greedy when matching lines, so a new ChangeLog entry will
+ # have lines of context at the top of a patch when the existing entry has the same
+ # date and author as the new entry. This nifty loop alters a ChangeLog patch so
+ # that the added lines ("+") in the patch always start at the beginning of the
+ # patch and there are no initial lines of context.
+ my $newPatch;
+ my $lineCountInState = 0;
+ my $oldContentLineCountReduction = $oldLineCount - $contextLineCount;
+ my $newContentLineCountWithoutContext = $newLineCount - $oldLineCount - $oldContentLineCountReduction;
+ my ($stateHeader, $statePreContext, $stateNewChanges, $statePostContext) = (1..4);
+ my $state = $stateHeader;
+ foreach my $line (split(/\n/, $patch)) {
+ $lineCountInState++;
+ if ($state == $stateHeader && $line =~ /^@@ -1,$oldLineCount \+1,$newLineCount @\@$/) {
+ $line = "@@ -1,$contextLineCount +1," . ($newLineCount - $oldContentLineCountReduction) . " @@";
+ $lineCountInState = 0;
+ $state = $statePreContext;
+ } elsif ($state == $statePreContext && substr($line, 0, 1) eq " ") {
+ $line = "+" . substr($line, 1);
+ if ($lineCountInState == $oldContentLineCountReduction) {
+ $lineCountInState = 0;
+ $state = $stateNewChanges;
+ }
+ } elsif ($state == $stateNewChanges && substr($line, 0, 1) eq "+") {
+ # No changes to these lines
+ if ($lineCountInState == $newContentLineCountWithoutContext) {
+ $lineCountInState = 0;
+ $state = $statePostContext;
+ }
+ } elsif ($state == $statePostContext) {
+ if (substr($line, 0, 1) eq "+" && $lineCountInState <= $oldContentLineCountReduction) {
+ $line = " " . substr($line, 1);
+ } elsif ($lineCountInState > $contextLineCount && substr($line, 0, 1) eq " ") {
+ next; # Discard
+ }
+ }
+ $newPatch .= $line . "\n";
+ }
+
+ return $newPatch;
+}
+
+
1;
diff --git a/WebKitTools/Scripts/prepare-ChangeLog b/WebKitTools/Scripts/prepare-ChangeLog
index ed31005..dd864df 100755
--- a/WebKitTools/Scripts/prepare-ChangeLog
+++ b/WebKitTools/Scripts/prepare-ChangeLog
@@ -85,7 +85,6 @@ sub isConflictStatus($);
sub statusDescription($$$$);
sub propertyChangeDescription($);
sub extractLineRange($);
-sub canonicalizePath($);
sub testListForChangeLog(@);
sub get_function_line_ranges($$);
sub get_function_line_ranges_for_c($$);
@@ -95,7 +94,6 @@ sub method_decl_to_selector($);
sub processPaths(\@);
sub reviewerAndDescriptionForGitCommit($);
sub normalizeLineEndings($$);
-sub normalizePath($);
sub decodeEntities($);
# Project time zone for Cupertino, CA, US
@@ -429,24 +427,6 @@ if ($openChangeLogs && @logs) {
# Done.
exit;
-sub canonicalizePath($)
-{
- my ($file) = @_;
-
- # Remove extra slashes and '.' directories in path
- $file = File::Spec->canonpath($file);
-
- # Remove '..' directories in path
- my @dirs = ();
- foreach my $dir (File::Spec->splitdir($file)) {
- if ($dir eq '..' && $#dirs >= 0 && $dirs[$#dirs] ne '..') {
- pop(@dirs);
- } else {
- push(@dirs, $dir);
- }
- }
- return ($#dirs >= 0) ? File::Spec->catdir(@dirs) : ".";
-}
sub changeLogDate($)
{
@@ -1717,13 +1697,6 @@ sub normalizeLineEndings($$)
return $string;
}
-sub normalizePath($)
-{
- my ($path) = @_;
- $path =~ s/\\/\//g;
- return $path;
-}
-
sub decodeEntities($)
{
my ($text) = @_;
diff --git a/WebKitTools/Scripts/resolve-ChangeLogs b/WebKitTools/Scripts/resolve-ChangeLogs
index be58acb..1a2d2af 100755
--- a/WebKitTools/Scripts/resolve-ChangeLogs
+++ b/WebKitTools/Scripts/resolve-ChangeLogs
@@ -44,7 +44,6 @@ sub canonicalRelativePath($);
sub conflictFiles($);
sub findChangeLog($);
sub findUnmergedChangeLogs();
-sub fixChangeLogPatch($);
sub fixMergedChangeLogs($;@);
sub fixOneMergedChangeLog($);
sub hasGitUnmergedFiles();
@@ -56,7 +55,6 @@ sub resolveChangeLog($);
sub resolveConflict($);
sub showStatus($;$);
sub usageAndExit();
-sub normalizePath($);
my $isGit = isGit();
my $isSVN = isSVN();
@@ -281,57 +279,6 @@ sub findUnmergedChangeLogs()
return @results;
}
-sub fixChangeLogPatch($)
-{
- my $patch = shift;
- my $contextLineCount = 3;
-
- return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\n( .*\n)+(\+.*\n)+( .*\n){$contextLineCount}$/m;
- my ($oldLineCount, $newLineCount) = ($1, $2);
- return $patch if $oldLineCount <= $contextLineCount;
-
- # The diff(1) command is greedy when matching lines, so a new ChangeLog entry will
- # have lines of context at the top of a patch when the existing entry has the same
- # date and author as the new entry. This nifty loop alters a ChangeLog patch so
- # that the added lines ("+") in the patch always start at the beginning of the
- # patch and there are no initial lines of context.
- my $newPatch;
- my $lineCountInState = 0;
- my $oldContentLineCountReduction = $oldLineCount - $contextLineCount;
- my $newContentLineCountWithoutContext = $newLineCount - $oldLineCount - $oldContentLineCountReduction;
- my ($stateHeader, $statePreContext, $stateNewChanges, $statePostContext) = (1..4);
- my $state = $stateHeader;
- foreach my $line (split(/\n/, $patch)) {
- $lineCountInState++;
- if ($state == $stateHeader && $line =~ /^@@ -1,$oldLineCount \+1,$newLineCount @\@$/) {
- $line = "@@ -1,$contextLineCount +1," . ($newLineCount - $oldContentLineCountReduction) . " @@";
- $lineCountInState = 0;
- $state = $statePreContext;
- } elsif ($state == $statePreContext && substr($line, 0, 1) eq " ") {
- $line = "+" . substr($line, 1);
- if ($lineCountInState == $oldContentLineCountReduction) {
- $lineCountInState = 0;
- $state = $stateNewChanges;
- }
- } elsif ($state == $stateNewChanges && substr($line, 0, 1) eq "+") {
- # No changes to these lines
- if ($lineCountInState == $newContentLineCountWithoutContext) {
- $lineCountInState = 0;
- $state = $statePostContext;
- }
- } elsif ($state == $statePostContext) {
- if (substr($line, 0, 1) eq "+" && $lineCountInState <= $oldContentLineCountReduction) {
- $line = " " . substr($line, 1);
- } elsif ($lineCountInState > $contextLineCount && substr($line, 0, 1) eq " ") {
- next; # Discard
- }
- }
- $newPatch .= $line . "\n";
- }
-
- return $newPatch;
-}
-
sub fixMergedChangeLogs($;@)
{
my $revisionRange = shift;
@@ -571,9 +518,3 @@ sub showStatus($;$)
}
}
-sub normalizePath($)
-{
- my ($path) = @_;
- $path =~ s/\\/\//g;
- return $path;
-}
diff --git a/WebKitTools/Scripts/svn-apply b/WebKitTools/Scripts/svn-apply
index 19c8c56..3dd167b 100755
--- a/WebKitTools/Scripts/svn-apply
+++ b/WebKitTools/Scripts/svn-apply
@@ -74,15 +74,12 @@ use VCSUtils;
sub addDirectoriesIfNeeded($);
sub applyPatch($$;$);
sub checksum($);
-sub fixChangeLogPatch($);
-sub gitdiff2svndiff($);
sub handleBinaryChange($$);
sub isDirectoryEmptyForRemoval($);
sub patch($);
sub removeDirectoriesIfNeeded();
sub setChangeLogDateAndReviewer($$);
sub removeEOL($);
-sub svnStatus($);
# These should be replaced by an scm class/module:
sub scmKnowsOfFile($);
@@ -258,74 +255,6 @@ sub checksum($)
return $checksum;
}
-sub fixChangeLogPatch($)
-{
- my $patch = shift;
- my $contextLineCount = 3;
-
- return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\r?\n( .*\r?\n)+(\+.*\r?\n)+( .*\r?\n){$contextLineCount}$/m;
- my ($oldLineCount, $newLineCount) = ($1, $2);
- return $patch if $oldLineCount <= $contextLineCount;
-
- # The diff(1) command is greedy when matching lines, so a new ChangeLog entry will
- # have lines of context at the top of a patch when the existing entry has the same
- # date and author as the new entry. This nifty loop alters a ChangeLog patch so
- # that the added lines ("+") in the patch always start at the beginning of the
- # patch and there are no initial lines of context.
- my $newPatch;
- my $lineCountInState = 0;
- my $oldContentLineCountReduction = $oldLineCount - $contextLineCount;
- my $newContentLineCountWithoutContext = $newLineCount - $oldLineCount - $oldContentLineCountReduction;
- my ($stateHeader, $statePreContext, $stateNewChanges, $statePostContext) = (1..4);
- my $state = $stateHeader;
- foreach my $line (split(/\n/, $patch)) {
- $lineCountInState++;
- if ($state == $stateHeader && $line =~ /^@@ -1,$oldLineCount \+1,$newLineCount @\@$/) {
- $line = "@@ -1,$contextLineCount +1," . ($newLineCount - $oldContentLineCountReduction) . " @@";
- $lineCountInState = 0;
- $state = $statePreContext;
- } elsif ($state == $statePreContext && substr($line, 0, 1) eq " ") {
- $line = "+" . substr($line, 1);
- if ($lineCountInState == $oldContentLineCountReduction) {
- $lineCountInState = 0;
- $state = $stateNewChanges;
- }
- } elsif ($state == $stateNewChanges && substr($line, 0, 1) eq "+") {
- # No changes to these lines
- if ($lineCountInState == $newContentLineCountWithoutContext) {
- $lineCountInState = 0;
- $state = $statePostContext;
- }
- } elsif ($state == $statePostContext) {
- if (substr($line, 0, 1) eq "+" && $lineCountInState <= $oldContentLineCountReduction) {
- $line = " " . substr($line, 1);
- } elsif ($lineCountInState > $contextLineCount && substr($line, 0, 1) eq " ") {
- next; # Discard
- }
- }
- $newPatch .= $line . "\n";
- }
-
- return $newPatch;
-}
-
-sub gitdiff2svndiff($)
-{
- $_ = shift @_;
- if (m#^diff --git a/(.+) b/(.+)#) {
- return "Index: $1";
- } elsif (m/^new file.*/) {
- return "";
- } elsif (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
- return "===================================================================";
- } elsif (m#^--- a/(.+)#) {
- return "--- $1";
- } elsif (m#^\+\+\+ b/(.+)#) {
- return "+++ $1";
- }
- return $_;
-}
-
sub handleBinaryChange($$)
{
my ($fullPath, $contents) = @_;
@@ -455,38 +384,6 @@ sub removeEOL($)
return $line;
}
-sub svnStatus($)
-{
- my ($fullPath) = @_;
- my $svnStatus;
- open SVN, "svn status --non-interactive --non-recursive '$fullPath' |" or die;
- if (-d $fullPath) {
- # When running "svn stat" on a directory, we can't assume that only one
- # status will be returned (since any files with a status below the
- # directory will be returned), and we can't assume that the directory will
- # be first (since any files with unknown status will be listed first).
- my $normalizedFullPath = File::Spec->catdir(File::Spec->splitdir($fullPath));
- while (<SVN>) {
- # Input may use a different EOL sequence than $/, so avoid chomp.
- $_ = removeEOL($_);
- my $normalizedStatPath = File::Spec->catdir(File::Spec->splitdir(substr($_, 7)));
- if ($normalizedFullPath eq $normalizedStatPath) {
- $svnStatus = "$_\n";
- last;
- }
- }
- # Read the rest of the svn command output to avoid a broken pipe warning.
- local $/ = undef;
- <SVN>;
- }
- else {
- # Files will have only one status returned.
- $svnStatus = removeEOL(<SVN>) . "\n";
- }
- close SVN;
- return $svnStatus;
-}
-
# This could be made into a more general "status" call, except svn and git
# have different ideas about "moving" files which might get confusing.
sub scmWillDeleteFile($)
diff --git a/WebKitTools/Scripts/svn-create-patch b/WebKitTools/Scripts/svn-create-patch
index 3f40783..768a8ed 100755
--- a/WebKitTools/Scripts/svn-create-patch
+++ b/WebKitTools/Scripts/svn-create-patch
@@ -56,12 +56,10 @@ use Time::gmtime;
use VCSUtils;
sub binarycmp($$);
-sub canonicalizePath($);
sub findBaseUrl($);
sub findMimeType($;$);
sub findModificationType($);
sub findSourceFileAndRevision($);
-sub fixChangeLogPatch($);
sub generateDiff($$);
sub generateFileList($\%);
sub isBinaryMimeType($);
@@ -132,25 +130,6 @@ sub binarycmp($$)
return $fileDataA->{isBinary} <=> $fileDataB->{isBinary};
}
-sub canonicalizePath($)
-{
- my ($file) = @_;
-
- # Remove extra slashes and '.' directories in path
- $file = File::Spec->canonpath($file);
-
- # Remove '..' directories in path
- my @dirs = ();
- foreach my $dir (File::Spec->splitdir($file)) {
- if ($dir eq '..' && $#dirs >= 0 && $dirs[$#dirs] ne '..') {
- pop(@dirs);
- } else {
- push(@dirs, $dir);
- }
- }
- return ($#dirs >= 0) ? File::Spec->catdir(@dirs) : ".";
-}
-
sub findBaseUrl($)
{
my ($infoPath) = @_;
@@ -211,57 +190,6 @@ sub findSourceFileAndRevision($)
return ($sourceFile, $sourceRevision);
}
-sub fixChangeLogPatch($)
-{
- my $patch = shift;
- my $contextLineCount = 3;
-
- return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\n( .*\n)+(\+.*\n)+( .*\n){$contextLineCount}$/m;
- my ($oldLineCount, $newLineCount) = ($1, $2);
- return $patch if $oldLineCount <= $contextLineCount;
-
- # The diff(1) command is greedy when matching lines, so a new ChangeLog entry will
- # have lines of context at the top of a patch when the existing entry has the same
- # date and author as the new entry. This nifty loop alters a ChangeLog patch so
- # that the added lines ("+") in the patch always start at the beginning of the
- # patch and there are no initial lines of context.
- my $newPatch;
- my $lineCountInState = 0;
- my $oldContentLineCountReduction = $oldLineCount - $contextLineCount;
- my $newContentLineCountWithoutContext = $newLineCount - $oldLineCount - $oldContentLineCountReduction;
- my ($stateHeader, $statePreContext, $stateNewChanges, $statePostContext) = (1..4);
- my $state = $stateHeader;
- foreach my $line (split(/\n/, $patch)) {
- $lineCountInState++;
- if ($state == $stateHeader && $line =~ /^@@ -1,$oldLineCount \+1,$newLineCount @\@$/) {
- $line = "@@ -1,$contextLineCount +1," . ($newLineCount - $oldContentLineCountReduction) . " @@";
- $lineCountInState = 0;
- $state = $statePreContext;
- } elsif ($state == $statePreContext && substr($line, 0, 1) eq " ") {
- $line = "+" . substr($line, 1);
- if ($lineCountInState == $oldContentLineCountReduction) {
- $lineCountInState = 0;
- $state = $stateNewChanges;
- }
- } elsif ($state == $stateNewChanges && substr($line, 0, 1) eq "+") {
- # No changes to these lines
- if ($lineCountInState == $newContentLineCountWithoutContext) {
- $lineCountInState = 0;
- $state = $statePostContext;
- }
- } elsif ($state == $statePostContext) {
- if (substr($line, 0, 1) eq "+" && $lineCountInState <= $oldContentLineCountReduction) {
- $line = " " . substr($line, 1);
- } elsif ($lineCountInState > $contextLineCount && substr($line, 0, 1) eq " ") {
- next; # Discard
- }
- }
- $newPatch .= $line . "\n";
- }
-
- return $newPatch;
-}
-
sub generateDiff($$)
{
my ($fileData, $prefix) = @_;
diff --git a/WebKitTools/Scripts/svn-unapply b/WebKitTools/Scripts/svn-unapply
index a4cec9a..94bb1ce 100755
--- a/WebKitTools/Scripts/svn-unapply
+++ b/WebKitTools/Scripts/svn-unapply
@@ -71,12 +71,9 @@ use lib $FindBin::Bin;
use VCSUtils;
sub checksum($);
-sub fixChangeLogPatch($);
-sub gitdiff2svndiff($);
sub patch($);
sub revertDirectories();
sub removeEOL($);
-sub svnStatus($);
sub unapplyPatch($$;$);
sub unsetChangeLogDate($$);
@@ -158,74 +155,6 @@ sub checksum($)
return $checksum;
}
-sub fixChangeLogPatch($)
-{
- my $patch = shift;
- my $contextLineCount = 3;
-
- return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\n( .*\n)+(\+.*\n)+( .*\n){$contextLineCount}$/m;
- my ($oldLineCount, $newLineCount) = ($1, $2);
- return $patch if $oldLineCount <= $contextLineCount;
-
- # The diff(1) command is greedy when matching lines, so a new ChangeLog entry will
- # have lines of context at the top of a patch when the existing entry has the same
- # date and author as the new entry. This nifty loop alters a ChangeLog patch so
- # that the added lines ("+") in the patch always start at the beginning of the
- # patch and there are no initial lines of context.
- my $newPatch;
- my $lineCountInState = 0;
- my $oldContentLineCountReduction = $oldLineCount - $contextLineCount;
- my $newContentLineCountWithoutContext = $newLineCount - $oldLineCount - $oldContentLineCountReduction;
- my ($stateHeader, $statePreContext, $stateNewChanges, $statePostContext) = (1..4);
- my $state = $stateHeader;
- foreach my $line (split(/\n/, $patch)) {
- $lineCountInState++;
- if ($state == $stateHeader && $line =~ /^@@ -1,$oldLineCount \+1,$newLineCount @\@$/) {
- $line = "@@ -1,$contextLineCount +1," . ($newLineCount - $oldContentLineCountReduction) . " @@";
- $lineCountInState = 0;
- $state = $statePreContext;
- } elsif ($state == $statePreContext && substr($line, 0, 1) eq " ") {
- $line = "+" . substr($line, 1);
- if ($lineCountInState == $oldContentLineCountReduction) {
- $lineCountInState = 0;
- $state = $stateNewChanges;
- }
- } elsif ($state == $stateNewChanges && substr($line, 0, 1) eq "+") {
- # No changes to these lines
- if ($lineCountInState == $newContentLineCountWithoutContext) {
- $lineCountInState = 0;
- $state = $statePostContext;
- }
- } elsif ($state == $statePostContext) {
- if (substr($line, 0, 1) eq "+" && $lineCountInState <= $oldContentLineCountReduction) {
- $line = " " . substr($line, 1);
- } elsif ($lineCountInState > $contextLineCount && substr($line, 0, 1) eq " ") {
- next; # Discard
- }
- }
- $newPatch .= $line . "\n";
- }
-
- return $newPatch;
-}
-
-sub gitdiff2svndiff($)
-{
- $_ = shift @_;
- if (m#^diff --git a/(.+) b/(.+)#) {
- return "Index: $1";
- } elsif (m/^new file.*/) {
- return "";
- } elsif (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
- return "===================================================================";
- } elsif (m#^--- a/(.+)#) {
- return "--- $1";
- } elsif (m#^\+\+\+ b/(.+)#) {
- return "+++ $1";
- }
- return $_;
-}
-
sub patch($)
{
my ($patch) = @_;
@@ -338,38 +267,6 @@ sub removeEOL($)
return $line;
}
-sub svnStatus($)
-{
- my ($fullPath) = @_;
- my $svnStatus;
- open SVN, "svn status --non-interactive --non-recursive '$fullPath' |" or die;
- if (-d $fullPath) {
- # When running "svn stat" on a directory, we can't assume that only one
- # status will be returned (since any files with a status below the
- # directory will be returned), and we can't assume that the directory will
- # be first (since any files with unknown status will be listed first).
- my $normalizedFullPath = File::Spec->catdir(File::Spec->splitdir($fullPath));
- while (<SVN>) {
- # Input may use a different EOL sequence than $/, so avoid chomp.
- $_ = removeEOL($_);
- my $normalizedStatPath = File::Spec->catdir(File::Spec->splitdir(substr($_, 7)));
- if ($normalizedFullPath eq $normalizedStatPath) {
- $svnStatus = "$_\n";
- last;
- }
- }
- # Read the rest of the svn command output to avoid a broken pipe warning.
- local $/ = undef;
- <SVN>;
- }
- else {
- # Files will have only one status returned.
- $svnStatus = removeEOL(<SVN>) . "\n";
- }
- close SVN;
- return $svnStatus;
-}
-
sub unapplyPatch($$;$)
{
my ($patch, $fullPath, $options) = @_;
diff --git a/WebKitTools/Scripts/update-webkit b/WebKitTools/Scripts/update-webkit
index e562cc0..b503004 100755
--- a/WebKitTools/Scripts/update-webkit
+++ b/WebKitTools/Scripts/update-webkit
@@ -39,7 +39,6 @@ use VCSUtils;
use webkitdirs;
sub runSvnUpdate();
-sub normalizePath($);
# Handle options
my $quiet = '';
@@ -105,10 +104,3 @@ sub runSvnUpdate()
or die "Could not open resolve-ChangeLogs script: $!.\n";
}
}
-
-sub normalizePath($)
-{
- my ($path) = @_;
- $path =~ s/\\/\//g;
- return $path;
-}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list