Changeset 46156 in webkit


Ignore:
Timestamp:
Jul 20, 2009 11:41:30 PM (15 years ago)
Author:
mrowe@apple.com
Message:

Fix <https://bugs.webkit.org/show_bug.cgi?id=27482>.
Bug 27482: svn-apply cannot apply patch generated by Windows SVN

Reviewed by David D. Kilzer.

A regexp in svn-apply was treating everything prior to a \n as part of the
file name. The native Windows SVN client uses \r\n for line endings which
meant that the \r was being included in the file name. This defeated the
special-case logic for ChangeLogs to apply them with an increased fuzz factor,
meaning that the ChangeLog portions of such patches would fail to apply.

Also updated two other regexps that look like they would hit similar problems
with line-endings so that they will correctly handle patches from Windows SVN.

  • Scripts/svn-apply:
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r46139 r46156  
     12009-07-20  Mark Rowe  <mrowe@apple.com>
     2
     3        Reviewed by David D. Kilzer.
     4
     5        Fix <https://bugs.webkit.org/show_bug.cgi?id=27482>.
     6        Bug 27482: svn-apply cannot apply patch generated by Windows SVN
     7
     8        A regexp in svn-apply was treating everything prior to a \n as part of the
     9        file name.  The native Windows SVN client uses \r\n for line endings which
     10        meant that the \r was being included in the file name.  This defeated the
     11        special-case logic for ChangeLogs to apply them with an increased fuzz factor,
     12        meaning that the ChangeLog portions of such patches would fail to apply.
     13
     14        Also updated two other regexps that look like they would hit similar problems
     15        with line-endings so that they will correctly handle patches from Windows SVN.
     16
     17        * Scripts/svn-apply:
     18
    1192009-07-20  Peter Kasting  <pkasting@google.com>
    220
  • trunk/WebKitTools/Scripts/svn-apply

    r45751 r46156  
    255255    my $contextLineCount = 3;
    256256
    257     return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\n( .*\n)+(\+.*\n)+( .*\n){$contextLineCount}$/m;
     257    return $patch if $patch !~ /\n@@ -1,(\d+) \+1,(\d+) @@\r?\n( .*\r?\n)+(\+.*\r?\n)+( .*\r?\n){$contextLineCount}$/m;
    258258    my ($oldLineCount, $newLineCount) = ($1, $2);
    259259    return $patch if $oldLineCount <= $contextLineCount;
     
    359359    return if !$patch;
    360360
    361     unless ($patch =~ m|^Index: ([^\n]+)|) {
     361    unless ($patch =~ m|^Index: ([^\r\n]+)|) {
    362362        my $separator = '-' x 67;
    363363        warn "Failed to find 'Index:' in:\n$separator\n$patch\n$separator\n";
     
    370370    my $isBinary = 0;
    371371
    372     $addition = 1 if ($patch =~ /\n--- .+\(revision 0\)\n/ || $patch =~ /\n@@ -0,0 .* @@/);
     372    $addition = 1 if ($patch =~ /\n--- .+\(revision 0\)\r?\n/ || $patch =~ /\n@@ -0,0 .* @@/);
    373373    $deletion = 1 if $patch =~ /\n@@ .* \+0,0 @@/;
    374374    $isBinary = 1 if $patch =~ /\nCannot display: file marked as a binary type\./;
Note: See TracChangeset for help on using the changeset viewer.