Diff
Modified: trunk/Tools/ChangeLog (285141 => 285142)
--- trunk/Tools/ChangeLog 2021-11-01 23:05:46 UTC (rev 285141)
+++ trunk/Tools/ChangeLog 2021-11-01 23:13:43 UTC (rev 285142)
@@ -1,3 +1,21 @@
+2021-11-01 Jonathan Bedard <[email protected]>
+
+ [webkitscmpy] Only respect the latest review
+ https://bugs.webkit.org/show_bug.cgi?id=231987
+ <rdar://problem/84434991>
+
+ Reviewed by Dewei Zhu.
+
+ GitHub will report the entire history of a review, we should only
+ respect the latest review state.
+
+ * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:
+ (GitHub.PRGenerator.reviewers):
+ * Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py:
+ (TestNetworkPullRequestGitHub.test_approved_edits):
+
2021-11-01 Sam Sneddon <[email protected]>
Improve LayoutTestFinder test coverage
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (285141 => 285142)
--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2021-11-01 23:05:46 UTC (rev 285141)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2021-11-01 23:13:43 UTC (rev 285142)
@@ -29,7 +29,7 @@
setup(
name='webkitscmpy',
- version='2.2.21',
+ version='2.2.22',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (285141 => 285142)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2021-11-01 23:05:46 UTC (rev 285141)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2021-11-01 23:13:43 UTC (rev 285142)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(2, 2, 21)
+version = Version(2, 2, 22)
AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py (285141 => 285142)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py 2021-11-01 23:05:46 UTC (rev 285141)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py 2021-11-01 23:13:43 UTC (rev 285142)
@@ -206,13 +206,17 @@
pull_request._reviewers = [self._contributor(user['login']) for user in response.get('users', [])]
pull_request._approvers = []
pull_request._blockers = []
+
+ state_for = {}
+ for review in self.repository.request('pulls/{}/reviews'.format(pull_request.number)):
+ state_for[self._contributor(review['user']['login'])] = review.get('state')
+
needs_status = Contributor.REVIEWER in self.repository.contributors.statuses
- for review in self.repository.request('pulls/{}/reviews'.format(pull_request.number)):
- contributor = self._contributor(review['user']['login'])
+ for contributor, status in state_for.items():
pull_request._reviewers.append(contributor)
- if review.get('state') == 'APPROVED' and (not needs_status or contributor.status == Contributor.REVIEWER):
+ if status == 'APPROVED' and (not needs_status or contributor.status == Contributor.REVIEWER):
pull_request._approvers.append(contributor)
- elif review.get('state') == 'CHANGES_REQUESTED':
+ elif status == 'CHANGES_REQUESTED':
pull_request._blockers.append(contributor)
pull_request._reviewers = sorted(pull_request._reviewers)
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py (285141 => 285142)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py 2021-11-01 23:05:46 UTC (rev 285141)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py 2021-11-01 23:13:43 UTC (rev 285142)
@@ -507,6 +507,15 @@
self.assertEqual(pr.approvers, [Contributor('Eager Reviewer', ['[email protected]'])])
self.assertEqual(pr.blockers, [Contributor('Suspicious Reviewer', ['[email protected]'])])
+ def test_approved_edits(self):
+ with self.webserver() as server:
+ server.pull_requests[0]['reviews'].append(dict(user=dict(login='sreviewer'), state='APPROVED'))
+ pr = remote.GitHub(self.remote).pull_requests.get(1)
+ self.assertEqual(sorted(pr.approvers), sorted([
+ Contributor('Eager Reviewer', ['[email protected]']),
+ Contributor('Suspicious Reviewer', ['[email protected]']),
+ ]))
+
def test_approvers_status(self):
with self.webserver():
repo = remote.GitHub(self.remote)