Title: [122192] trunk/Tools
Revision
122192
Author
[email protected]
Date
2012-07-09 21:35:05 -0700 (Mon, 09 Jul 2012)

Log Message

Improve the boilerplate generated by prepare-ChangeLog
https://bugs.webkit.org/show_bug.cgi?id=89560

Reviewed by Ryosuke Niwa.

Produce the following boilerplate:

> 2012-06-20  Kent Tamura  <[email protected]>
>
>         Need a short description (Oops!).
>         Need the bug URL (Oops!).
>
>         Reviewed by NOBODY (Oops!).
>
>         Additional information of the change such as approach, rationale. Please add per-function descriptions below. (Oops!).
>
>         No new tests (Oops!).

* Scripts/prepare-ChangeLog:
(generateNewChangeLogs): Generate the updated template.
* Scripts/webkitpy/common/checkout/changelog.py:
(ChangeLog.update_with_unreviewed_message):
Update the pattern for the beginning of the boilerplate.
(ChangeLog.set_short_description_and_bug_url):
- Use self._changelog_indent
- Update the pattern for the description line
- Skip the bug boilerplate.
We substitute the specified bug URL to the description boilerplate
because we need to add it even if the bug URL boilerplate is missing.
* Scripts/webkitpy/common/checkout/changelog_unittest.py: Update the boilerplate data.
(test_set_short_description_and_bug_url):
- Update the description boilerplate.
- Add a test for a case with both of the description boilerplace and the
  bug URL boilerplate.
* Scripts/webkitpy/tool/steps/preparechangelog_unittest.py:
(PrepareChangeLogTest.test_ensure_bug_url): Update the expected boilerplate.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (122191 => 122192)


--- trunk/Tools/ChangeLog	2012-07-10 04:34:13 UTC (rev 122191)
+++ trunk/Tools/ChangeLog	2012-07-10 04:35:05 UTC (rev 122192)
@@ -1,3 +1,42 @@
+2012-07-09  Kent Tamura  <[email protected]>
+
+        Improve the boilerplate generated by prepare-ChangeLog
+        https://bugs.webkit.org/show_bug.cgi?id=89560
+
+        Reviewed by Ryosuke Niwa.
+
+        Produce the following boilerplate:
+
+        > 2012-06-20  Kent Tamura  <[email protected]>
+        >
+        >         Need a short description (Oops!).
+        >         Need the bug URL (Oops!).
+        >
+        >         Reviewed by NOBODY (Oops!).
+        >
+        >         Additional information of the change such as approach, rationale. Please add per-function descriptions below. (Oops!).
+        >
+        >         No new tests (Oops!).
+
+        * Scripts/prepare-ChangeLog:
+        (generateNewChangeLogs): Generate the updated template.
+        * Scripts/webkitpy/common/checkout/changelog.py:
+        (ChangeLog.update_with_unreviewed_message):
+        Update the pattern for the beginning of the boilerplate.
+        (ChangeLog.set_short_description_and_bug_url):
+        - Use self._changelog_indent
+        - Update the pattern for the description line
+        - Skip the bug boilerplate.
+        We substitute the specified bug URL to the description boilerplate
+        because we need to add it even if the bug URL boilerplate is missing.
+        * Scripts/webkitpy/common/checkout/changelog_unittest.py: Update the boilerplate data.
+        (test_set_short_description_and_bug_url):
+        - Update the description boilerplate.
+        - Add a test for a case with both of the description boilerplace and the
+          bug URL boilerplate.
+        * Scripts/webkitpy/tool/steps/preparechangelog_unittest.py:
+        (PrepareChangeLogTest.test_ensure_bug_url): Update the expected boilerplate.
+
 2012-07-09  No'am Rosenthal  <[email protected]>
 
         Shared code that is guarded with ENABLE(WEBGL) should be guarded with USE()

Modified: trunk/Tools/Scripts/prepare-ChangeLog (122191 => 122192)


--- trunk/Tools/Scripts/prepare-ChangeLog	2012-07-10 04:34:13 UTC (rev 122191)
+++ trunk/Tools/Scripts/prepare-ChangeLog	2012-07-10 04:35:05 UTC (rev 122192)
@@ -493,18 +493,19 @@
 
         print CHANGE_LOG normalizeLineEndings($description . "\n", $endl) if $description;
 
-        $bugDescription = "Need a short description and bug URL (OOPS!)" unless $bugDescription;
+        $bugDescription = "Need a short description (OOPS!).\n        Need the bug URL (OOPS!)." unless $bugDescription;
         print CHANGE_LOG normalizeLineEndings("        $bugDescription\n", $endl) if $bugDescription;
         print CHANGE_LOG normalizeLineEndings("        $bugURL\n", $endl) if $bugURL;
         print CHANGE_LOG normalizeLineEndings("\n", $endl);
 
         print CHANGE_LOG normalizeLineEndings("        Reviewed by $reviewer.\n\n", $endl);
+        print CHANGE_LOG normalizeLineEndings("        Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).\n\n", $endl);
 
         if ($prefix =~ m/WebCore/ || `pwd` =~ m/WebCore/) {
             if (@$addedRegressionTests) {
                 print CHANGE_LOG normalizeLineEndings(testListForChangeLog(sort @$addedRegressionTests), $endl);
             } else {
-                print CHANGE_LOG normalizeLineEndings("        No new tests. (OOPS!)\n\n", $endl);
+                print CHANGE_LOG normalizeLineEndings("        No new tests (OOPS!).\n\n", $endl);
             }
         }
 

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py (122191 => 122192)


--- trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py	2012-07-10 04:34:13 UTC (rev 122191)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py	2012-07-10 04:35:05 UTC (rev 122192)
@@ -327,7 +327,7 @@
 
     def update_with_unreviewed_message(self, message):
         first_boilerplate_line_regexp = re.compile(
-                "%sNeed a short description and bug URL \(OOPS!\)" % self._changelog_indent)
+                "%sNeed a short description \(OOPS!\)\." % self._changelog_indent)
         removing_boilerplate = False
         # inplace=1 creates a backup file and re-directs stdout to the file
         for line in fileinput.FileInput(self.path, inplace=1):
@@ -369,6 +369,9 @@
                 print line.replace("NOBODY (OOPS!)", reviewer.encode("utf-8")),
 
     def set_short_description_and_bug_url(self, short_description, bug_url):
-        message = "%s\n        %s" % (short_description, bug_url)
+        message = "%s\n%s%s" % (short_description, self._changelog_indent, bug_url)
+        bug_boilerplate = "%sNeed the bug URL (OOPS!).\n" % self._changelog_indent
         for line in fileinput.FileInput(self.path, inplace=1):
-            print line.replace("Need a short description and bug URL (OOPS!)", message.encode("utf-8")),
+            line = line.replace("Need a short description (OOPS!).", message.encode("utf-8"))
+            if line != bug_boilerplate:
+                print line,

Modified: trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py (122191 => 122192)


--- trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py	2012-07-10 04:34:13 UTC (rev 122191)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py	2012-07-10 04:35:05 UTC (rev 122192)
@@ -489,7 +489,8 @@
     # FIXME: We really should be getting this from prepare-ChangeLog itself.
     _new_entry_boilerplate = '''2009-08-19  Eric Seidel  <[email protected]>
 
-        Need a short description and bug URL (OOPS!)
+        Need a short description (OOPS!).
+        Need the bug URL (OOPS!).
 
         Reviewed by NOBODY (OOPS!).
 
@@ -498,7 +499,7 @@
 
     _new_entry_boilerplate_with_bugurl = '''2009-08-19  Eric Seidel  <[email protected]>
 
-        Need a short description and bug URL (OOPS!)
+        Need a short description (OOPS!).
         https://bugs.webkit.org/show_bug.cgi?id=12345
 
         Reviewed by NOBODY (OOPS!).
@@ -508,7 +509,7 @@
 
     _new_entry_boilerplate_with_multiple_bugurl = '''2009-08-19  Eric Seidel  <[email protected]>
 
-        Need a short description and bug URL (OOPS!)
+        Need a short description (OOPS!).
         https://bugs.webkit.org/show_bug.cgi?id=12345
         http://webkit.org/b/12345
 
@@ -519,7 +520,7 @@
 
     _new_entry_boilerplate_without_reviewer_line = '''2009-08-19  Eric Seidel  <[email protected]>
 
-        Need a short description and bug URL (OOPS!)
+        Need a short description (OOPS!).
         https://bugs.webkit.org/show_bug.cgi?id=12345
 
         * Scripts/bugzilla-tool:
@@ -527,7 +528,7 @@
 
     _new_entry_boilerplate_without_reviewer_multiple_bugurl = '''2009-08-19  Eric Seidel  <[email protected]>
 
-        Need a short description and bug URL (OOPS!)
+        Need a short description (OOPS!).
         https://bugs.webkit.org/show_bug.cgi?id=12345
         http://webkit.org/b/12345
 
@@ -568,6 +569,17 @@
         ChangeLog(changelog_path).set_short_description_and_bug_url(short_description, bug_url)
         actual_contents = self._read_file_contents(changelog_path, "utf-8")
         expected_message = "%s\n        %s" % (short_description, bug_url)
-        expected_contents = changelog_contents.replace("Need a short description and bug URL (OOPS!)", expected_message)
+        expected_contents = changelog_contents.replace("Need a short description (OOPS!).", expected_message)
         os.remove(changelog_path)
         self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines())
+
+        changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
+        changelog_path = self._write_tmp_file_with_contents(changelog_contents.encode("utf-8"))
+        short_description = "A short description 2"
+        bug_url = "http://example.com/b/2345"
+        ChangeLog(changelog_path).set_short_description_and_bug_url(short_description, bug_url)
+        actual_contents = self._read_file_contents(changelog_path, "utf-8")
+        expected_message = "%s\n        %s" % (short_description, bug_url)
+        expected_contents = changelog_contents.replace("Need a short description (OOPS!).\n        Need the bug URL (OOPS!).", expected_message)
+        os.remove(changelog_path)
+        self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines())

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py (122191 => 122192)


--- trunk/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py	2012-07-10 04:34:13 UTC (rev 122191)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/preparechangelog_unittest.py	2012-07-10 04:35:05 UTC (rev 122192)
@@ -52,6 +52,6 @@
         capture.assert_outputs(self, step.run, [state])
         actual_contents = self._read_file_contents(changelog_path, "utf-8")
         expected_message = "Example title\n        http://example.com/1234"
-        expected_contents = changelog_contents.replace("Need a short description and bug URL (OOPS!)", expected_message)
+        expected_contents = changelog_contents.replace("Need a short description (OOPS!).\n        Need the bug URL (OOPS!).", expected_message)
         os.remove(changelog_path)
         self.assertEquals(actual_contents.splitlines(), expected_contents.splitlines())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to