Title: [219376] trunk/Tools
Revision
219376
Author
[email protected]
Date
2017-07-11 17:24:44 -0700 (Tue, 11 Jul 2017)

Log Message

Do not duplicate files when deleting directories with svn 1.9
https://bugs.webkit.org/show_bug.cgi?id=174339
<rdar://problem/33226781>

Reviewed by David Kilzer.

* Scripts/svn-create-patch:
(diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.
(generateFileList): Determine which files are deleted because they are part of a
directory being deleted.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (219375 => 219376)


--- trunk/Tools/ChangeLog	2017-07-12 00:23:25 UTC (rev 219375)
+++ trunk/Tools/ChangeLog	2017-07-12 00:24:44 UTC (rev 219376)
@@ -1,3 +1,16 @@
+2017-07-11  Jonathan Bedard  <[email protected]>
+
+        Do not duplicate files when deleting directories with svn 1.9
+        https://bugs.webkit.org/show_bug.cgi?id=174339
+        <rdar://problem/33226781>
+
+        Reviewed by David Kilzer.
+
+        * Scripts/svn-create-patch:
+        (diffOptionsForFile): No longer pass -N option, since this does not work in SVN 1.9.4.
+        (generateFileList): Determine which files are deleted because they are part of a
+        directory being deleted.
+
 2017-07-11  Dean Jackson  <[email protected]>
 
         Rolling out r219372.

Modified: trunk/Tools/Scripts/svn-create-patch (219375 => 219376)


--- trunk/Tools/Scripts/svn-create-patch	2017-07-12 00:23:25 UTC (rev 219375)
+++ trunk/Tools/Scripts/svn-create-patch	2017-07-12 00:24:44 UTC (rev 219376)
@@ -143,7 +143,7 @@
 {
     my ($file) = @_;
 
-    my $options = "uaNp";
+    my $options = "uap";
 
     if (my $hunkHeaderLineRegEx = hunkHeaderLineRegExForFile($file)) {
         $options .= "F'$hunkHeaderLineRegEx'";
@@ -254,6 +254,8 @@
     my ($statPath, $diffFiles) = @_;
     my %testDirectories = map { $_ => 1 } qw(LayoutTests);
     my $escapedStatPath = escapeSubversionPath($statPath);
+    my @deletedFiles;
+
     open STAT, "svn stat '$escapedStatPath' |" or die;
     while (my $line = <STAT>) {
         # svn may output a different EOL sequence than $/, so avoid chomp.
@@ -269,6 +271,12 @@
         }
         next if -d $path;
         my $modificationType = findModificationType($stat);
+        # svn diff -N doesn't work on svn 1.9, so only return top-level deletions.
+        if ($modificationType eq "deletion") {
+            push @deletedFiles, $path;
+            next;
+        }
+
         if ($modificationType) {
             $diffFiles->{$path}->{path} = $path;
             $diffFiles->{$path}->{modificationType} = $modificationType;
@@ -284,6 +292,22 @@
         }
     }
     close STAT;
+
+    foreach my $path (@deletedFiles) {
+        my $isInsideDeletedDirectory = 0;
+        foreach my $compare (@deletedFiles) {
+            next if $compare eq $path;
+            if (substr($path, 0, length($compare)) eq $compare) {
+                $isInsideDeletedDirectory = 1;
+                last;
+            }
+        }
+        next if $isInsideDeletedDirectory;
+        $diffFiles->{$path}->{path} = $path;
+        $diffFiles->{$path}->{modificationType} = "deletion";
+        $diffFiles->{$path}->{isBinary} = isBinaryMimeType($path);
+        $diffFiles->{$path}->{isTestFile} = exists $testDirectories{(File::Spec->splitdir($path))[0]} ? 1 : 0;
+    }
 }
 
 sub hunkHeaderLineRegExForFile($)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to