Title: [289428] trunk/Tools
Revision
289428
Author
[email protected]
Date
2022-02-08 14:21:59 -0800 (Tue, 08 Feb 2022)

Log Message

[EWS] Embed added/modified/deleted status into changed files
https://bugs.webkit.org/show_bug.cgi?id=236051

Reviewed by Aakash Jain.

GitHub's API includes whether a file was added, modified or deleted.
We don't include this information in source changes, we should.

* Tools/CISupport/ews-build/events.py:
(GitHubEventHandlerNoEdits.file_with_mod_sign): Added.
(GitHubEventHandlerNoEdits._get_pr_files): Copied from buildbot, modified to include
file modification status.
* Tools/CISupport/ews-build/steps.py:
(FindModifiedLayoutTests): Remove FIXME

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

Modified Paths

Diff

Modified: trunk/Tools/CISupport/ews-build/events.py (289427 => 289428)


--- trunk/Tools/CISupport/ews-build/events.py	2022-02-08 22:14:18 UTC (rev 289427)
+++ trunk/Tools/CISupport/ews-build/events.py	2022-02-08 22:21:59 UTC (rev 289428)
@@ -29,7 +29,7 @@
 
 from base64 import b64encode
 from buildbot.process.results import SUCCESS, FAILURE, CANCELLED, WARNINGS, SKIPPED, EXCEPTION, RETRY
-from buildbot.util import service
+from buildbot.util import httpclientservice, service
 from buildbot.www.hooks.github import GitHubEventHandler
 from steps import GitHub
 from twisted.internet import defer
@@ -314,9 +314,38 @@
     ACTIONS_TO_TRIGGER_EWS = ('opened', 'synchronize')
     OPEN_STATES = ('open',)
 
+    @classmethod
+    def file_with_status_sign(cls, info):
+        if info.get('status') in ('removed', 'renamed'):
+            return '--- {}'.format(info['filename'])
+        return '+++ {}'.format(info['filename'])
+
     def _get_commit_msg(self, repo, sha):
         return ''
 
+    @defer.inlineCallbacks
+    def _get_pr_files(self, repo, number):
+        # Copied from https://github.com/buildbot/buildbot/blob/v2.10.5/master/buildbot/www/hooks/github.py to include added/modified/deleted
+        headers = {"User-Agent": "Buildbot"}
+        if self._token:
+            headers["Authorization"] = "token " + self._token
+
+        url = "" number)
+        http = yield httpclientservice.HTTPClientService.getService(
+            self.master,
+            self.github_api_endpoint,
+            headers=headers,
+            debug=self.debug,
+            verify=self.verify,
+        )
+        res = yield http.get(url)
+        if 200 <= res.code < 300:
+            data = "" res.json()
+            return [self.file_with_status_sign(f) for f in data]
+
+        log.msg('Failed fetching PR files: response code {}'.format(res.code))
+        return []
+
     def handle_pull_request(self, payload, event):
         pr_number = payload['number']
         action = ""

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


--- trunk/Tools/CISupport/ews-build/steps.py	2022-02-08 22:14:18 UTC (rev 289427)
+++ trunk/Tools/CISupport/ews-build/steps.py	2022-02-08 22:21:59 UTC (rev 289428)
@@ -786,7 +786,6 @@
 
 class FindModifiedLayoutTests(AnalyzeChange):
     name = 'find-modified-layout-tests'
-    # FIXME: This regex won't work for pull-requests
     RE_LAYOUT_TEST = br'^(\+\+\+).*(LayoutTests.*\.html)'
     DIRECTORIES_TO_IGNORE = ['reference', 'reftest', 'resources', 'support', 'script-tests', 'tools']
     SUFFIXES_TO_IGNORE = ['-expected', '-expected-mismatch', '-ref', '-notref']
@@ -2533,12 +2532,6 @@
         shell.Test.__init__(self, logEnviron=False, **kwargs)
         self.incorrectLayoutLines = []
 
-    def _get_patch(self):
-        sourcestamp = self.build.getSourceStamp(self.getProperty('codebase', ''))
-        if not sourcestamp or not sourcestamp.patch:
-            return None
-        return sourcestamp.patch[1]
-
     def doStepIf(self, step):
         return not ((self.getProperty('buildername', '').lower() == 'commit-queue') and
                     (self.getProperty('fast_commit_queue') or self.getProperty('passed_mac_wk2')))

Modified: trunk/Tools/ChangeLog (289427 => 289428)


--- trunk/Tools/ChangeLog	2022-02-08 22:14:18 UTC (rev 289427)
+++ trunk/Tools/ChangeLog	2022-02-08 22:21:59 UTC (rev 289428)
@@ -1,3 +1,20 @@
+2022-02-02  Jonathan Bedard  <[email protected]>
+
+        [EWS] Embed added/modified/deleted status into changed files
+        https://bugs.webkit.org/show_bug.cgi?id=236051
+
+        Reviewed by Aakash Jain.
+
+        GitHub's API includes whether a file was added, modified or deleted.
+        We don't include this information in source changes, we should.
+
+        * CISupport/ews-build/events.py:
+        (GitHubEventHandlerNoEdits.file_with_mod_sign): Added.
+        (GitHubEventHandlerNoEdits._get_pr_files): Copied from buildbot, modified to include
+        file modification status.
+        * CISupport/ews-build/steps.py:
+        (FindModifiedLayoutTests): Remove FIXME
+
 2022-02-08  Jonathan Bedard  <[email protected]>
 
         [git-webkit] Autostash when pulling (Follow-up fix)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to