Title: [289411] trunk
Revision
289411
Author
[email protected]
Date
2022-02-08 11:51:31 -0800 (Tue, 08 Feb 2022)

Log Message

[git-webkit] Allow repositories to declare their bug trackers
https://bugs.webkit.org/show_bug.cgi?id=236306
<rdar://problem/88633018>

Reviewed by Dewei Zhu.

* metadata/trackers.json: Added.
* Tools/Scripts/libraries/webkitbugspy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py:
(Tracker.__init__): Raise correct exception.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py:
(Tracker.__init__): Raise correct exception.
* Tools/Scripts/libraries/webkitbugspy/webkitbugspy/tracker.py:
(Tracker.from_json): Handle list or tuple input.
* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git): Use shared METADATA declaration.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/scm.py:
(Scm.__init__): Register any bug trackers associated with the repository.

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

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (289410 => 289411)


--- trunk/ChangeLog	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/ChangeLog	2022-02-08 19:51:31 UTC (rev 289411)
@@ -1,3 +1,13 @@
+2022-02-08  Jonathan Bedard  <[email protected]>
+
+        [git-webkit] Allow repositories to declare their bug trackers
+        https://bugs.webkit.org/show_bug.cgi?id=236306
+        <rdar://problem/88633018>
+
+        Reviewed by Dewei Zhu.
+
+        * metadata/trackers.json: Added.
+
 2022-02-08  Adrian Perez de Castro  <[email protected]>
 
         [WPE] Running distcheck with USE_SOUP2=OFF fails to install documentation

Modified: trunk/Tools/ChangeLog (289410 => 289411)


