Title: [219563] trunk/Tools
Revision
219563
Author
wei...@apple.com
Date
2017-07-17 10:56:23 -0700 (Mon, 17 Jul 2017)

Log Message

[Scripts] Fix missing variable warnings from svn-create-patch when there are untracked files
https://bugs.webkit.org/show_bug.cgi?id=174575

Reviewed by Brady Eidson.

* Scripts/svn-create-patch:
(findModificationType):
Add support for more status codes. C -> conflicted, ? -> untracked, ! -> missing. Give a
default value of "unknown".

(generateFileList):
Handle all the new modification types. Abort on conflicted, missing, and unknown. Log
for untracked, which matches our old behavior.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (219562 => 219563)


--- trunk/Tools/ChangeLog	2017-07-17 16:38:10 UTC (rev 219562)
+++ trunk/Tools/ChangeLog	2017-07-17 17:56:23 UTC (rev 219563)
@@ -1,3 +1,19 @@
+2017-07-16  Sam Weinig  <s...@webkit.org>
+
+        [Scripts] Fix missing variable warnings from svn-create-patch when there are untracked files
+        https://bugs.webkit.org/show_bug.cgi?id=174575
+
+        Reviewed by Brady Eidson.
+
+        * Scripts/svn-create-patch:
+        (findModificationType):
+        Add support for more status codes. C -> conflicted, ? -> untracked, ! -> missing. Give a
+        default value of "unknown".
+
+        (generateFileList):
+        Handle all the new modification types. Abort on conflicted, missing, and unknown. Log
+        for untracked, which matches our old behavior.
+
 2017-07-17  Charlie Turner  <ctur...@igalia.com>
 
         Add some missing build dependencies on Fedora

Modified: trunk/Tools/Scripts/svn-create-patch (219562 => 219563)


--- trunk/Tools/Scripts/svn-create-patch	2017-07-17 16:38:10 UTC (rev 219562)
+++ trunk/Tools/Scripts/svn-create-patch	2017-07-17 17:56:23 UTC (rev 219563)
@@ -103,9 +103,13 @@
 }
 
 if ($verbose) {
-    print STDERR "List of files for patch:\n";
-    for my $file (sort patchpathcmp values %diffFiles) {
-        print STDERR "  " . $file->{path} . "\n";
+    if (%diffFiles) {
+        print STDERR "List of files for patch:\n";
+        for my $file (sort patchpathcmp values %diffFiles) {
+            print STDERR "  " . $file->{path} . "\n";
+        }
+    } else {
+        print STDERR "No files found for patch.\n";
     }
 }
 
@@ -208,7 +212,10 @@
     }
     return "modification" if ($fileStat eq "M" || $propertyStat eq "M");
     return "deletion" if ($fileStat eq "D");
-    return undef;
+    return "conflicted" if ($fileStat eq "C");
+    return "untracked" if ($fileStat eq "?");
+    return "missing" if ($fileStat eq "!");
+    return "unknown";
 }
 
 sub findSourceFileAndRevision($)
@@ -297,8 +304,31 @@
             $stat = substr($line, 0, 7);
             $path = substr($line, 7);
         }
+
         next if -d $path;
+
         my $modificationType = findModificationType($stat);
+
+        if ($modificationType eq "missing") {
+            print STDERR "Missing file detected: '" . $path . "'. Aborting.\n";
+            exit -1;
+        }
+
+        if ($modificationType eq "conflicted") {
+            print STDERR "Conflicted file detected: '" . $path . "'. Aborting.\n";
+            exit -1;
+        }
+
+        if ($modificationType eq "unknown") {
+            print STDERR "File with unknown status detected: '" . $path . "' [" . $stat . "]. Aborting.\n";
+            exit -1;
+        }
+
+        if ($modificationType eq "untracked") {
+            print STDERR "Ignoring untracked file: '" . $path . "'\n";
+            next;
+        }
+
         # svn diff -N doesn't work on svn 1.9, so only return top-level deletions.
         if ($modificationType eq "deletion") {
             push @deletedFiles, $path;
@@ -305,18 +335,14 @@
             next;
         }
 
-        if ($modificationType) {
-            $diffFiles->{$path}->{path} = $path;
-            $diffFiles->{$path}->{modificationType} = $modificationType;
-            $diffFiles->{$path}->{isBinary} = isBinaryMimeType($path);
-            $diffFiles->{$path}->{isTestFile} = exists $testDirectories{(File::Spec->splitdir($path))[0]} ? 1 : 0;
-            if ($modificationType eq "additionWithHistory") {
-                my ($sourceFile, $sourceRevision) = findSourceFileAndRevision($path);
-                $diffFiles->{$path}->{sourceFile} = $sourceFile;
-                $diffFiles->{$path}->{sourceRevision} = $sourceRevision;
-            }
-        } else {
-            print STDERR $line, "\n";
+        $diffFiles->{$path}->{path} = $path;
+        $diffFiles->{$path}->{modificationType} = $modificationType;
+        $diffFiles->{$path}->{isBinary} = isBinaryMimeType($path);
+        $diffFiles->{$path}->{isTestFile} = exists $testDirectories{(File::Spec->splitdir($path))[0]} ? 1 : 0;
+        if ($modificationType eq "additionWithHistory") {
+            my ($sourceFile, $sourceRevision) = findSourceFileAndRevision($path);
+            $diffFiles->{$path}->{sourceFile} = $sourceFile;
+            $diffFiles->{$path}->{sourceRevision} = $sourceRevision;
         }
     }
     close STAT;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to