[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
eric at webkit.org
eric at webkit.org
Wed Jan 20 22:18:26 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit a019eef0b070ba5c84780587ad7e85575578428f
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jan 9 22:50:53 2010 +0000
2010-01-09 Chris Jerdonek <chris.jerdonek at gmail.com>
Reviewed by David Kilzer.
Modified VCSUtils::gitdiff2svndiff() to accept strings that
end in vertical white space.
https://bugs.webkit.org/show_bug.cgi?id=33415
* Scripts/VCSUtils.pm:
* Scripts/webkitperl/VCSUtils_unittest/gitdiff2svndiff.pl:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2b660aa..606aa39 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2010-01-09 Chris Jerdonek <chris.jerdonek at gmail.com>
+
+ Reviewed by David Kilzer.
+
+ Modified VCSUtils::gitdiff2svndiff() to accept strings that
+ end in vertical white space.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33415
+
+ * Scripts/VCSUtils.pm:
+ * Scripts/webkitperl/VCSUtils_unittest/gitdiff2svndiff.pl:
+
2010-01-08 Eric Seidel <eric at webkit.org>
Reviewed by Adam Barth.
diff --git a/WebKitTools/Scripts/VCSUtils.pm b/WebKitTools/Scripts/VCSUtils.pm
index adf2f39..183ebcd 100644
--- a/WebKitTools/Scripts/VCSUtils.pm
+++ b/WebKitTools/Scripts/VCSUtils.pm
@@ -32,6 +32,7 @@ use strict;
use warnings;
use Cwd qw(); # "qw()" prevents warnings about redefining getcwd() with "use POSIX;"
+use English; # for $POSTMATCH, etc.
use File::Basename;
use File::Spec;
use POSIX;
@@ -359,17 +360,24 @@ sub svnStatus($)
return $svnStatus;
}
+# Convert a line of a git-formatted patch to SVN format, while
+# preserving any end-of-line characters.
sub gitdiff2svndiff($)
{
$_ = shift @_;
- if (m#^diff --git \w/(.+) \w/(.+)#) {
- return "Index: $1";
- } elsif (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
- return "===================================================================";
- } elsif (m#^--- \w/(.+)#) {
- return "--- $1";
- } elsif (m#^\+\+\+ \w/(.+)#) {
- return "+++ $1";
+
+ # \V is any character that is not vertical white space
+ if (m#^diff --git \w/(.+) \w/([^\r\n]+)#) {
+ return "Index: $1$POSTMATCH";
+ }
+ if (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
+ return "===================================================================$POSTMATCH";
+ }
+ if (m#^--- \w/([^\r\n]+)#) {
+ return "--- $1$POSTMATCH";
+ }
+ if (m#^\+\+\+ \w/([^\r\n]+)#) {
+ return "+++ $1$POSTMATCH";
}
return $_;
}
diff --git a/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/gitdiff2svndiff.pl b/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/gitdiff2svndiff.pl
index 6739585..93708d6 100644
--- a/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/gitdiff2svndiff.pl
+++ b/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/gitdiff2svndiff.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
#
# Copyright (C) 2009, 2010 Chris Jerdonek (chris.jerdonek at gmail.com)
# Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
@@ -31,14 +31,24 @@
# Unit tests of VCSUtils::gitdiff2svndiff()
-use Test::Simple tests => 6;
-use VCSUtils;
+use strict;
+use warnings;
-my $out;
-my $title;
+use Test::Simple tests => 20;
+use VCSUtils;
-# New test
-$title = "gitdiff2svndiff: Convert standard git diff to svn diff";
+# We use this for display purposes, to keep each test title on one line.
+sub excerptString($)
+{
+ my ($text) = @_;
+
+ my $length = 25;
+
+ my $shortened = substr($text, 0, $length);
+ $shortened .= "..." if (length($text) > $length);
+
+ return $shortened;
+}
my $git_patch = <<END;
diff --git a/WebCore/rendering/style/StyleFlexibleBoxData.h b/WebCore/rendering/style/StyleFlexibleBoxData.h
@@ -56,16 +66,31 @@ Index: WebCore/rendering/style/StyleFlexibleBoxData.h
@@ -47,7 +47,6 @@ public:
END
-$out = "";
+my @gitLines = split("\n", $git_patch);
+my @svnLines = split("\n", $svn_patch);
-foreach my $line (split('\n', $git_patch)) {
- $out .= gitdiff2svndiff($line) . "\n";
-}
+# New test: check each git header line with different line endings
+my $titleHeader = "gitdiff2svndiff: ";
-ok($svn_patch eq $out, $title);
+my @lineEndingPairs = ( # display name, value
+ ["", ""],
+ ["\\n", "\n"],
+ ["\\r\\n", "\r\n"],
+);
+
+for (my $i = 0; $i < @gitLines; $i++) {
+ foreach my $pair (@lineEndingPairs) {
+ my $gitLine = $gitLines[$i] . $pair->[1];
+ my $expected = $svnLines[$i] . $pair->[1];
+ my $title = $titleHeader . excerptString($gitLine);
+ $title .= " [line-end: \"$pair->[0]\"]";
+
+ ok($expected eq gitdiff2svndiff($gitLine), $title);
+ }
+}
# New test
-$title = "gitdiff2svndiff: Convert mnemonic git diff to svn diff";
+my $title = "gitdiff2svndiff: Convert mnemonic git diff to svn diff";
my @prefixes = (
{ 'a' => 'i', 'b' => 'w' }, # git-diff (compares the (i)ndex and the (w)ork tree)
@@ -75,6 +100,8 @@ my @prefixes = (
{ 'a' => '1', 'b' => '2' }, # git diff --no-index a b (compares two non-git things (1) and (2))
);
+my $out = "";
+
foreach my $prefix (@prefixes) {
my $mnemonic_patch = $git_patch;
$mnemonic_patch =~ s/ a\// $prefix->{'a'}\//g;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list