--- trunk/Tools/ChangeLog	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/ChangeLog	2022-02-08 19:51:31 UTC (rev 289411)
@@ -1,3 +1,26 @@
+2022-02-08  Jonathan Bedard  <[email protected]>
+
+        [git-webkit] Allow repositories to declare their bug trackers
+        https://bugs.webkit.org/show_bug.cgi?id=236306
+        <rdar://problem/88633018>
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/libraries/webkitbugspy/setup.py: Bump version.
+        * Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py: Ditto.
+        * Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py:
+        (Tracker.__init__): Raise correct exception.
+        * Scripts/libraries/webkitbugspy/webkitbugspy/github.py:
+        (Tracker.__init__): Raise correct exception.
+        * Scripts/libraries/webkitbugspy/webkitbugspy/tracker.py:
+        (Tracker.from_json): Handle list or tuple input.
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
+        (Git): Use shared METADATA declaration.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/local/scm.py:
+        (Scm.__init__): Register any bug trackers associated with the repository.
+
 2022-02-08  Sam Weinig  <[email protected]>
 
         Conversion to a color space with a smaller gamut should perform gamut mapping

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/setup.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitbugspy/setup.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/setup.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -30,7 +30,7 @@
 
 setup(
     name='webkitbugspy',
-    version='0.3.1',
+    version='0.3.2',
     description='Library containing a shared API for various bug trackers.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/__init__.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(0, 3, 1)
+version = Version(0, 3, 2)
 
 from .user import User
 from .issue import Issue

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/bugzilla.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -62,7 +62,7 @@
 
         match = self.ROOT_RE.match(url)
         if not match:
-            raise self.Exception("'{}' is not a valid bugzilla url".format(url))
+            raise TypeError("'{}' is not a valid bugzilla url".format(url))
         self.url = ""
         self._res = [
             re.compile(template.format(match.group('domain')))

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/github.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -67,7 +67,7 @@
 
         match = self.ROOT_RE.match(url)
         if not match:
-            raise self.Exception("'{}' is not a valid GitHub project".format(url))
+            raise TypeError("'{}' is not a valid GitHub project".format(url))
 
         self._res = [
             re.compile(template.format(match.group('domain'), match.group('owner'), match.group('repository')))

Modified: trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/tracker.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/tracker.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitbugspy/webkitbugspy/tracker.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -47,7 +47,7 @@
     def from_json(cls, data):
         from . import bugzilla, github, radar
 
-        data = "" if isinstance(data, dict) else json.loads(data)
+        data = "" if isinstance(data, (dict, list, tuple)) else json.loads(data)
         if isinstance(data, (list, tuple)):
             return [cls.from_json(datum) for datum in data]
         if data.get('type') in ('bugzilla', 'github'):

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='4.0.1',
+    version='4.1.0',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(4, 0, 1)
+version = Version(4, 1, 0)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('jinja2', Version(2, 11, 3)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -300,7 +300,7 @@
     HTTP_REMOTE = re.compile(r'(?P<protocol>https?)://(?P<host>[^\/]+)/(?P<path>.+).git')
     REMOTE_BRANCH = re.compile(r'remotes\/(?P<remote>[^\/]+)\/(?P<branch>.+)')
     USER_REMOTE = re.compile(r'(?P<username>[^:/]+):(?P<branch>.+)')
-    PROJECT_CONFIG_PATH = os.path.join('metadata', 'project_config')
+    PROJECT_CONFIG_PATH = os.path.join(Scm.METADATA, 'project_config')
     PROJECT_CONFIG_OPTIONS = {
         'pull.rebase': ['true', 'false'],
         'webkitscmpy.pull-request': ['overwrite', 'append'],

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/scm.py (289410 => 289411)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/scm.py	2022-02-08 19:32:21 UTC (rev 289410)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/scm.py	2022-02-08 19:51:31 UTC (rev 289411)
@@ -20,11 +20,12 @@
 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-
+import json
 import os
 import re
 import six
 
+from webkitbugspy import Tracker, radar
 from webkitscmpy import ScmBase, Contributor
 
 
@@ -33,6 +34,7 @@
     # the following idioms seem common enough to be shared.
     DEV_BRANCHES = re.compile(r'.*[(eng)(dev)(bug)]/.+')
     PROD_BRANCHES = re.compile(r'\S+-[\d+\.]+-branch')
+    METADATA = 'metadata'
 
     @classmethod
     def executable(cls, program):
@@ -61,7 +63,7 @@
         root_path = self.root_path
         if not contributors and root_path:
             for candidate in [
-                os.path.join(root_path, 'metadata', 'contributors.json'),
+                os.path.join(root_path, self.METADATA, 'contributors.json'),
             ]:
                 if not os.path.isfile(candidate):
                     continue
@@ -70,6 +72,20 @@
 
         super(Scm, self).__init__(dev_branches=dev_branches, prod_branches=prod_branches, contributors=contributors, id=id)
 
+        trackers = []
+        if root_path:
+            path = os.path.join(root_path, self.METADATA, 'trackers.json')
+            if os.path.isfile(path):
+                with open(path, 'r') as file:
+                    trackers = Tracker.from_json(json.load(file))
+        for tracker in trackers:
+            if isinstance(tracker, radar.Tracker) and not tracker.radarclient():
+                continue
+            for contributor in self.contributors:
+                if contributor.name and contributor.emails:
+                    tracker.users.create(name=contributor.name, emails=contributor.emails)
+            Tracker.register(tracker)
+
     @property
     def root_path(self):
         raise NotImplementedError()

Added: trunk/metadata/trackers.json (0 => 289411)


--- trunk/metadata/trackers.json	                        (rev 0)
+++ trunk/metadata/trackers.json	2022-02-08 19:51:31 UTC (rev 289411)
@@ -0,0 +1,11 @@
+[
+	{
+		"type" : "bugzilla",
+		"url" : "https://bugs.webkit.org",
+		"res" : [
+			"\\Awebkit.org/b/(?P<id>\\d+)\\Z",
+			"\\Ahttps?://webkit.org/b/(?P<id>\\d+)\\Z"
+		]
+	},
+	{ "type" : "radar" }
+]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to