[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

dbates at webkit.org dbates at webkit.org
Fri Jan 21 14:47:28 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit c9aca4496eba5ced34fa9baed82073a5b1c42518
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 30 06:03:56 2010 +0000

    2010-12-29  Daniel Bates  <dbates at rim.com>
    
            Reviewed by Darin Adler.
    
            svn-apply updates date of wrong change log entry for a change log diff that
            contains two consecutive entries with the same author and date
            https://bugs.webkit.org/show_bug.cgi?id=46061
    
            Fixes an issue where the date of the wrong change log entry may be modified.
            Moreover, changes fixChangeLogPatch() to move entries inserted earlier
            in a ChangeLog file to the top of the file.
    
            Currently, fixChangeLogPatch() explicitly bails out and returns an unchanged
            diff when it detects that the diff inserts a change log entry earlier in a
            ChangeLog. It is unusual to land a patch that has such a deliberate ChangeLog
            change. With the advent of the commit-queue this functionality of bailing out
            and hence landing the patch as-is is harmful to the accuracy of the ChangeLog.
            Instead, we should always move the change log entry to the top of the ChangeLog file.
    
            A side-effect of this change is that setChangeLogDateAndReviewer() now updates
            the date line of the correct change log entry in a ChangeLog diff.
    
            * Scripts/VCSUtils.pm: Modified fixChangeLogPatch() to move entries inserted earlier to the top.
    
            * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl:
              Updated the following unit tests now that we move entries inserted earlier to the top:
              - "fixChangeLogPatch: New entry inserted in middle."
                (formerly named "fixChangeLogPatch: [no change] New entry inserted in middle.")
    
              - "fixChangeLogPatch: New entry inserted earlier in the file, but after an entry with the same author and date."
                (formerly named "fixChangeLogPatch: [no change] New entry inserted earlier in the file, but after an entry with the same author and date.")
    
            * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74780 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index b3942c2..efe00d7 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,37 @@
+2010-12-29  Daniel Bates  <dbates at rim.com>
+
+        Reviewed by Darin Adler.
+
+        svn-apply updates date of wrong change log entry for a change log diff that
+        contains two consecutive entries with the same author and date
+        https://bugs.webkit.org/show_bug.cgi?id=46061
+
+        Fixes an issue where the date of the wrong change log entry may be modified.
+        Moreover, changes fixChangeLogPatch() to move entries inserted earlier
+        in a ChangeLog file to the top of the file.
+
+        Currently, fixChangeLogPatch() explicitly bails out and returns an unchanged
+        diff when it detects that the diff inserts a change log entry earlier in a
+        ChangeLog. It is unusual to land a patch that has such a deliberate ChangeLog
+        change. With the advent of the commit-queue this functionality of bailing out
+        and hence landing the patch as-is is harmful to the accuracy of the ChangeLog.
+        Instead, we should always move the change log entry to the top of the ChangeLog file.
+
+        A side-effect of this change is that setChangeLogDateAndReviewer() now updates
+        the date line of the correct change log entry in a ChangeLog diff.
+
+        * Scripts/VCSUtils.pm: Modified fixChangeLogPatch() to move entries inserted earlier to the top.
+
+        * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl:
+          Updated the following unit tests now that we move entries inserted earlier to the top:
+          - "fixChangeLogPatch: New entry inserted in middle."
+            (formerly named "fixChangeLogPatch: [no change] New entry inserted in middle.")
+
+          - "fixChangeLogPatch: New entry inserted earlier in the file, but after an entry with the same author and date."
+            (formerly named "fixChangeLogPatch: [no change] New entry inserted earlier in the file, but after an entry with the same author and date.")
+
+        * Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl: Added.
+
 2010-12-29  Konstantin Tokarev  <annulen at yandex.ru>
 
         Reviewed by Eric Seidel.
diff --git a/Tools/Scripts/VCSUtils.pm b/Tools/Scripts/VCSUtils.pm
index faed7ed..93118a4 100644
--- a/Tools/Scripts/VCSUtils.pm
+++ b/Tools/Scripts/VCSUtils.pm
@@ -1304,12 +1304,7 @@ sub setChangeLogDateAndReviewer($$$)
 # Returns $changeLogHashRef:
 #   $changeLogHashRef: a hash reference representing a change log patch.
 #     patch: a ChangeLog patch equivalent to the given one, but with the
-#            newest ChangeLog entry inserted at the top of the file, if possible.
-#     hasOverlappingLines: the value 1 if the change log entry overlaps
-#                          some lines of another change log entry. This can
-#                          happen when deliberately inserting a new ChangeLog
-#                          entry earlier in the file above an entry with
-#                          the same date and author.                     
+#            newest ChangeLog entry inserted at the top of the file, if possible.              
 sub fixChangeLogPatch($)
 {
     my $patch = shift; # $patch will only contain patch fragments for ChangeLog.
@@ -1403,8 +1398,19 @@ sub fixChangeLogPatch($)
         $lines[$i] = "+$text";
     }
 
-    # Finish moving whatever overlapping lines remain, and update
-    # the initial chunk range.
+    # If @overlappingLines > 0, this is where we make use of the
+    # assumption that the beginning of the source file was not modified.
+    splice(@lines, $chunkStartIndex, 0, @overlappingLines);
+
+    # Update the date start index as it may have changed after shifting
+    # the overlapping lines towards the front.
+    for ($i = $chunkStartIndex; $i < $dateStartIndex; ++$i) {
+        $dateStartIndex = $i if $lines[$i] =~ /$dateStartRegEx/;
+    }
+    splice(@lines, $chunkStartIndex, $dateStartIndex - $chunkStartIndex); # Remove context of later entry.
+    $deletedLineCount += $dateStartIndex - $chunkStartIndex;
+
+    # Update the initial chunk range.
     my $chunkRangeRegEx = '^\@\@ -(\d+),(\d+) \+\d+,(\d+) \@\@$'; # e.g. @@ -2,6 +2,18 @@
     if ($lines[$chunkStartIndex - 1] !~ /$chunkRangeRegEx/) {
         # FIXME: Handle errors differently from ChangeLog files that
@@ -1413,21 +1419,9 @@ sub fixChangeLogPatch($)
         $changeLogHashRef{patch} = $patch; # Error: unexpected patch string format.
         return \%changeLogHashRef;
     }
-    my $skippedFirstLineCount = $1 - 1;
     my $oldSourceLineCount = $2;
     my $oldTargetLineCount = $3;
 
-    if (@overlappingLines != $skippedFirstLineCount) {
-        # This can happen, for example, when deliberately inserting
-        # a new ChangeLog entry earlier in the file.
-        $changeLogHashRef{hasOverlappingLines} = 1;
-        $changeLogHashRef{patch} = $patch;
-        return \%changeLogHashRef;
-    }
-    # If @overlappingLines > 0, this is where we make use of the
-    # assumption that the beginning of the source file was not modified.
-    splice(@lines, $chunkStartIndex, 0, @overlappingLines);
-
     my $sourceLineCount = $oldSourceLineCount + @overlappingLines - $deletedLineCount;
     my $targetLineCount = $oldTargetLineCount + @overlappingLines - $deletedLineCount;
     $lines[$chunkStartIndex - 1] = "@@ -1,$sourceLineCount +1,$targetLineCount @@";
diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl
index a7282c7..261592d 100644
--- a/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl
+++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatch.pl
@@ -271,7 +271,7 @@ END
     }
 },
 { # New test
-    diffName => "fixChangeLogPatch: [no change] New entry inserted in middle.",
+    diffName => "fixChangeLogPatch: New entry inserted in middle.",
     inputText => <<'END',
 --- ChangeLog
 +++ ChangeLog
@@ -292,30 +292,26 @@ END
          * File:
 END
     expectedReturn => {
-    hasOverlappingLines => 1,
     patch => <<'END',
 --- ChangeLog
 +++ ChangeLog
-@@ -11,6 +11,14 @@
- 
-         Reviewed by Ray.
- 
-+        Changed some more code on 2009-12-21.
-+
-+        * File:
-+
+@@ -1,3 +1,11 @@
 +2009-12-21  Alice  <alice at email.address>
 +
 +        Reviewed by Ray.
 +
-         Changed some code on 2009-12-21.
++        Changed some more code on 2009-12-21.
++
++        * File:
++
+ 2009-12-21  Alice  <alice at email.address>
  
-         * File:
+         Reviewed by Ray.
 END
     }
 },
 { # New test
-    diffName => "fixChangeLogPatch: [no change] New entry inserted earlier in the file, but after an entry with the same author and date.",
+    diffName => "fixChangeLogPatch: New entry inserted earlier in the file, but after an entry with the same author and date.",
     inputText => <<'END',
 --- ChangeLog
 +++ ChangeLog
@@ -336,25 +332,21 @@ END
          Changed some code on 2009-12-22.
 END
     expectedReturn => {
-    hasOverlappingLines => 1,
     patch => <<'END',
 --- ChangeLog
 +++ ChangeLog
-@@ -70,6 +70,14 @@
- 
- 2009-12-22  Alice  <alice at email.address>
- 
+@@ -1,3 +1,11 @@
++2009-12-22  Alice  <alice at email.address>
++
 +        Reviewed by Sue.
 +
 +        Changed some more code on 2009-12-22.
 +
 +        * File:
 +
-+2009-12-22  Alice  <alice at email.address>
-+
-         Reviewed by Ray.
+ 2009-12-22  Alice  <alice at email.address>
  
-         Changed some code on 2009-12-22.
+         Reviewed by Ray.
 END
     }
 },
