Title: [295634] trunk/Tools/CISupport/ews-build
Revision
295634
Author
[email protected]
Date
2022-06-17 08:22:00 -0700 (Fri, 17 Jun 2022)

Log Message

[ews-build.webkit.org] Support periods in reviewer name
https://bugs.webkit.org/show_bug.cgi?id=241706

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps.py:
(ValidateCommitMessage):
(ValidateCommitMessage.extract_reviewers): Support reviewers with periods in their name.
* Tools/CISupport/ews-build/steps_unittest.py:
(mock_load_contributors):

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

Modified Paths

Diff

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


--- trunk/Tools/CISupport/ews-build/steps.py	2022-06-17 13:35:02 UTC (rev 295633)
+++ trunk/Tools/CISupport/ews-build/steps.py	2022-06-17 15:22:00 UTC (rev 295634)
@@ -4922,7 +4922,7 @@
     )
     RE_CHANGELOG = br'^(\+\+\+)\s+(.*ChangeLog.*)'
     BY_RE = re.compile(r'.+\s+by\s+(.+)$')
-    SPLIT_RE = re.compile(r'(,\s*)|( and )|\.')
+    SPLIT_RE = re.compile(r'(,\s*)|( and )')
 
     def __init__(self, **kwargs):
         super(ValidateCommitMessage, self).__init__(logEnviron=False, timeout=60, **kwargs)
@@ -4939,7 +4939,7 @@
                 continue
             for person in cls.SPLIT_RE.split(match.group(1)):
                 if person and not cls.SPLIT_RE.match(person):
-                    reviewers.add(person)
+                    reviewers.add(person.rstrip('.'))
         return reviewers, stripped_text
 
     def is_reviewer(self, name):

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


--- trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-06-17 13:35:02 UTC (rev 295633)
+++ trunk/Tools/CISupport/ews-build/steps_unittest.py	2022-06-17 15:22:00 UTC (rev 295634)
@@ -81,6 +81,7 @@
         '[email protected]': {'name': 'WebKit Committer', 'status': 'committer', 'email': '[email protected]'},
         'webkit-commit-queue': {'name': 'WebKit Committer', 'status': 'committer', 'email': '[email protected]'},
         'WebKit Committer': {'status': 'committer'},
+        'Myles C. Maxfield': {'status': 'reviewer'},
     }, []
 
 
@@ -5967,7 +5968,7 @@
             + 0, ExpectShell(workdir='wkdir',
                         logEnviron=False,
                         timeout=60,
-                        command=['/bin/sh', '-c', "git log HEAD ^origin/main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)'"])
+                        command=['/bin/sh', '-c', "git log HEAD ^origin/main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
             + 0
             + ExpectShell.log('stdio', stdout='    Reviewed by WebKit Reviewer.\n'),
         )
@@ -5992,7 +5993,7 @@
             + 0, ExpectShell(workdir='wkdir',
                         logEnviron=False,
                         timeout=60,
-                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)'"])
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
             + 0
             + ExpectShell.log('stdio', stdout='    Reviewed by WebKit Reviewer.\n'),
         )
@@ -5999,6 +6000,31 @@
         self.expectOutcome(result=SUCCESS, state_string='Validated commit message')
         return self.runStep()
 
+    def test_success_period(self):
+        self.setupStep(ValidateCommitMessage())
+        ValidateCommitMessage._files = lambda x: ['+++ Tools/CISupport/ews-build/steps.py']
+        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',
+                        logEnviron=False,
+                        timeout=60,
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q 'OO*PP*S!' && echo 'Commit message contains (OOPS!)' || test $? -eq 1"])
+            + 0, ExpectShell(workdir='wkdir',
+                logEnviron=False,
+                        timeout=60,
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep -q '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\|Unreviewed\\)' || echo 'No reviewer information in commit message'"])
+            + 0, ExpectShell(workdir='wkdir',
+                        logEnviron=False,
+                        timeout=60,
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
+            + 0
+            + ExpectShell.log('stdio', stdout='    Reviewed by Myles C. Maxfield.\n'),
+        )
+        self.expectOutcome(result=SUCCESS, state_string='Validated commit message')
+        return self.runStep()
+
     def test_failure_oops(self):
         self.setupStep(ValidateCommitMessage())
         ValidateCommitMessage._files = lambda x: ['+++ Tools/CISupport/ews-build/steps.py']
@@ -6036,7 +6062,7 @@
             + 0, ExpectShell(workdir='wkdir',
                         logEnviron=False,
                         timeout=60,
-                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)'"])
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
             + 0
             + ExpectShell.log('stdio', stdout='No reviewer information in commit message\n'),
         )
@@ -6063,7 +6089,7 @@
             + 0, ExpectShell(workdir='wkdir',
                         logEnviron=False,
                         timeout=60,
-                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)'"])
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
             + 0
             + ExpectShell.log('stdio', stdout='    Reviewed by WebKit Reviewer.\n'),
         )
@@ -6088,7 +6114,7 @@
             + 0, ExpectShell(workdir='wkdir',
                         logEnviron=False,
                         timeout=60,
-                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)'"])
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
             + 0
             + ExpectShell.log('stdio', stdout='    Reviewed by WebKit Contributor.\n'),
         )
@@ -6114,7 +6140,7 @@
             + 0, ExpectShell(workdir='wkdir',
                         logEnviron=False,
                         timeout=60,
-                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)'"])
+                        command=['/bin/sh', '-c', "git log eng/pull-request-branch ^main | grep '\\(Reviewed by\\|Rubber-stamped by\\|Rubber stamped by\\)' || true"])
             + 0
             + ExpectShell.log('stdio', stdout='    Reviewed by WebKit Reviewer.\n'),
         )
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to