WebKit Bugzilla
Attachment 348784 Details for
Bug 14590
: svn-create-patch fails when svn mv is used on directory trees
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v3
bug-14590-20180903113252.patch (text/plain), 7.55 KB, created by
David Kilzer (:ddkilzer)
on 2018-09-03 11:32:52 PDT
(
hide
)
Description:
Patch v3
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2018-09-03 11:32:52 PDT
Size:
7.55 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 235600) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,23 @@ >+2018-09-03 David Kilzer <ddkilzer@apple.com> >+ >+ svn-create-patch fails when svn mv is used on directory trees >+ <https://webkit.org/b/14590> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/svn-create-patch: Update copyright and license. >+ (generateDiff): Return early for moved directories since >+ individual files within the directory are handled separately. >+ (generateFileList): Keep track of moved directories in the >+ @additionWithHistoryDirectories array, then process this array >+ in reverse order to create delete/add patches for each file in >+ a moved directory. This also prevents duplicate patches. >+ (manufacturePatchForAdditionWithHistory): Fix a long-standing >+ bug where the path used to describe property changes contained >+ the original (moved-from) path instead of the new (moved-to) >+ path. This could cause svn-apply to fail mysteriously when >+ trying to apply an empty patch. >+ > 2018-09-01 Michael Catanzaro <mcatanzaro@igalia.com> > > [WPE] 2.21.91 fails to build with ENABLE_MINIBROWSER >Index: Tools/Scripts/svn-create-patch >=================================================================== >--- Tools/Scripts/svn-create-patch (revision 235584) >+++ Tools/Scripts/svn-create-patch (working copy) >@@ -1,30 +1,26 @@ > #!/usr/bin/env perl > >-# Copyright (C) 2005, 2006 Apple Inc. All rights reserved. >+# Copyright (C) 2005-2018 Apple Inc. 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. >+# 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. >-# 3. Neither the name of Apple Inc. ("Apple") nor the names of >-# its contributors may be used to endorse or promote products derived >-# from this software without specific prior written permission. >+# documentation and/or other materials provided with the distribution. > # >-# THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY >+# 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 OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+# 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. >+# 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. > > # Extended "svn diff" script for WebKit Open Source Project, used to make patches. > >@@ -35,10 +31,7 @@ > # Handles binary files (encoded as a base64 chunk of text). > # Sorts the diffs alphabetically by text files, then binary files. > # Handles copied and moved files. >-# >-# Missing features: >-# >-# Handle copied and moved directories. >+# Handles copied and moved directories. > > use strict; > use warnings; >@@ -252,6 +245,8 @@ sub generateDiff($$) > my $patch = ""; > my $isAdditionWithHistory = $fileData->{modificationType} eq "additionWithHistory"; > if ($isAdditionWithHistory) { >+ # Nothing to do for a moved directory since each moved file is handled individually. >+ return if -d $fileData->{path}; > manufacturePatchForAdditionWithHistory($fileData, $prefix); > } > >@@ -283,6 +278,7 @@ sub generateFileList($\%) > my %testDirectories = map { $_ => 1 } qw(LayoutTests); > my $escapedStatPath = escapeSubversionPath($statPath); > my @deletedFiles; >+ my @additionWithHistoryDirectories; > > print STDERR "Performing \"svn stat '$escapedStatPath'\"\n" if $verbose; > >@@ -305,8 +301,6 @@ sub generateFileList($\%) > $path = substr($line, 7); > } > >- next if -d $path; >- > my $modificationType = findModificationType($stat); > > if ($modificationType eq "missing") { >@@ -343,10 +337,38 @@ sub generateFileList($\%) > my ($sourceFile, $sourceRevision) = findSourceFileAndRevision($path); > $diffFiles->{$path}->{sourceFile} = $sourceFile; > $diffFiles->{$path}->{sourceRevision} = $sourceRevision; >+ push(@additionWithHistoryDirectories, $path) if -d $path; > } > } > close STAT; > >+ # Handle these in reverse order so that the deepest directory moves are processed first. >+ # Shallow directory moves include changes for deeper directories, which causes double >+ # processing and causes the wrong original path to be used. >+ foreach my $directory (reverse @additionWithHistoryDirectories) { >+ my ($sourceDirectory, $sourceRevision) = findSourceFileAndRevision($directory); >+ # Gather a hierarchical list of files inside the moved directory. >+ my $diffOptions = diffOptionsForFile($sourceDirectory); >+ my $escapedDirectory = escapeSubversionPath($directory); >+ print STDERR "Performing \"svn diff --diff-cmd diff -x -$diffOptions '$escapedDirectory'\"\n" if $verbose; >+ open DIFF, "svn diff --diff-cmd diff -x -$diffOptions '$escapedDirectory' |" or die; >+ while (<DIFF>) { >+ if (m/^Index: (.*)$/) { >+ my $movedFile = $1; >+ # Ignore other files added/moved into the moved directory. >+ next if exists $diffFiles->{$movedFile}; >+ $diffFiles->{$movedFile}->{path} = $movedFile; >+ $diffFiles->{$movedFile}->{modificationType} = "additionWithHistory"; >+ $diffFiles->{$movedFile}->{isBinary} = isBinaryMimeType($movedFile); >+ $diffFiles->{$movedFile}->{isTestFile} = exists $testDirectories{(File::Spec->splitdir($movedFile))[0]} ? 1 : 0; >+ my $relativePath = File::Spec->abs2rel("/" . $movedFile, "/" . $directory); >+ $diffFiles->{$movedFile}->{sourceFile} = File::Spec->catfile($sourceDirectory, $relativePath); >+ $diffFiles->{$movedFile}->{sourceRevision} = $sourceRevision; >+ } >+ } >+ close DIFF; >+ } >+ > foreach my $path (@deletedFiles) { > my $isInsideDeletedDirectory = 0; > foreach my $compare (@deletedFiles) { >@@ -408,6 +430,7 @@ sub manufacturePatchForAdditionWithHisto > while (<DIFF>) { > # Skip the diff header, since it was manufactured aboved. > next if ++$count < 5; >+ s/^(Property changes on:\s+)$sourceFile$/$1$file/; > print $_; > } > close DIFF;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 14590
:
348766
|
348782
|
348784
|
348853
|
348862
|
348961