<!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>[171954] 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/171954">171954</a></dd>
<dt>Author</dt> <dd>mitz@apple.com</dd>
<dt>Date</dt> <dd>2014-08-01 16:10:50 -0700 (Fri, 01 Aug 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>commit-log-editor uses a non-standard message format when git index contains no ChangeLog changes
https://bugs.webkit.org/show_bug.cgi?id=135527
Reviewed by Tim Horton.
* Scripts/commit-log-editor:
In the case of a git repository when there are no changed ChangeLog files, changed to pass
the --delimiters option to prepare-ChangeLog, then process each entry in the output using
commitMessageFromChangeLogEntry.
(commitMessageFromChangeLogEntry): Factored out from createCommitMessage.
(sortKey): Factored out from createCommitMessage.
(createCommitMessage): Changed to use new sortKey and commitMessageFromChangeLogEntry
subroutines.
* Scripts/prepare-ChangeLog:
(main): Parse new --delimiters option.
(generateNewChangeLogs): When --no-write and --delimiters are both specified, always print
the label before each change log entry, and a "~" delimiter on a new line after each entry.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptscommitlogeditor">trunk/Tools/Scripts/commit-log-editor</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 (171953 => 171954)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-08-01 22:49:51 UTC (rev 171953)
+++ trunk/Tools/ChangeLog        2014-08-01 23:10:50 UTC (rev 171954)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-08-01 Dan Bernstein <mitz@apple.com>
+
+ commit-log-editor uses a non-standard message format when git index contains no ChangeLog changes
+ https://bugs.webkit.org/show_bug.cgi?id=135527
+
+ Reviewed by Tim Horton.
+
+ * Scripts/commit-log-editor:
+ In the case of a git repository when there are no changed ChangeLog files, changed to pass
+ the --delimiters option to prepare-ChangeLog, then process each entry in the output using
+ commitMessageFromChangeLogEntry.
+ (commitMessageFromChangeLogEntry): Factored out from createCommitMessage.
+ (sortKey): Factored out from createCommitMessage.
+ (createCommitMessage): Changed to use new sortKey and commitMessageFromChangeLogEntry
+ subroutines.
+
+ * Scripts/prepare-ChangeLog:
+ (main): Parse new --delimiters option.
+ (generateNewChangeLogs): When --no-write and --delimiters are both specified, always print
+ the label before each change log entry, and a "~" delimiter on a new line after each entry.
+
</ins><span class="cx"> 2014-08-01 Bear Travis <betravis@adobe.com>
</span><span class="cx">
</span><span class="cx"> [Feature Queries] Enable Feature Queries on EFL/GTK
</span></span></pre></div>
<a id="trunkToolsScriptscommitlogeditor"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/commit-log-editor (171953 => 171954)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/commit-log-editor        2014-08-01 22:49:51 UTC (rev 171953)
+++ trunk/Tools/Scripts/commit-log-editor        2014-08-01 23:10:50 UTC (rev 171954)
</span><span class="lines">@@ -38,6 +38,8 @@
</span><span class="cx"> use VCSUtils;
</span><span class="cx"> use webkitdirs;
</span><span class="cx">
</span><ins>+sub commitMessageFromChangeLogEntry($);
+sub sortKey($);
</ins><span class="cx"> sub createCommitMessage(@);
</span><span class="cx"> sub loadTermReadKey();
</span><span class="cx"> sub normalizeLineEndings($$);
</span><span class="lines">@@ -176,11 +178,34 @@
</span><span class="cx"> chomp($webkitGenerateCommitMessage = `git config --bool core.webkitGenerateCommitMessage`);
</span><span class="cx"> }
</span><span class="cx"> if ($webkitGenerateCommitMessage ne "false") {
</span><del>- open CHANGELOG_ENTRIES, "-|", "$FindBin::Bin/prepare-ChangeLog --git-index --no-write --no-style" or die "prepare-ChangeLog failed: $!.\n";
- while (<CHANGELOG_ENTRIES>) {
- print NEWLOG normalizeLineEndings($_, $endl);
</del><ins>+ my %changeLogSort;
+ my %changeLogContents;
+ open my $changeLogEntries, "-|", "$FindBin::Bin/prepare-ChangeLog --git-index --no-write --no-style --delimiters" or die "prepare-ChangeLog failed: $!.\n";
+
+ while (!eof($changeLogEntries)) {
+ my $label = <$changeLogEntries>;
+ chomp $label;
+ $label =~ s/:$//;
+ ($changeLogContents{$label}) = commitMessageFromChangeLogEntry($changeLogEntries);
+ $changeLogSort{sortKey($label)} = $label;
</ins><span class="cx"> }
</span><del>- close CHANGELOG_ENTRIES;
</del><ins>+ close $changeLogEntries;
+
+ my $commonPrefix = removeLongestCommonPrefixEndingInNewline(%changeLogContents);
+
+ my @result;
+ push @result, normalizeLineEndings($commonPrefix, $endl);
+ for my $sortKey (sort keys %changeLogSort) {
+ my $label = $changeLogSort{$sortKey};
+ next if ($changeLogContents{$label} eq "\n");
+ if (keys %changeLogSort > 1) {
+ push @result, normalizeLineEndings("\n", $endl);
+ push @result, normalizeLineEndings("$label: ", $endl);
+ }
+ push @result, normalizeLineEndings($changeLogContents{$label}, $endl);
+ }
+
+ print NEWLOG join '', @result;
</ins><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> print NEWLOG createCommitMessage(@changeLogs);
</span><span class="lines">@@ -209,68 +234,89 @@
</span><span class="cx">
</span><span class="cx"> unlink "$log.edit";
</span><span class="cx">
</span><del>-sub createCommitMessage(@)
</del><ins>+sub commitMessageFromChangeLogEntry($)
</ins><span class="cx"> {
</span><del>- my @changeLogs = @_;
</del><ins>+ my ($changeLog) = @_;
</ins><span class="cx">
</span><del>- my $topLevel = determineVCSRoot();
</del><ins>+ my $commitMessage = "";
+ my $blankLines = "";
+ my $lineCount = 0;
+ my $date = "";
+ my $author = "";
+ my $email = "";
+ my $hasAuthorInfoToWrite = 0;
</ins><span class="cx">
</span><del>- my %changeLogSort;
- my %changeLogContents;
- for my $changeLog (@changeLogs) {
- open CHANGELOG, $changeLog or die "Can't open $changeLog";
- my $contents = "";
- my $blankLines = "";
- my $lineCount = 0;
- my $date = "";
- my $author = "";
- my $email = "";
- my $hasAuthorInfoToWrite = 0;
- while (<CHANGELOG>) {
- if (/^\S/) {
- last if $contents;
- }
- if (/\S/) {
- $contents .= $blankLines if $contents;
- $blankLines = "";
</del><ins>+ while (<$changeLog>) {
+ if (/^\S/) {
+ last if $commitMessage;
+ }
+ if (/\S/) {
+ $commitMessage .= $blankLines if $commitMessage;
+ $blankLines = "";
</ins><span class="cx">
</span><del>- my $line = $_;
</del><ins>+ my $line = $_;
+ # Remove indentation spaces
+ $line =~ s/^ {8}//;
</ins><span class="cx">
</span><del>- # Remove indentation spaces
- $line =~ s/^ {8}//;
</del><ins>+ # Grab the author and the date line
+ if ($line =~ m/^([0-9]{4}-[0-9]{2}-[0-9]{2})\s+(.*[^\s])\s+<(.*)>/ && $lineCount == 0) {
+ $date = $1;
+ $author = $2;
+ $email = $3;
+ $hasAuthorInfoToWrite = 1;
+ next;
+ }
</ins><span class="cx">
</span><del>- # Grab the author and the date line
- if ($line =~ m/^([0-9]{4}-[0-9]{2}-[0-9]{2})\s+(.*[^\s])\s+<(.*)>/ && $lineCount == 0) {
- $date = $1;
- $author = $2;
- $email = $3;
- $hasAuthorInfoToWrite = 1;
- next;
- }
</del><ins>+ if ($hasAuthorInfoToWrite) {
+ my $isReviewedByLine = $line =~ m/^(?:Reviewed|Rubber[ \-]?stamped) by/;
+ my $isModifiedFileLine = $line =~ m/^\* .*:/;
</ins><span class="cx">
</span><del>- if ($hasAuthorInfoToWrite) {
- my $isReviewedByLine = $line =~ m/^(?:Reviewed|Rubber[ \-]?stamped) by/;
- my $isModifiedFileLine = $line =~ m/^\* .*:/;
-
- # Insert the authorship line if needed just above the "Reviewed by" line or the
- # first modified file (whichever comes first).
- if ($isReviewedByLine || $isModifiedFileLine) {
- $hasAuthorInfoToWrite = 0;
- my $authorshipString = patchAuthorshipString($author, $email, $date);
- if ($authorshipString) {
- $contents .= "$authorshipString\n";
- $contents .= "\n" if $isModifiedFileLine;
- }
</del><ins>+ # Insert the authorship line if needed just above the "Reviewed by" line or the
+ # first modified file (whichever comes first).
+ if ($isReviewedByLine || $isModifiedFileLine) {
+ $hasAuthorInfoToWrite = 0;
+ my $authorshipString = patchAuthorshipString($author, $email, $date);
+ if ($authorshipString) {
+ $commitMessage .= "$authorshipString\n";
+ $commitMessage .= "\n" if $isModifiedFileLine;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx">
</span><del>- $lineCount++;
- $contents .= $line;
- } else {
- $blankLines .= $_;
- }
</del><ins>+ $lineCount++;
+ $commitMessage .= $line;
+ } else {
+ $blankLines .= $_;
</ins><span class="cx"> }
</span><ins>+ }
+ return ($commitMessage, $hasAuthorInfoToWrite, $date, $author, $email);
+}
+
+sub sortKey($)
+{
+ my ($label) = @_;
+ my $sortKey = lc $label;
+ if ($label eq "top level") {
+ $sortKey = "";
+ } elsif ($label eq "LayoutTests") {
+ $sortKey = lc "~, LayoutTests last";
+ }
+ return $sortKey;
+}
+
+sub createCommitMessage(@)
+{
+ my @changeLogs = @_;
+
+ my $topLevel = determineVCSRoot();
+
+ my %changeLogSort;
+ my %changeLogContents;
+ for my $changeLog (@changeLogs) {
+ open my $changeLogFile, $changeLog or die "Can't open $changeLog";
+
+ my ($contents, $hasAuthorInfoToWrite, $date, $author, $email) = commitMessageFromChangeLogEntry($changeLogFile);
</ins><span class="cx"> if ($hasAuthorInfoToWrite) {
</span><span class="cx"> # We didn't find anywhere to put the authorship info, so just put it at the end.
</span><span class="cx"> my $authorshipString = patchAuthorshipString($author, $email, $date);
</span><span class="lines">@@ -278,21 +324,14 @@
</span><span class="cx"> $hasAuthorInfoToWrite = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- close CHANGELOG;
</del><ins>+ close $changeLogFile;
</ins><span class="cx">
</span><span class="cx"> $changeLog = File::Spec->abs2rel(File::Spec->rel2abs($changeLog), $topLevel);
</span><span class="cx">
</span><span class="cx"> my $label = dirname($changeLog);
</span><span class="cx"> $label = "top level" unless length $label;
</span><span class="cx">
</span><del>- my $sortKey = lc $label;
- if ($label eq "top level") {
- $sortKey = "";
- } elsif ($label eq "LayoutTests") {
- $sortKey = lc "~, LayoutTests last";
- }
-
- $changeLogSort{$sortKey} = $label;
</del><ins>+ $changeLogSort{sortKey($label)} = $label;
</ins><span class="cx"> $changeLogContents{$label} = $contents;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsScriptsprepareChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/prepare-ChangeLog (171953 => 171954)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/prepare-ChangeLog        2014-08-01 22:49:51 UTC (rev 171953)
+++ trunk/Tools/Scripts/prepare-ChangeLog        2014-08-01 23:10:50 UTC (rev 171954)
</span><span class="lines">@@ -80,7 +80,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">@@ -131,12 +131,14 @@
</span><span class="cx"> my $checkWebKitStyle;
</span><span class="cx"> my $openChangeLogs = 0;
</span><span class="cx"> my $writeChangeLogs = 1;
</span><ins>+ my $delimiters = 0;
</ins><span class="cx"> my $showHelp = 0;
</span><span class="cx"> my $spewDiff = $ENV{"PREPARE_CHANGELOG_DIFF"};
</span><span class="cx"> my $updateChangeLogs = 1;
</span><span class="cx"> my $parseOptionsResult =
</span><span class="cx"> GetOptions("diff|d!" => \$spewDiff,
</span><span class="cx"> "bug|b:i" => \$bugNumber,
</span><ins>+ "delimiters" => \$delimiters,
</ins><span class="cx"> "description:s" => \$bugDescription,
</span><span class="cx"> "name:s" => \$name,
</span><span class="cx"> "email:s" => \$emailAddress,
</span><span class="lines">@@ -164,6 +166,7 @@
</span><span class="cx"> print STDERR " -o|--open Open ChangeLogs in an editor when done\n";
</span><span class="cx"> print STDERR " --[no-]update Update ChangeLogs from svn before adding entry (default: update)\n";
</span><span class="cx"> print STDERR " --[no-]write Write ChangeLogs to disk (otherwise send new entries to stdout) (default: write)\n";
</span><ins>+ print STDERR " --delimiters When writing to stdout, label and print a \"~\" after each entry\n";
</ins><span class="cx"> print STDERR " --email= Specify the email address to be used in the patch\n";
</span><span class="cx"> return 1;
</span><span class="cx"> }
</span><span class="lines">@@ -222,7 +225,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);
</del><ins>+ generateNewChangeLogs($prefixes, $filesInChangeLog, $addedRegressionTests, $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">@@ -522,9 +525,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) = @_;
</del><ins>+ my ($prefixes, $filesInChangeLog, $addedRegressionTests, $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">@@ -547,7 +550,7 @@
</span><span class="cx"> open CHANGE_LOG, "> ${changeLogPath}" or die "Could not write ${changeLogPath}\n.";
</span><span class="cx"> } else {
</span><span class="cx"> open CHANGE_LOG, ">-" or die "Could not write to STDOUT\n.";
</span><del>- print substr($prefix, 0, length($prefix) - 1) . ":\n\n" unless (scalar @$prefixes) == 1;
</del><ins>+ print substr($prefix, 0, length($prefix) - 1) . ":\n\n" unless (scalar @$prefixes) == 1 && !$delimiters;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $date = changeLogDate(ChangeLogTimeZone);
</span><span class="lines">@@ -582,6 +585,7 @@
</span><span class="cx"> print CHANGE_LOG normalizeLineEndings("\n", $endl), @old_change_log;
</span><span class="cx"> } else {
</span><span class="cx"> print CHANGE_LOG "\n";
</span><ins>+ print "~\n" if $delimiters;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> close CHANGE_LOG;
</span></span></pre>
</div>
</div>
</body>
</html>