Modified: trunk/Tools/Scripts/prepare-ChangeLog (103398 => 103399)
--- trunk/Tools/Scripts/prepare-ChangeLog 2011-12-21 08:33:43 UTC (rev 103398)
+++ trunk/Tools/Scripts/prepare-ChangeLog 2011-12-21 08:54:22 UTC (rev 103399)
@@ -107,13 +107,11 @@
### Constant variables.
# Project time zone for Cupertino, CA, US
-my $changeLogTimeZone = "PST8PDT";
+use constant ChangeLogTimeZone => "PST8PDT";
+use constant SVN => "svn";
+use constant GIT => "git";
+use constant SupportedTestExtensions => {map { $_ => 1 } qw(html shtml svg xml xhtml pl php)};
-my $SVN = "svn";
-my $GIT = "git";
-
-my %supportedTestExtensions = map { $_ => 1 } qw(html shtml svg xml xhtml pl php);
-
exit(main());
sub main()
@@ -319,7 +317,8 @@
{
my ($nameFromArgs, $gitCommit) = @_;
# Silently allow --git-commit to win, we could warn if $nameFromArgs is defined.
- return `$GIT log --max-count=1 --pretty=\"format:%an\" \"$gitCommit\"` if $gitCommit;
+ my $command = GIT . ' log --max-count=1 --pretty="format:%an" "' . $gitCommit . '"';
+ return `$command` if $gitCommit;
return $nameFromArgs || changeLogName();
}
@@ -328,7 +327,8 @@
{
my ($emailAddressFromArgs, $gitCommit) = @_;
# Silently allow --git-commit to win, we could warn if $emailAddressFromArgs is defined.
- return `$GIT log --max-count=1 --pretty=\"format:%ae\" \"$gitCommit\"` if $gitCommit;
+ my $command = GIT . ' log --max-count=1 --pretty="format:%ae" "' . $gitCommit . '"';
+ return `$command` if $gitCommit;
return $emailAddressFromArgs || changeLogEmailAddress();
}
@@ -430,7 +430,7 @@
my ($changeLogs) = @_;
print STDERR " Running 'svn update' to update ChangeLog files.\n";
- open ERRORS, "-|", $SVN, "update", @$changeLogs
+ open ERRORS, "-|", SVN, "update", @$changeLogs
or die "The svn update of ChangeLog files failed: $!.\n";
my @conflictedChangeLogs;
while (my $line = <ERRORS>) {
@@ -477,7 +477,7 @@
print substr($prefix, 0, length($prefix) - 1) . ":\n\n" unless (scalar @$prefixes) == 1;
}
- my $date = changeLogDate($changeLogTimeZone);
+ my $date = changeLogDate(ChangeLogTimeZone);
print CHANGE_LOG normalizeLineEndings("$date $name <$emailAddress>\n\n", $endl);
my ($reviewer, $description) = reviewerAndDescriptionForGitCommit($gitCommit, $gitReviewer) if $gitCommit;
@@ -1450,10 +1450,10 @@
if (isSVN()) {
my @escapedPaths = map(escapeSubversionPath($_), @$paths);
my $escapedPathsString = "'" . join("' '", @escapedPaths) . "'";
- $command = "$SVN diff --diff-cmd diff -x -N $escapedPathsString";
+ $command = SVN . " diff --diff-cmd diff -x -N $escapedPathsString";
} elsif (isGit()) {
my $pathsString = "'" . join("' '", @$paths) . "'";
- $command = "$GIT diff --no-ext-diff -U0 " . diffFromToString($gitCommit, $gitIndex, $mergeBase);
+ $command = GIT . " diff --no-ext-diff -U0 " . diffFromToString($gitCommit, $gitIndex, $mergeBase);
$command .= " -- $pathsString" unless $gitCommit or $mergeBase;
}
@@ -1468,10 +1468,10 @@
if (isSVN()) {
my @escapedFiles = map(escapeSubversionPath($_), keys %$paths);
my $escapedFilesString = "'" . join("' '", @escapedFiles) . "'";
- $command = "$SVN stat $escapedFilesString";
+ $command = SVN . " stat $escapedFilesString";
} elsif (isGit()) {
my $filesString = '"' . join('" "', keys %$paths) . '"';
- $command = "$GIT diff -r --name-status -M -C " . diffFromToString($gitCommit, $gitIndex, $mergeBase);
+ $command = GIT . " diff -r --name-status -M -C " . diffFromToString($gitCommit, $gitIndex, $mergeBase);
$command .= " -- $filesString" unless $gitCommit;
}
@@ -1486,7 +1486,7 @@
if (isSVN()) {
$command = "'$FindBin::Bin/svn-create-patch' $changedFilesString";
} elsif (isGit()) {
- $command = "$GIT diff -M -C " . diffFromToString($gitCommit, $gitIndex, $mergeBase);
+ $command = GIT . " diff -M -C " . diffFromToString($gitCommit, $gitIndex, $mergeBase);
$command .= " -- $changedFilesString" unless $gitCommit;
}
@@ -1503,7 +1503,7 @@
{
my ($file) = @_;
my $baseUrl;
- open INFO, "$SVN info . |" or die;
+ open INFO, SVN . " info . |" or die;
while (<INFO>) {
if (/^URL: (.+?)[\r\n]*$/) {
$baseUrl = $1;
@@ -1512,7 +1512,7 @@
close INFO;
my $sourceFile;
my $escapedFile = escapeSubversionPath($file);
- open INFO, "$SVN info '$escapedFile' |" or die;
+ open INFO, SVN . " info '$escapedFile' |" or die;
while (<INFO>) {
if (/^Copied From URL: (.+?)[\r\n]*$/) {
$sourceFile = File::Spec->abs2rel($1, $baseUrl);
@@ -1531,14 +1531,14 @@
if ($isAdd) {
my %addedProperties;
my %removedProperties;
- open PROPLIST, "$SVN proplist '$escapedFile' |" or die;
+ open PROPLIST, SVN . " proplist '$escapedFile' |" or die;
while (<PROPLIST>) {
$addedProperties{$1} = 1 if /^ (.+?)[\r\n]*$/ && $1 ne 'svn:mergeinfo';
}
close PROPLIST;
if ($original) {
my $escapedOriginal = escapeSubversionPath($original);
- open PROPLIST, "$SVN proplist '$escapedOriginal' |" or die;
+ open PROPLIST, SVN . " proplist '$escapedOriginal' |" or die;
while (<PROPLIST>) {
next unless /^ (.+?)[\r\n]*$/;
my $property = $1;
@@ -1552,7 +1552,7 @@
$changes{"A"} = [sort keys %addedProperties] if %addedProperties;
$changes{"D"} = [sort keys %removedProperties] if %removedProperties;
} else {
- open DIFF, "$SVN diff '$escapedFile' |" or die;
+ open DIFF, SVN . " diff '$escapedFile' |" or die;
while (<DIFF>) {
if (/^Property changes on:/) {
while (<DIFF>) {
@@ -1657,7 +1657,7 @@
push @addedRegressionTests, $file
if isAddedStatus($status)
&& $file =~ /\.([a-zA-Z]+)$/
- && $supportedTestExtensions{lc($1)}
+ && SupportedTestExtensions->{lc($1)}
&& !scalar(grep(/^resources$/i, @components))
&& !scalar(grep(/^script-tests$/i, @components));
}
@@ -1822,9 +1822,9 @@
my $gitLog;
{
local $/ = undef;
- open(GIT, "-|", $GIT, @args, $commit) || die;
- $gitLog = <GIT>;
- close(GIT);
+ open(GITLOG, "-|", GIT, @args, $commit) || die;
+ $gitLog = <GITLOG>;
+ close(GITLOG);
}
my @commitLogs = split(/^[Cc]ommit [a-f0-9]{40}/m, $gitLog);