Title: [206918] trunk/Tools
Revision
206918
Author
[email protected]
Date
2016-10-07 10:04:27 -0700 (Fri, 07 Oct 2016)

Log Message

Replace bug URL placeholders independently of the short desc one
https://bugs.webkit.org/show_bug.cgi?id=161684

Patch by Emanuele Aina <[email protected]> on 2016-10-07
Reviewed by Darin Adler.

Instead of adding the bug URL when replacing the short description
placeholder and then ignoring the bug URL placeholder, use the former
to set the short description and the latter for the bug URL.
This means that developers can fully prepare the changelog with short
and long description before submission leaving the bug placeholder in
place, and the changelog machinery will make sure to replace the
latter with the URL of the newly created bug while submitting.

Note that this also means that the short description placeholder alone
no longer causes the bug URL to be added.

* Scripts/webkitpy/common/checkout/changelog.py:
(ChangeLog.set_short_description_and_bug_url):
* Scripts/webkitpy/common/checkout/changelog_unittest.py:
(test_set_short_description_and_bug_url):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (206917 => 206918)


--- trunk/Tools/ChangeLog	2016-10-07 16:55:11 UTC (rev 206917)
+++ trunk/Tools/ChangeLog	2016-10-07 17:04:27 UTC (rev 206918)
@@ -1,3 +1,26 @@
+2016-10-07  Emanuele Aina  <[email protected]>
+
+        Replace bug URL placeholders independently of the short desc one
+        https://bugs.webkit.org/show_bug.cgi?id=161684
+
+        Reviewed by Darin Adler.
+
+        Instead of adding the bug URL when replacing the short description
+        placeholder and then ignoring the bug URL placeholder, use the former
+        to set the short description and the latter for the bug URL.
+        This means that developers can fully prepare the changelog with short
+        and long description before submission leaving the bug placeholder in
+        place, and the changelog machinery will make sure to replace the
+        latter with the URL of the newly created bug while submitting.
+
+        Note that this also means that the short description placeholder alone
+        no longer causes the bug URL to be added.
+
+        * Scripts/webkitpy/common/checkout/changelog.py:
+        (ChangeLog.set_short_description_and_bug_url):
+        * Scripts/webkitpy/common/checkout/changelog_unittest.py:
+        (test_set_short_description_and_bug_url):
+
 2016-10-07  Jonathan Bedard  <[email protected]>
 
         Style Checking Error when Objective C Blocks passed as Argument

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


--- trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py	2016-10-07 16:55:11 UTC (rev 206917)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/changelog.py	2016-10-07 17:04:27 UTC (rev 206918)
@@ -430,14 +430,17 @@
             self._filesystem.write_text_file(self.path, newdata)
 
     def set_short_description_and_bug_url(self, 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
         result = StringIO()
         with self._filesystem.open_text_file_for_reading(self.path) as file:
+            short_description_placeholder = "Need a short description (OOPS!)."
+            bug_url_placeholder = "Need the bug URL (OOPS!)."
             for line in file:
-                line = line.replace("Need a short description (OOPS!).", message)
-                if line != bug_boilerplate:
-                    result.write(line)
+                stripped = line.strip()
+                if stripped == short_description_placeholder:
+                    line = self._changelog_indent + short_description + "\n"
+                if stripped == bug_url_placeholder:
+                    line = self._changelog_indent + bug_url + "\n"
+                result.write(line)
         self._filesystem.write_text_file(self.path, result.getvalue())
 
     def delete_entries(self, num_entries):

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


--- trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py	2016-10-07 16:55:11 UTC (rev 206917)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/changelog_unittest.py	2016-10-07 17:04:27 UTC (rev 206918)
@@ -642,8 +642,7 @@
         bug_url = "http://example.com/b/2344"
         ChangeLog(self._changelog_path, fs).set_short_description_and_bug_url(short_description, bug_url)
         actual_contents = fs.read_text_file(self._changelog_path)
-        expected_message = "%s\n        %s" % (short_description, bug_url)
-        expected_contents = changelog_contents.replace("Need a short description (OOPS!).", expected_message)
+        expected_contents = changelog_contents.replace("Need a short description (OOPS!).", short_description)
         self.assertEqual(actual_contents.splitlines(), expected_contents.splitlines())
 
         changelog_contents = u"%s\n%s" % (self._new_entry_boilerplate, self._example_changelog)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to