Support a suffix on ChangeLog filenames based on a configuration file
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 23:29:16 +0000 (23:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jan 2012 23:29:16 +0000 (23:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=76956

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-01-26
Reviewed by Kentaro Hara.

Modify the tools used to generate, edit and resolve ChangeLogs to support
the addition of a suffix to the ChangeLog filename.

This patch makes it easier to support alternate ChangeLog files in branches.

* Scripts/VCSUtils.pm:
(changeLogSuffix):
(changeLogFileName):
* Scripts/commit-log-editor:
* Scripts/prepare-ChangeLog:
(getLatestChangeLogs):
(generateNewChangeLogs):
(generateFileList):
* Scripts/resolve-ChangeLogs:
(findChangeLog):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106054 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/VCSUtils.pm
Tools/Scripts/commit-log-editor
Tools/Scripts/prepare-ChangeLog
Tools/Scripts/resolve-ChangeLogs

index 19e138e..2486f1e 100644 (file)
@@ -1,3 +1,26 @@
+2012-01-26  Benjamin Poulain  <bpoulain@apple.com>
+
+        Support a suffix on ChangeLog filenames based on a configuration file
+        https://bugs.webkit.org/show_bug.cgi?id=76956
+
+        Reviewed by Kentaro Hara.
+
+        Modify the tools used to generate, edit and resolve ChangeLogs to support
+        the addition of a suffix to the ChangeLog filename.
+
+        This patch makes it easier to support alternate ChangeLog files in branches.
+
+        * Scripts/VCSUtils.pm:
+        (changeLogSuffix):
+        (changeLogFileName):
+        * Scripts/commit-log-editor:
+        * Scripts/prepare-ChangeLog:
+        (getLatestChangeLogs):
+        (generateNewChangeLogs):
+        (generateFileList):
+        * Scripts/resolve-ChangeLogs:
+        (findChangeLog):
+
 2012-01-26  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r106038.
index b7176bd..e6858d9 100644 (file)
@@ -49,6 +49,7 @@ BEGIN {
         &callSilently
         &canonicalizePath
         &changeLogEmailAddress
+        &changeLogFileName
         &changeLogName
         &chdirReturningRelativePath
         &decodeGitBinaryChunk
@@ -1759,6 +1760,23 @@ sub gitConfig($)
     return $result;
 }
 
+sub changeLogSuffix()
+{
+    my $rootPath = determineVCSRoot();
+    my $changeLogSuffixFile = File::Spec->catfile($rootPath, ".changeLogSuffix");
+    return "" if ! -e $changeLogSuffixFile;
+    open FILE, $changeLogSuffixFile or die "Could not open $changeLogSuffixFile: $!";
+    my $changeLogSuffix = <FILE>;
+    chomp $changeLogSuffix;
+    close FILE;
+    return $changeLogSuffix;
+}
+
+sub changeLogFileName()
+{
+    return "ChangeLog" . changeLogSuffix()
+}
+
 sub changeLogNameError($)
 {
     my ($message) = @_;
index a7dd239..a66139e 100755 (executable)
@@ -148,8 +148,8 @@ while (<LOG>) {
         # (without the log comment info). We don't need it.
     }
     $existingLog = isGit() && !(/^#/ || /^\s*$/) unless $existingLog;
-
-    push @changeLogs, makeFilePathRelative($1) if $inChangesToBeCommitted && (/^(?:M|A)....(.*ChangeLog)\r?\n?$/ || /^#\t(?:modified|new file):   (.*ChangeLog)$/) && !/-ChangeLog$/;
+    my $changeLogFileName = changeLogFileName();
+    push @changeLogs, makeFilePathRelative($1) if $inChangesToBeCommitted && (/^(?:M|A)....(.*$changeLogFileName)\r?\n?$/ || /^#\t(?:modified|new file):   (.*$changeLogFileName)$/) && !/-$changeLogFileName$/;
 }
 close LOG;
 
index dc8981e..6f30b2e 100755 (executable)
@@ -420,7 +420,7 @@ sub getLatestChangeLogs($)
 
     my @changeLogs = ();
     foreach my $prefix (@$prefixes) {
-        push @changeLogs, File::Spec->catfile($prefix || ".", "ChangeLog");
+        push @changeLogs, File::Spec->catfile($prefix || ".", changeLogFileName());
     }
     return \@changeLogs;
 }
@@ -459,7 +459,7 @@ sub generateNewChangeLogs($$$$$$$$$$$)
         my @old_change_log;
 
         if ($writeChangeLogs) {
-            my $changeLogPath = File::Spec->catfile($prefix || ".", "ChangeLog");
+            my $changeLogPath = File::Spec->catfile($prefix || ".", changeLogFileName());
             print STDERR "  Editing the ${changeLogPath} file.\n";
             open OLD_CHANGE_LOG, ${changeLogPath} or die "Could not open ${changeLogPath} file: $!.\n";
             # It's less efficient to read the whole thing into memory than it would be
@@ -1728,11 +1728,11 @@ sub generateFileList(\%$$$)
                        && !scalar(grep(/^resources$/i, @components))
                        && !scalar(grep(/^script-tests$/i, @components));
             }
-            push @changedFiles, $file if $components[$#components] ne "ChangeLog";
+            push @changedFiles, $file if $components[$#components] ne changeLogFileName();
         } elsif (isConflictStatus($status, $gitCommit, $gitIndex) || isConflictStatus($propertyStatus, $gitCommit, $gitIndex)) {
             push @conflictFiles, $file;
         }
-        if (basename($file) ne "ChangeLog") {
+        if (basename($file) ne changeLogFileName()) {
             my $description = statusDescription($status, $propertyStatus, $original, $propertyChanges);
             $functionLists{$file} = $description if defined $description;
         }
index 44999a5..2206828 100755 (executable)
@@ -248,9 +248,10 @@ sub conflictFiles($)
 
 sub findChangeLog($)
 {
-    return $_[0] if basename($_[0]) eq "ChangeLog";
+    my $changeLogFileName = changeLogFileName();
+    return $_[0] if basename($_[0]) eq $changeLogFileName;
 
-    my $file = File::Spec->catfile($_[0], "ChangeLog");
+    my $file = File::Spec->catfile($_[0], $changeLogFileName);
     return $file if -d $_[0] and -e $file;
 
     return undef;