Title: [292235] trunk/Tools
Revision
292235
Author
[email protected]
Date
2022-04-01 14:29:44 -0700 (Fri, 01 Apr 2022)

Log Message

[Merge-Queue] Canonicalize commit without rebase
https://bugs.webkit.org/show_bug.cgi?id=238614
<rdar://problem/91113465>

Reviewed by Aakash Jain.

This is helpful immiediatly after landing a subversion commit
and allows us to bypass the 60 second sleep in PushCommitToWebKitRepo.

* Tools/CISupport/ews-build/steps.py:
(Canonicalize.__init__): Allow caller to opt out of rebasing.
(Canonicalize.run): Ditto.
* Tools/CISupport/ews-build/steps_unittest.py:

Canonical link: https://commits.webkit.org/249136@main

Modified Paths

Diff

Modified: trunk/Tools/CISupport/ews-build/steps.py (292234 => 292235)


--- trunk/Tools/CISupport/ews-build/steps.py	2022-04-01 21:21:57 UTC (rev 292234)
+++ trunk/Tools/CISupport/ews-build/steps.py	2022-04-01 21:29:44 UTC (rev 292235)
@@ -4828,8 +4828,9 @@
     descriptionDone = ['Canonicalize Commit']
     haltOnFailure = True
 
-    def __init__(self, **kwargs):
+    def __init__(self, rebase_enabled=True, **kwargs):
         super(Canonicalize, self).__init__(logEnviron=False, timeout=300, **kwargs)
+        self.rebase_enabled = rebase_enabled
 
     def run(self):
         self.commands = []
@@ -4837,11 +4838,16 @@
         base_ref = self.getProperty('github.base.ref', DEFAULT_BRANCH)
         head_ref = self.getProperty('github.head.ref', DEFAULT_BRANCH)
 
-        for command in [
-            ['git', 'pull', 'origin', base_ref],
-            ['git', 'branch', '-f', base_ref, head_ref],
-            ['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
-        ]:
+        commands = []
+        if self.rebase_enabled:
+            commands = [
+                ['git', 'pull', 'origin', base_ref],
+                ['git', 'branch', '-f', base_ref, head_ref],
+                ['git', 'checkout', base_ref],
+            ]
+        commands.append(['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'])
+
+        for command in commands:
             self.commands.append(util.ShellArg(command=command, logname='stdio', haltOnFailure=True))
 
         return super(Canonicalize, self).run()

Modified: trunk/Tools/CISupport/ews-build/steps_unittest.py (292234 => 292235)


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-04-01 21:21:57 UTC (rev 292234)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-04-01 21:29:44 UTC (rev 292235)
@@ -6008,6 +6008,11 @@
                 workdir='wkdir',
                 timeout=300,
                 logEnviron=False,
+                command=['git', 'checkout', 'main'],
+            ) + 0, ExpectShell(
+                workdir='wkdir',
+                timeout=300,
+                logEnviron=False,
                 command=['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
             ) + 0,
         )
@@ -6014,6 +6019,23 @@
         self.expectOutcome(result=SUCCESS, state_string='Canonicalized commit')
         return self.runStep()
 
+    def test_success_no_rebase(self):
+        self.setupStep(Canonicalize(rebase_enabled=False))
+        self.setProperty('github.number', '1234')
+        self.setProperty('github.base.ref', 'main')
+        self.setProperty('github.head.ref', 'eng/pull-request-branch')
+
+        self.expectRemoteCommands(
+            ExpectShell(
+                workdir='wkdir',
+                timeout=300,
+                logEnviron=False,
+                command=['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
+            ) + 0,
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Canonicalized commit')
+        return self.runStep()
+
     def test_failure(self):
         self.setupStep(Canonicalize())
         self.setProperty('github.number', '1234')
@@ -6035,6 +6057,11 @@
                 workdir='wkdir',
                 timeout=300,
                 logEnviron=False,
+                command=['git', 'checkout', 'main'],
+            ) + 0, ExpectShell(
+                workdir='wkdir',
+                timeout=300,
+                logEnviron=False,
                 command=['python3', 'Tools/Scripts/git-webkit', 'canonicalize', '-n', '1'],
             ) + 1,
         )

Modified: trunk/Tools/ChangeLog (292234 => 292235)


--- trunk/Tools/ChangeLog	2022-04-01 21:21:57 UTC (rev 292234)
+++ trunk/Tools/ChangeLog	2022-04-01 21:29:44 UTC (rev 292235)
@@ -1,3 +1,19 @@
+2022-03-31  Jonathan Bedard  <[email protected]>
+
+        [Merge-Queue] Canonicalize commit without rebase
+        https://bugs.webkit.org/show_bug.cgi?id=238614
+        <rdar://problem/91113465>
+
+        Reviewed by Aakash Jain.
+
+        This is helpful immiediatly after landing a subversion commit
+        and allows us to bypass the 60 second sleep in PushCommitToWebKitRepo.
+
+        * CISupport/ews-build/steps.py:
+        (Canonicalize.__init__): Allow caller to opt out of rebasing.
+        (Canonicalize.run): Ditto.
+        * CISupport/ews-build/steps_unittest.py:
+
 2022-04-01  Tim Horton  <[email protected]>
 
         Add a debug overlay for interaction regions
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to