<!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>[190328] 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/190328">190328</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-09-29 14:16:41 -0700 (Tue, 29 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Win] Allow 'prepare-ChangeLog' to be used without Cygwin
https://bugs.webkit.org/show_bug.cgi?id=149639

Reviewed by Alex Christensen.

* Scripts/VCSUtils.pm:
(exitStatus): Use 'isWindows()' method.
(isSVNVersion16OrNewer): 'eval' is not needed here, and just causes
an error. This method could probably just go away.
(normalizePath): Leave Windows (or Unix) paths as platform paths, rather than
always changing to Unix style. 
(unixPath): Added. Needed so Windows can always show a Unix path in the
ChangeLog file.
(changeLogName): Work around the fact that 'getpwuid' is not available on
a pure Windows build of Perl.
* Scripts/prepare-ChangeLog:
(generateFunctionLists): Normalize path received from 'svn' in case it's a Unix
path on Windows.
(svnUpdateCommand): Added helper function. Needed because Windows Perl does not
support using arrays for 'open' arguments.
(resolveChangeLogsPath): Ditto.
(resolveConflictedChangeLogs): Use new helper functions.
(generateNewChangeLogs): Force Windows to use Unix paths in ChangeLog output.
(diffCommand): Use double-quotes for paths, since Windows doesn't understand single
quotes. Unix systems are happy either way.
(statusCommand): Ditto.
* Scripts/webkitdirs.pm:
(launcherName): Drive-by fix. WinLauncher was renamed to MiniBrowser some time ago.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsVCSUtilspm">trunk/Tools/Scripts/VCSUtils.pm</a></li>
<li><a href="#trunkToolsScriptsprepareChangeLog">trunk/Tools/Scripts/prepare-ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitdirspm">trunk/Tools/Scripts/webkitdirs.pm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (190327 => 190328)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-09-29 21:03:54 UTC (rev 190327)
+++ trunk/Tools/ChangeLog        2015-09-29 21:16:41 UTC (rev 190328)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2015-09-29  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [Win] Allow 'prepare-ChangeLog' to be used without Cygwin
+        https://bugs.webkit.org/show_bug.cgi?id=149639
+
+        Reviewed by Alex Christensen.
+
+        * Scripts/VCSUtils.pm:
+        (exitStatus): Use 'isWindows()' method.
+        (isSVNVersion16OrNewer): 'eval' is not needed here, and just causes
+        an error. This method could probably just go away.
+        (normalizePath): Leave Windows (or Unix) paths as platform paths, rather than
+        always changing to Unix style. 
+        (unixPath): Added. Needed so Windows can always show a Unix path in the
+        ChangeLog file.
+        (changeLogName): Work around the fact that 'getpwuid' is not available on
+        a pure Windows build of Perl.
+        * Scripts/prepare-ChangeLog:
+        (generateFunctionLists): Normalize path received from 'svn' in case it's a Unix
+        path on Windows.
+        (svnUpdateCommand): Added helper function. Needed because Windows Perl does not
+        support using arrays for 'open' arguments.
+        (resolveChangeLogsPath): Ditto.
+        (resolveConflictedChangeLogs): Use new helper functions.
+        (generateNewChangeLogs): Force Windows to use Unix paths in ChangeLog output.
+        (diffCommand): Use double-quotes for paths, since Windows doesn't understand single
+        quotes. Unix systems are happy either way.
+        (statusCommand): Ditto.
+        * Scripts/webkitdirs.pm:
+        (launcherName): Drive-by fix. WinLauncher was renamed to MiniBrowser some time ago.
+
+2015-09-29  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
</ins><span class="cx">         [Win] Unreviewed 64-bit build fix after switch to CMake.
</span><span class="cx"> 
</span><span class="cx">         * Scripts/webkitdirs.pm:
</span></span></pre></div>
<a id="trunkToolsScriptsVCSUtilspm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/VCSUtils.pm (190327 => 190328)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/VCSUtils.pm        2015-09-29 21:03:54 UTC (rev 190327)
+++ trunk/Tools/Scripts/VCSUtils.pm        2015-09-29 21:16:41 UTC (rev 190328)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.  All rights reserved.
</del><ins>+# Copyright (C) 2007-2013, 2015 Apple Inc.  All rights reserved.
</ins><span class="cx"> # Copyright (C) 2009, 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
</span><span class="cx"> # Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
</span><span class="cx"> # Copyright (C) 2012 Daniel Bates (dbates@intudata.com)
</span><span class="lines">@@ -90,6 +90,7 @@
</span><span class="cx">         &amp;toWindowsLineEndings
</span><span class="cx">         &amp;gitCommitForSVNRevision
</span><span class="cx">         &amp;listOfChangedFilesBetweenRevisions
</span><ins>+        &amp;unixPath
</ins><span class="cx">     );
</span><span class="cx">     %EXPORT_TAGS = ( );
</span><span class="cx">     @EXPORT_OK   = ();
</span><span class="lines">@@ -126,7 +127,7 @@
</span><span class="cx"> sub exitStatus($)
</span><span class="cx"> {
</span><span class="cx">     my ($returnvalue) = @_;
</span><del>-    if ($^O eq &quot;MSWin32&quot;) {
</del><ins>+    if (isWindows()) {
</ins><span class="cx">         return $returnvalue &gt;&gt; 8;
</span><span class="cx">     }
</span><span class="cx">     if (!WIFEXITED($returnvalue)) {
</span><span class="lines">@@ -333,7 +334,7 @@
</span><span class="cx"> sub isSVNVersion16OrNewer()
</span><span class="cx"> {
</span><span class="cx">     my $version = svnVersion();
</span><del>-    return eval &quot;v$version&quot; ge v1.6;
</del><ins>+    return &quot;v$version&quot; ge v1.6;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> sub chdirReturningRelativePath($)
</span><span class="lines">@@ -481,6 +482,17 @@
</span><span class="cx"> sub normalizePath($)
</span><span class="cx"> {
</span><span class="cx">     my ($path) = @_;
</span><ins>+    if (isWindows()) {
+        $path =~ s/\//\\/g;
+    } else {
+        $path =~ s/\\/\//g;
+    }
+    return $path;
+}
+
+sub unixPath($)
+{
+    my ($path) = @_;
</ins><span class="cx">     $path =~ s/\\/\//g;
</span><span class="cx">     return $path;
</span><span class="cx"> }
</span><span class="lines">@@ -1923,7 +1935,10 @@
</span><span class="cx"> 
</span><span class="cx"> sub changeLogName()
</span><span class="cx"> {
</span><del>-    my $name = $ENV{CHANGE_LOG_NAME} || $ENV{REAL_NAME} || gitConfig(&quot;user.name&quot;) || (split /\s*,\s*/, (getpwuid $&lt;)[6])[0];
</del><ins>+    my $name = $ENV{CHANGE_LOG_NAME} || $ENV{REAL_NAME} || gitConfig(&quot;user.name&quot;);
+    if (not $name and !isWindows()) {
+        $name = (split /\s*,\s*/, (getpwuid $&lt;)[6])[0];
+    }
</ins><span class="cx"> 
</span><span class="cx">     changeLogNameError(&quot;Failed to determine ChangeLog name.&quot;) unless $name;
</span><span class="cx">     # getpwuid seems to always succeed on windows, returning the username instead of the full name.  This check will catch that case.
</span></span></pre></div>
<a id="trunkToolsScriptsprepareChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/prepare-ChangeLog (190327 => 190328)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/prepare-ChangeLog        2015-09-29 21:03:54 UTC (rev 190327)
+++ trunk/Tools/Scripts/prepare-ChangeLog        2015-09-29 21:16:41 UTC (rev 190328)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> 
</span><span class="cx"> #
</span><span class="cx"> #  Copyright (C) 2000, 2001 Eazel, Inc.
</span><del>-#  Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apple Inc.  All rights reserved.
</del><ins>+#  Copyright (C) 2002-2007, 2015 Apple Inc.  All rights reserved.
</ins><span class="cx"> #  Copyright (C) 2009 Torch Mobile, Inc.
</span><span class="cx"> #  Copyright (C) 2009 Cameron McCormack &lt;cam@mcc.id.au&gt;
</span><span class="cx"> #
</span><span class="lines">@@ -107,10 +107,12 @@
</span><span class="cx"> sub printDiff($$$$);
</span><span class="cx"> sub processPaths(\@);
</span><span class="cx"> sub propertyChangeDescription($);
</span><ins>+sub resolveChangeLogsPath($@);
</ins><span class="cx"> sub resolveConflictedChangeLogs($);
</span><span class="cx"> sub reviewerAndDescriptionForGitCommit($$);
</span><span class="cx"> sub statusCommand($$$$);
</span><span class="cx"> sub statusDescription($$$$);
</span><ins>+sub svnUpdateCommand(@);
</ins><span class="cx"> sub testListForChangeLog(@);
</span><span class="cx"> 
</span><span class="cx"> ### Constant variables.
</span><span class="lines">@@ -284,6 +286,7 @@
</span><span class="cx">         open DIFF, &quot;-|&quot;, diffCommand($changedFiles, $gitCommit, $gitIndex, $mergeBase) or die &quot;The diff failed: $!.\n&quot;;
</span><span class="cx">         while (&lt;DIFF&gt;) {
</span><span class="cx">             $file = makeFilePathRelative($1) if $_ =~ diffHeaderFormat();
</span><ins>+            $file = normalizePath($file);
</ins><span class="cx">             if (defined $file) {
</span><span class="cx">                 my ($before_start, $before_end) = extractLineRangeBeforeChange($_);
</span><span class="cx">                 if ($before_start &gt;= 1 &amp;&amp; $before_end &gt;= 1) {
</span><span class="lines">@@ -508,12 +511,34 @@
</span><span class="cx">     return \@changeLogs;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+sub svnUpdateCommand(@)
+{
+    my @changeLogs = shift;
+
+    my @escapedChangeLogPaths = map(escapeSubversionPath($_), @changeLogs);
+    my $escapedChangeLogPathsString = qq(&quot;) . join(qq(&quot; &quot;), @escapedChangeLogPaths) . qq(&quot;);
+    my $command = SVN . &quot; update $escapedChangeLogPathsString&quot;;
+
+    return $command;
+}
+
+sub resolveChangeLogsPath($@)
+{
+    my ($resolveChangeLogsPath, @conflictedChangeLogs) = @_;
+
+    my @escapedConflictedChangeLogs = map(escapeSubversionPath($_), @conflictedChangeLogs);
+    my $escapedConflictedChangeLogsString = qq(&quot;) . join(qq(&quot; &quot;), @escapedConflictedChangeLogs) . qq(&quot;);
+    my $command = &quot;$resolveChangeLogsPath --no-warnings $escapedConflictedChangeLogsString&quot;;
+
+    return $command;
+}
+
</ins><span class="cx"> sub resolveConflictedChangeLogs($)
</span><span class="cx"> {
</span><span class="cx">     my ($changeLogs) = @_;
</span><span class="cx"> 
</span><span class="cx">     print STDERR &quot;  Running 'svn update' to update ChangeLog files.\n&quot;;
</span><del>-    open ERRORS, &quot;-|&quot;, SVN, &quot;update&quot;, @$changeLogs
</del><ins>+    open ERRORS, &quot;-|&quot;, svnUpdateCommand(@$changeLogs)
</ins><span class="cx">         or die &quot;The svn update of ChangeLog files failed: $!.\n&quot;;
</span><span class="cx">     my @conflictedChangeLogs;
</span><span class="cx">     while (my $line = &lt;ERRORS&gt;) {
</span><span class="lines">@@ -526,7 +551,7 @@
</span><span class="cx"> 
</span><span class="cx">     print STDERR &quot;  Attempting to merge conflicted ChangeLogs.\n&quot;;
</span><span class="cx">     my $resolveChangeLogsPath = File::Spec-&gt;catfile(dirname($0), &quot;resolve-ChangeLogs&quot;);
</span><del>-    open RESOLVE, &quot;-|&quot;, $resolveChangeLogsPath, &quot;--no-warnings&quot;, @conflictedChangeLogs
</del><ins>+    open RESOLVE, &quot;-|&quot;, resolveChangeLogsPath($resolveChangeLogsPath, @conflictedChangeLogs)
</ins><span class="cx">         or die &quot;Could not open resolve-ChangeLogs script: $!.\n&quot;;
</span><span class="cx">     print STDERR &quot;    $_&quot; while &lt;RESOLVE&gt;;
</span><span class="cx">     close RESOLVE;
</span><span class="lines">@@ -585,6 +610,7 @@
</span><span class="cx"> 
</span><span class="cx">         foreach my $file (sort @{$filesInChangeLog-&gt;{$prefix}}) {
</span><span class="cx">             my $file_stem = substr $file, length $prefix;
</span><ins>+            $file_stem = unixPath($file_stem);
</ins><span class="cx">             print CHANGE_LOG normalizeLineEndings(&quot;        * $file_stem:$functionLists-&gt;{$file}\n&quot;, $endl);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -1886,7 +1912,7 @@
</span><span class="cx">     my $command;
</span><span class="cx">     if (isSVN()) {
</span><span class="cx">         my @escapedPaths = map(escapeSubversionPath($_), @$paths);
</span><del>-        my $escapedPathsString = &quot;'&quot; . join(&quot;' '&quot;, @escapedPaths) . &quot;'&quot;;
</del><ins>+        my $escapedPathsString = qq(&quot;) . join(qq(&quot; &quot;), @escapedPaths) . qq(&quot;);
</ins><span class="cx">         $command = SVN . &quot; diff --diff-cmd diff -x -u $escapedPathsString&quot;;
</span><span class="cx">     } elsif (isGit()) {
</span><span class="cx">         my $pathsString = &quot;'&quot; . join(&quot;' '&quot;, @$paths) . &quot;'&quot;; 
</span><span class="lines">@@ -1904,7 +1930,7 @@
</span><span class="cx">     my $command;
</span><span class="cx">     if (isSVN()) {
</span><span class="cx">         my @escapedFiles = map(escapeSubversionPath($_), keys %$paths);
</span><del>-        my $escapedFilesString = &quot;'&quot; . join(&quot;' '&quot;, @escapedFiles) . &quot;'&quot;;
</del><ins>+        my $escapedFilesString = qq(&quot;) . join(qq(&quot; &quot;), @escapedFiles) . qq(&quot;);
</ins><span class="cx">         $command = SVN . &quot; stat $escapedFilesString&quot;;
</span><span class="cx">     } elsif (isGit()) {
</span><span class="cx">         my $filesString = '&quot;' . join('&quot; &quot;', keys %$paths) . '&quot;';
</span></span></pre></div>
<a id="trunkToolsScriptswebkitdirspm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitdirs.pm (190327 => 190328)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitdirs.pm        2015-09-29 21:03:54 UTC (rev 190327)
+++ trunk/Tools/Scripts/webkitdirs.pm        2015-09-29 21:16:41 UTC (rev 190328)
</span><span class="lines">@@ -1384,7 +1384,7 @@
</span><span class="cx">     } elsif (isAppleMacWebKit()) {
</span><span class="cx">         return &quot;Safari&quot;;
</span><span class="cx">     } elsif (isAppleWinWebKit()) {
</span><del>-        return &quot;WinLauncher&quot;;
</del><ins>+        return &quot;MiniBrowser&quot;;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>