diff --git a/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl b/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl
new file mode 100644
index 0000000..bbf7df3
--- /dev/null
+++ b/Tools/Scripts/webkitperl/VCSUtils_unittest/fixChangeLogPatchThenSetChangeLogDateAndReviewer.pl
@@ -0,0 +1,92 @@
+#!/usr/bin/perl -w
+#
+# Copyright (C) 2010 Chris Jerdonek (cjerdonek at webkit.org)
+# Copyright (C) 2010 Research In Motion Limited. All rights reserved.
+#
+# 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.
+
+# Unit tests for setChangeLogDateAndReviewer(fixChangeLogPatch()).
+
+use strict;
+use warnings;
+
+use Test::More;
+use VCSUtils;
+
+my @testCaseHashRefs = (
+{
+    testName => "New entry inserted earlier in the file, but after an entry with the same author and date, patch applied a day later.",
+    reviewer => "Sue",
+    epochTime => 1273414321,
+    patch => <<'END',
+--- ChangeLog
++++ ChangeLog
+@@ -70,6 +70,14 @@
+ 
+ 2010-05-08  Alice  <alice at email.address>
+ 
++        Reviewed by NOBODY (OOPS!).
++
++        Changed some more code on 2010-05-08.
++
++        * File:
++
++2010-05-08  Alice  <alice at email.address>
++
+         Reviewed by Ray.
+ 
+         Changed some code on 2010-05-08.
+END
+    expectedReturn => <<'END',
+--- ChangeLog
++++ ChangeLog
+@@ -1,3 +1,11 @@
++2010-05-09  Alice  <alice at email.address>
++
++        Reviewed by Sue.
++
++        Changed some more code on 2010-05-08.
++
++        * File:
++
+ 2010-05-08  Alice  <alice at email.address>
+ 
+         Reviewed by Ray.
+END
+},
+);
+
+my $testCasesCount = @testCaseHashRefs;
+plan(tests => 1 * $testCasesCount); # Total number of assertions.
+
+foreach my $testCase (@testCaseHashRefs) {
+    my $testNameStart = "setChangeLogDateAndReviewer(fixChangeLogPatch()): $testCase->{testName}: comparing";
+
+    my $patch = $testCase->{patch};
+    my $reviewer = $testCase->{reviewer};
+    my $epochTime = $testCase->{epochTime};
+
+    my $fixedChangeLog = VCSUtils::fixChangeLogPatch($patch);
+    my $got = VCSUtils::setChangeLogDateAndReviewer($fixedChangeLog->{patch}, $reviewer, $epochTime);
+    my $expectedReturn = $testCase->{expectedReturn};
+
+    is($got, $expectedReturn, "$testNameStart return value.");
+}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list