Diff
Modified: trunk/Tools/ChangeLog (292473 => 292474)
--- trunk/Tools/ChangeLog 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/ChangeLog 2022-04-06 16:36:06 UTC (rev 292474)
@@ -1,3 +1,24 @@
+2022-04-06 Jonathan Bedard <[email protected]>
+
+ [git-webkit] Apply labels based on tracker
+ https://bugs.webkit.org/show_bug.cgi?id=238640
+ <rdar://problem/91135356>
+
+ Reviewed by Stephanie Lewis.
+
+ * Scripts/libraries/webkitbugspy/setup.py: Bump version.
+ * Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py: Ditto.
+ * Scripts/libraries/webkitbugspy/webkitbugspy/mocks/github.py:
+ (GitHub._issue): Handle case where empty assignee can be resolved.
+ * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/git_hub.py:
+ (GitHub.__init__): Pass issues, projects and labels to base class.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
+ (PullRequest.main): If we have an associated issue and can apply labels to our pull request,
+ apply the issue's component and version labels to our pull request.
+ * Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py:
+
2022-04-06 Sihui Liu <[email protected]>
Remove test ResourceLoadStatistics.RemoveSessionID
Modified: trunk/Tools/Scripts/libraries/webkitbugspy/setup.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitbugspy/setup.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/setup.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -30,7 +30,7 @@
setup(
name='webkitbugspy',
- version='0.5.0',
+ version='0.5.1',
description='Library containing a shared API for various bug trackers.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(0, 5, 0)
+version = Version(0, 5, 1)
from .user import User
from .issue import Issue
Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/github.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/github.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/mocks/github.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -122,7 +122,7 @@
)
issue = self.issues[id]
if data:
- if self.users.get(data.get('assignees', [None])[0]):
+ if data.get('assignees') and self.users.get(data.get('assignees', [None])[0]):
issue['assignee'] = self.users[data['assignees'][0]]
if data.get('state') == 'opened':
issue['opened'] = True
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -29,7 +29,7 @@
setup(
name='webkitscmpy',
- version='4.6.0',
+ version='4.7.0',
description='Library designed to interact with git and svn repositories.',
long_description=readme(),
classifiers=[
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -46,7 +46,7 @@
"Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
)
-version = Version(4, 6, 0)
+version = Version(4, 7, 0)
AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
AutoInstall.register(Package('jinja2', Version(2, 11, 3)))
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/git_hub.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/git_hub.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/remote/git_hub.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -35,7 +35,7 @@
def __init__(
self, remote='github.example.com/WebKit/WebKit', datafile=None,
default_branch='main', git_svn=False, environment=None,
- releases=None,
+ releases=None, issues=None, projects=None, labels=None,
):
if not scmremote.GitHub.is_webserver('https://{}'.format(remote)):
raise ValueError('"{}" is not a valid GitHub remote'.format(remote))
@@ -44,7 +44,7 @@
self.remote = remote
self.forks = []
- super(GitHub, self).__init__(remote, environment=environment)
+ super(GitHub, self).__init__(remote, environment=environment, issues=issues, projects=projects, labels=labels)
with open(datafile or os.path.join(os.path.dirname(os.path.dirname(__file__)), 'git-repo.json')) as file:
self.commits = jsonlib.load(file)
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -270,6 +270,22 @@
issue.open(why='Re-opening for pull request {}'.format(pr.url))
print('Posted pull request link to {}'.format(issue.link))
+ if issue and pr._metadata and pr._metadata.get('issue'):
+ log.info('Syncing PR labels with issue component...')
+ pr_issue = pr._metadata['issue']
+ project = pr_issue.tracker.name
+ component = issue.component
+ if pr_issue.component == component or component not in pr_issue.tracker.projects.get(project, {}).get('components', {}):
+ component = None
+ version = issue.version
+ if pr_issue.version == version or version not in pr_issue.tracker.projects.get(project, {}).get('versions', []):
+ version = None
+ if component or version:
+ pr_issue.set_component(component=component, version=version)
+ log.info('Synced PR labels with issue component!')
+ else:
+ log.info('No label syncing required')
+
if pr.url:
print(pr.url)
Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py (292473 => 292474)
--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py 2022-04-06 16:16:15 UTC (rev 292473)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py 2022-04-06 16:36:06 UTC (rev 292474)
@@ -22,15 +22,14 @@
import logging
import os
-import sys
import time
import unittest
from mock import patch
-from webkitbugspy import Tracker, User, bugzilla, radar, mocks as bmocks
-from webkitcorepy import OutputCapture, testing, log as wcplog
+from webkitbugspy import Tracker, bugzilla, github, radar, mocks as bmocks
+from webkitcorepy import OutputCapture, testing
from webkitcorepy.mocks import Terminal as MockTerminal, Environment
-from webkitscmpy import Contributor, Commit, PullRequest, local, program, mocks, remote, log as wsplog
+from webkitscmpy import Contributor, Commit, PullRequest, local, program, mocks, remote
class TestPullRequest(unittest.TestCase):
@@ -511,9 +510,9 @@
)
def test_github_bugzilla(self):
- with OutputCapture(level=logging.INFO) as captured, mocks.remote.GitHub() as remote, bmocks.Bugzilla(
+ with OutputCapture(level=logging.INFO) as captured, mocks.remote.GitHub(projects=bmocks.PROJECTS) as remote, bmocks.Bugzilla(
self.BUGZILLA.split('://')[-1],
- issues=bmocks.ISSUES,
+ projects=bmocks.PROJECTS, issues=bmocks.ISSUES,
environment=Environment(
BUGS_EXAMPLE_COM_USERNAME='[email protected]',
BUGS_EXAMPLE_COM_PASSWORD='password',
@@ -539,6 +538,10 @@
Tracker.instance().issue(1).comments[-1].content,
'Pull request: https://github.example.com/WebKit/WebKit/pull/1',
)
+ gh_issue = github.Tracker('https://github.example.com/WebKit/WebKit').issue(1)
+ self.assertEqual(gh_issue.project, 'WebKit')
+ self.assertEqual(gh_issue.component, 'Text')
+ self.assertEqual(gh_issue.version, 'Other')
self.assertEqual(
captured.stdout.getvalue(),
@@ -560,6 +563,8 @@
"Creating pull-request for 'eng/pr-branch'...",
'Checking issue assignee...',
'Checking for pull request link in associated issue...',
+ 'Syncing PR labels with issue component...',
+ 'Synced PR labels with issue component!',
],
)
@@ -614,6 +619,8 @@
"Creating pull-request for 'eng/pr-branch'...",
'Checking issue assignee...',
'Checking for pull request link in associated issue...',
+ 'Syncing PR labels with issue component...',
+ 'No label syncing required',
],
)