Title: [284783] trunk/Tools
Revision
284783
Author
[email protected]
Date
2021-10-25 07:36:41 -0700 (Mon, 25 Oct 2021)

Log Message

Add support for fast-cq mode to webkit-patch land-safely command
https://bugs.webkit.org/show_bug.cgi?id=232196

Reviewed by Jonathan Bedard.

* Scripts/webkitpy/tool/steps/postdiffforcommit.py:
(PostDiffForCommit):
(PostDiffForCommit.run):
* Scripts/webkitpy/tool/commands/upload_unittest.py: Added unit-test.
(test_land_safely_with_fast_cq):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (284782 => 284783)


--- trunk/Tools/ChangeLog	2021-10-25 14:35:58 UTC (rev 284782)
+++ trunk/Tools/ChangeLog	2021-10-25 14:36:41 UTC (rev 284783)
@@ -1,3 +1,16 @@
+2021-10-25  Aakash Jain  <[email protected]>
+
+        Add support for fast-cq mode to webkit-patch land-safely command
+        https://bugs.webkit.org/show_bug.cgi?id=232196
+
+        Reviewed by Jonathan Bedard.
+
+        * Scripts/webkitpy/tool/steps/postdiffforcommit.py:
+        (PostDiffForCommit):
+        (PostDiffForCommit.run):
+        * Scripts/webkitpy/tool/commands/upload_unittest.py: Added unit-test.
+        (test_land_safely_with_fast_cq):
+
 2021-10-25  Sam Sneddon  <[email protected]>
 
         [Python] rename assertEquals/assertNotEquals

Modified: trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py (284782 => 284783)


--- trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py	2021-10-25 14:35:58 UTC (rev 284782)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/upload_unittest.py	2021-10-25 14:36:41 UTC (rev 284783)
@@ -58,12 +58,23 @@
         self.assert_execute_outputs(Post(), [50000], options=options, expected_logs=expected_logs)
 
     def test_land_safely(self):
+        options = MockOptions()
+        options.fast_cq = False
         expected_logs = """Obsoleting 2 old patches on bug 50000
 MOCK reassign_bug: bug_id=50000, assignee=None
 MOCK add_patch_to_bug: bug_id=50000, description=Patch for landing, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=True
 """
-        self.assert_execute_outputs(LandSafely(), [50000], expected_logs=expected_logs)
+        self.assert_execute_outputs(LandSafely(), [50000], options=options, expected_logs=expected_logs)
 
+    def test_land_safely_with_fast_cq(self):
+        options = MockOptions()
+        options.fast_cq = True
+        expected_logs = """Obsoleting 2 old patches on bug 50000
+MOCK reassign_bug: bug_id=50000, assignee=None
+MOCK add_patch_to_bug: bug_id=50000, description=[fast-cq] Patch for landing, mark_for_review=False, mark_for_commit_queue=False, mark_for_landing=True
+"""
+        self.assert_execute_outputs(LandSafely(), [50000], options=options, expected_logs=expected_logs)
+
     def test_prepare_diff_with_arg(self):
         options = MockOptions()
         options.sort_xcode_project = False

Modified: trunk/Tools/Scripts/webkitpy/tool/steps/postdiffforcommit.py (284782 => 284783)


--- trunk/Tools/Scripts/webkitpy/tool/steps/postdiffforcommit.py	2021-10-25 14:35:58 UTC (rev 284782)
+++ trunk/Tools/Scripts/webkitpy/tool/steps/postdiffforcommit.py	2021-10-25 14:36:41 UTC (rev 284783)
@@ -1,4 +1,5 @@
 # Copyright (C) 2010 Google Inc. All rights reserved.
+# Copyright (C) 2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -26,14 +27,26 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from webkitpy.common.net.bugzilla import Attachment
 from webkitpy.tool.steps.abstractstep import AbstractStep
+from webkitpy.tool.steps.options import Options
 
 
 class PostDiffForCommit(AbstractStep):
+    @classmethod
+    def options(cls):
+        return AbstractStep.options() + [
+            Options.fast_cq,
+        ]
+
     def run(self, state):
+        description = 'Patch for landing'
+        if self._options.fast_cq:
+            description = '{}{}'.format(Attachment.fast_cq_preamble, description)
+
         self._tool.bugs.add_patch_to_bug(
-            state["bug_id"],
-            self.cached_lookup(state, "diff"),
-            "Patch for landing",
+            state['bug_id'],
+            self.cached_lookup(state, 'diff'),
+            description,
             mark_for_review=False,
             mark_for_landing=True)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to