<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[189195] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/189195">189195</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-31 16:44:41 -0700 (Mon, 31 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modify prepare-Changelog to be aware of files that are marked as tests as well as files
that are marked as requiring corresponding tests.
https://bugs.webkit.org/show_bug.cgi?id=148498
<rdar://problem/21555314>
Patch by Jason Marcell <jmarcell@apple.com> on 2015-08-31
Reviewed by Dan Bernstein and David Kilzer.
* Scripts/prepare-ChangeLog: Added "attributeCache" to cache Subversion properties in order to
simulate Git's attribute behevaior.
(main): Added "requiresTests" array to contain files that require tests.
(generateNewChangeLogs): Checks "requiresTests" array to determine whether to inject "tests"
section in ChangeLog.
(attributeCommand): Queries a given file for a given Git attribute value. If using Subversion,
however, we check if the file or any containing folder has the given property set to "1" and
return 1 if so; return 0 otherwise.
(generateFileList): Adds files to "requiresTests" array if Git attribute is set to "1". Also
adds files to "addedRegressionTests" array if "test" attribute is set to "1".</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsprepareChangeLog">trunk/Tools/Scripts/prepare-ChangeLog</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (189194 => 189195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-08-31 23:30:10 UTC (rev 189194)
+++ trunk/Tools/ChangeLog        2015-08-31 23:44:41 UTC (rev 189195)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-08-31 Jason Marcell <jmarcell@apple.com>
+
+ Modify prepare-Changelog to be aware of files that are marked as tests as well as files
+ that are marked as requiring corresponding tests.
+ https://bugs.webkit.org/show_bug.cgi?id=148498
+ <rdar://problem/21555314>
+
+ Reviewed by Dan Bernstein and David Kilzer.
+
+ * Scripts/prepare-ChangeLog: Added "attributeCache" to cache Subversion properties in order to
+ simulate Git's attribute behevaior.
+ (main): Added "requiresTests" array to contain files that require tests.
+ (generateNewChangeLogs): Checks "requiresTests" array to determine whether to inject "tests"
+ section in ChangeLog.
+ (attributeCommand): Queries a given file for a given Git attribute value. If using Subversion,
+ however, we check if the file or any containing folder has the given property set to "1" and
+ return 1 if so; return 0 otherwise.
+ (generateFileList): Adds files to "requiresTests" array if Git attribute is set to "1". Also
+ adds files to "addedRegressionTests" array if "test" attribute is set to "1".
+
</ins><span class="cx"> 2015-08-26 Andy Estes <aestes@apple.com>
</span><span class="cx">
</span><span class="cx"> [Content Filtering] Determine navigation and content policy before continuing to filter a load
</span></span></pre></div>
<a id="trunkToolsScriptsprepareChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/prepare-ChangeLog (189194 => 189195)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/prepare-ChangeLog        2015-08-31 23:30:10 UTC (rev 189194)
+++ trunk/Tools/Scripts/prepare-ChangeLog        2015-08-31 23:44:41 UTC (rev 189195)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> use POSIX qw(strftime);
</span><span class="cx"> use VCSUtils;
</span><span class="cx">
</span><ins>+sub attributeCommand($$);
</ins><span class="cx"> sub changeLogDate($);
</span><span class="cx"> sub changeLogEmailAddressFromArgs($$);
</span><span class="cx"> sub changeLogNameFromArgs($$);
</span><span class="lines">@@ -81,7 +82,7 @@
</span><span class="cx"> sub generateFileList(\%$$$);
</span><span class="cx"> sub generateFunctionLists($$$$$);
</span><span class="cx"> sub generateFunctionListsByRanges($$$$);
</span><del>-sub generateNewChangeLogs($$$$$$$$$$$$);
</del><ins>+sub generateNewChangeLogs($$$$$$$$$$$$$);
</ins><span class="cx"> sub getLatestChangeLogs($);
</span><span class="cx"> sub get_function_line_ranges($$);
</span><span class="cx"> sub get_function_line_ranges_for_cpp($$);
</span><span class="lines">@@ -117,6 +118,8 @@
</span><span class="cx"> use constant GIT => "git";
</span><span class="cx"> use constant SupportedTestExtensions => {map { $_ => 1 } qw(html shtml svg xml xhtml pl php)};
</span><span class="cx">
</span><ins>+my %attributeCache;
+
</ins><span class="cx"> exit(main());
</span><span class="cx">
</span><span class="cx"> sub main()
</span><span class="lines">@@ -184,7 +187,7 @@
</span><span class="cx"> my %paths = processPaths(@ARGV);
</span><span class="cx">
</span><span class="cx"> # Find the list of modified files
</span><del>- my ($changedFiles, $conflictFiles, $functionLists, $addedRegressionTests) = generateFileList(%paths, $gitCommit, $gitIndex, $mergeBase);
</del><ins>+ my ($changedFiles, $conflictFiles, $functionLists, $addedRegressionTests, $requiresTests) = generateFileList(%paths, $gitCommit, $gitIndex, $mergeBase);
</ins><span class="cx">
</span><span class="cx"> if (!@$changedFiles && !@$conflictFiles && !keys %$functionLists) {
</span><span class="cx"> print STDERR " No changes found.\n";
</span><span class="lines">@@ -226,7 +229,7 @@
</span><span class="cx"> resolveConflictedChangeLogs($changeLogs);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- generateNewChangeLogs($prefixes, $filesInChangeLog, $addedRegressionTests, $functionLists, $bugURL, $bugDescription, $name, $emailAddress, $gitReviewer, $gitCommit, $writeChangeLogs, $delimiters);
</del><ins>+ generateNewChangeLogs($prefixes, $filesInChangeLog, $addedRegressionTests, $requiresTests, $functionLists, $bugURL, $bugDescription, $name, $emailAddress, $gitReviewer, $gitCommit, $writeChangeLogs, $delimiters);
</ins><span class="cx">
</span><span class="cx"> if ($writeChangeLogs) {
</span><span class="cx"> print STDERR "-- Please remember to include a detailed description in your ChangeLog entry. --\n-- See <http://webkit.org/coding/contributing.html> for more info --\n";
</span><span class="lines">@@ -527,9 +530,9 @@
</span><span class="cx"> close RESOLVE;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-sub generateNewChangeLogs($$$$$$$$$$$$)
</del><ins>+sub generateNewChangeLogs($$$$$$$$$$$$$)
</ins><span class="cx"> {
</span><del>- my ($prefixes, $filesInChangeLog, $addedRegressionTests, $functionLists, $bugURL, $bugDescription, $name, $emailAddress, $gitReviewer, $gitCommit, $writeChangeLogs, $delimiters) = @_;
</del><ins>+ my ($prefixes, $filesInChangeLog, $addedRegressionTests, $requiresTests, $functionLists, $bugURL, $bugDescription, $name, $emailAddress, $gitReviewer, $gitCommit, $writeChangeLogs, $delimiters) = @_;
</ins><span class="cx">
</span><span class="cx"> # Generate new ChangeLog entries and (optionally) write out new ChangeLog files.
</span><span class="cx"> foreach my $prefix (@$prefixes) {
</span><span class="lines">@@ -570,7 +573,7 @@
</span><span class="cx">
</span><span class="cx"> print CHANGE_LOG normalizeLineEndings(" Reviewed by $reviewer.\n\n", $endl);
</span><span class="cx">
</span><del>- if ($prefix =~ m/WebCore/ || `pwd` =~ m/WebCore/) {
</del><ins>+ if ($prefix =~ m/WebCore/ || `pwd` =~ m/WebCore/ || @$requiresTests) {
</ins><span class="cx"> if (@$addedRegressionTests) {
</span><span class="cx"> print CHANGE_LOG normalizeLineEndings(testListForChangeLog(sort @$addedRegressionTests), $endl);
</span><span class="cx"> } else {
</span><span class="lines">@@ -1801,6 +1804,46 @@
</span><span class="cx"> return "$command 2>&1";
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub attributeCommand($$)
+{
+ my ($file, $attr) = @_;
+
+ my $result;
+ if (isSVN()) {
+ my $foundAttribute = 0;
+ my $subPath = ".";
+ my (@directoryParts) = File::Spec->splitdir($file);
+ foreach my $part (@directoryParts) {
+ if ($part eq ".") {
+ next;
+ }
+ $subPath = File::Spec->join($subPath, $part);
+ $subPath =~ s/^\.\///;
+ if ($foundAttribute || exists $attributeCache{$attr}{$subPath} && $attributeCache{$attr}{$subPath} eq "1") {
+ $attributeCache{$attr}{$subPath} = "1";
+ $foundAttribute = 1;
+ next;
+ }
+ my $command = SVN . " propget $attr $subPath";
+ my $attrib = $attributeCache{$attr}{$subPath} || `$command`;
+ chomp $attrib;
+ if ($attrib eq "1") {
+ $foundAttribute = 1;
+ }
+ $attributeCache{$attr}{$subPath} = $attrib || "0";
+ }
+ $result = $attributeCache{$attr}{$file};
+ } elsif (isGit()) {
+ my $command = GIT . " check-attr $attr -- $file";
+ $result = `$command`;
+ chomp $result;
+ $result =~ s/.*\W(\w)/$1/;
+ }
+
+ $result =~ s/\D//g;
+ return int($result || 0);
+}
+
</ins><span class="cx"> sub createPatchCommand($$$$)
</span><span class="cx"> {
</span><span class="cx"> my ($changedFilesString, $gitCommit, $gitIndex, $mergeBase) = @_;
</span><span class="lines">@@ -1925,6 +1968,7 @@
</span><span class="cx"> my @conflictFiles;
</span><span class="cx"> my %functionLists;
</span><span class="cx"> my @addedRegressionTests;
</span><ins>+ my @requiresTests;
</ins><span class="cx"> print STDERR " Running status to find changed, added, or removed files.\n";
</span><span class="cx"> open STAT, "-|", statusCommand($paths, $gitCommit, $gitIndex, $mergeBase) or die "The status failed: $!.\n";
</span><span class="cx"> while (<STAT>) {
</span><span class="lines">@@ -1984,6 +2028,10 @@
</span><span class="cx"> && $file !~ /-expected(-mismatch)?\.html$/
</span><span class="cx"> && !scalar(grep(/^resources$/i, @components))
</span><span class="cx"> && !scalar(grep(/^script-tests$/i, @components));
</span><ins>+ } elsif (attributeCommand($file, "test")) {
+ push @addedRegressionTests, $file;
+ } elsif (attributeCommand($file, "requiresTests")) {
+ push @requiresTests, $file
</ins><span class="cx"> }
</span><span class="cx"> push @changedFiles, $file if $components[$#components] ne "ChangeLog";
</span><span class="cx"> } elsif (isConflictStatus($status, $gitCommit, $gitIndex) || isConflictStatus($propertyStatus, $gitCommit, $gitIndex)) {
</span><span class="lines">@@ -1995,7 +2043,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> close STAT;
</span><del>- return (\@changedFiles, \@conflictFiles, \%functionLists, \@addedRegressionTests);
</del><ins>+ return (\@changedFiles, \@conflictFiles, \%functionLists, \@addedRegressionTests, \@requiresTests);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub isUnmodifiedStatus($)
</span></span></pre>
</div>
</div>
</body>
</html>