Title: [102988] trunk/Tools
Revision
102988
Author
[email protected]
Date
2011-12-15 15:13:40 -0800 (Thu, 15 Dec 2011)

Log Message

[Refactoring] In prepare-ChangeLog, make several global variables be used only through parameter passing
https://bugs.webkit.org/show_bug.cgi?id=74497

Reviewed by Ryosuke Niwa.

We are planning to write unit-tests for prepare-ChangeLog in a run-leaks_unittest
manner. This bug is one of the incremental refactorings to remove all top-level
code and global variables from prepare-ChangeLog. In this patch,
we make the following global variables be used only through parameter passing.
    - $bugDescription
    - $bugNumber
    - $name
    - $emailAddress
    - $gitReviewer
    - $writeChangeLogs

* Scripts/prepare-ChangeLog:
(fetchBugDescriptionFromURL):
(generateNewChangeLogs):
(reviewerAndDescriptionForGitCommit):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (102987 => 102988)


--- trunk/Tools/ChangeLog	2011-12-15 23:10:33 UTC (rev 102987)
+++ trunk/Tools/ChangeLog	2011-12-15 23:13:40 UTC (rev 102988)
@@ -1,3 +1,26 @@
+2011-12-15  Kentaro Hara  <[email protected]>
+
+        [Refactoring] In prepare-ChangeLog, make several global variables be used only through parameter passing
+        https://bugs.webkit.org/show_bug.cgi?id=74497
+
+        Reviewed by Ryosuke Niwa.
+
+        We are planning to write unit-tests for prepare-ChangeLog in a run-leaks_unittest
+        manner. This bug is one of the incremental refactorings to remove all top-level
+        code and global variables from prepare-ChangeLog. In this patch,
+        we make the following global variables be used only through parameter passing.
+            - $bugDescription
+            - $bugNumber
+            - $name
+            - $emailAddress
+            - $gitReviewer
+            - $writeChangeLogs
+
+        * Scripts/prepare-ChangeLog:
+        (fetchBugDescriptionFromURL):
+        (generateNewChangeLogs):
+        (reviewerAndDescriptionForGitCommit):
+
 2011-12-15  Raphael Kubo da Costa  <[email protected]>
 
         [EFL] Add a few more web database functions to ewk_settings.

Modified: trunk/Tools/Scripts/prepare-ChangeLog (102987 => 102988)


--- trunk/Tools/Scripts/prepare-ChangeLog	2011-12-15 23:10:33 UTC (rev 102987)
+++ trunk/Tools/Scripts/prepare-ChangeLog	2011-12-15 23:13:40 UTC (rev 102988)
@@ -67,11 +67,11 @@
 sub changeLogDate($);
 sub changeLogEmailAddressFromArgs($);
 sub changeLogNameFromArgs($);
-sub fetchBugDescriptionFromURL($);
+sub fetchBugDescriptionFromURL($$);
 sub findChangeLogs($);
 sub getLatestChangeLogs($);
 sub resolveConflictedChangeLogs($);
-sub generateNewChangeLogs($$$$$);
+sub generateNewChangeLogs($$$$$$$$$$);
 sub printDiff($);
 sub openChangeLogs($);
 sub diffFromToString();
@@ -100,7 +100,7 @@
 sub get_selector_line_ranges_for_css($$);
 sub method_decl_to_selector($);
 sub processPaths(\@);
-sub reviewerAndDescriptionForGitCommit($);
+sub reviewerAndDescriptionForGitCommit($$);
 sub normalizeLineEndings($$);
 sub decodeEntities($);
 
@@ -201,7 +201,7 @@
 }
 
 if ($bugNumber && !$bugDescription) {
-    $bugDescription = fetchBugDescriptionFromURL($bugURL);
+    $bugDescription = fetchBugDescriptionFromURL($bugURL, $bugNumber);
 }
 
 my ($filesInChangeLog, $prefixes) = findChangeLogs($functionLists);
@@ -213,7 +213,7 @@
     resolveConflictedChangeLogs($changeLogs);
 }
 
-generateNewChangeLogs($prefixes, $filesInChangeLog, $addedRegressionTests, $functionLists, $bugURL);
+generateNewChangeLogs($prefixes, $filesInChangeLog, $addedRegressionTests, $functionLists, $bugURL, $bugDescription, $name, $emailAddress, $gitReviewer, $writeChangeLogs);
 
 if ($writeChangeLogs) {
     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";
@@ -336,9 +336,9 @@
     return $emailAddressFromArgs || changeLogEmailAddress();
 }
 
-sub fetchBugDescriptionFromURL($)
+sub fetchBugDescriptionFromURL($$)
 {
-    my ($bugURL) = @_;
+    my ($bugURL, $bugNumber) = @_;
 
     my $bugXMLURL = "$bugURL&ctype=xml";
     # Perl has no built in XML processing, so we'll fetch and parse with curl and grep
@@ -452,9 +452,9 @@
     close RESOLVE;
 }
 
-sub generateNewChangeLogs($$$$$)
+sub generateNewChangeLogs($$$$$$$$$$)
 {
-    my ($prefixes, $filesInChangeLog, $addedRegressionTests, $functionLists, $bugURL) = @_;
+    my ($prefixes, $filesInChangeLog, $addedRegressionTests, $functionLists, $bugURL, $bugDescription, $name, $emailAddress, $gitReviewer, $writeChangeLogs) = @_;
 
     # Generate new ChangeLog entries and (optionally) write out new ChangeLog files.
     foreach my $prefix (@$prefixes) {
@@ -483,7 +483,7 @@
         my $date = changeLogDate($changeLogTimeZone);
         print CHANGE_LOG normalizeLineEndings("$date  $name  <$emailAddress>\n\n", $endl);
 
-        my ($reviewer, $description) = reviewerAndDescriptionForGitCommit($gitCommit) if $gitCommit;
+        my ($reviewer, $description) = reviewerAndDescriptionForGitCommit($gitCommit, $gitReviewer) if $gitCommit;
         $reviewer = "NOBODY (OO" . "PS!)" if !$reviewer;
 
         print CHANGE_LOG normalizeLineEndings($description . "\n", $endl) if $description;
@@ -1804,9 +1804,9 @@
     return $list;
 }
 
-sub reviewerAndDescriptionForGitCommit($)
+sub reviewerAndDescriptionForGitCommit($$)
 {
-    my ($commit) = @_;
+    my ($commit, $gitReviewer) = @_;
 
     my $description = '';
     my $reviewer;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to