Title: [282108] trunk/Tools
Revision
282108
Author
jbed...@apple.com
Date
2021-09-07 15:04:55 -0700 (Tue, 07 Sep 2021)

Log Message

[git-webkit] Support callbacks as main arguments
https://bugs.webkit.org/show_bug.cgi?id=229739
<rdar://problem/82597266>

Reviewed by Dewei Zhu.

* Scripts/git-webkit:
(is_webkit_filter): Return item if repository is Webkit.
* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py:
(main): Pass repository to contributors, identifier_template and subversion
to dynamically generate values if those arguments are callable.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (282107 => 282108)


--- trunk/Tools/ChangeLog	2021-09-07 21:21:02 UTC (rev 282107)
+++ trunk/Tools/ChangeLog	2021-09-07 22:04:55 UTC (rev 282108)
@@ -1,3 +1,19 @@
+2021-09-07  Jonathan Bedard  <jbed...@apple.com>
+
+        [git-webkit] Support callbacks as main arguments
+        https://bugs.webkit.org/show_bug.cgi?id=229739
+        <rdar://problem/82597266>
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/git-webkit:
+        (is_webkit_filter): Return item if repository is Webkit.
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py:
+        (main): Pass repository to contributors, identifier_template and subversion
+        to dynamically generate values if those arguments are callable.
+
 2021-09-07  Chris Dumez  <cdu...@apple.com>
 
         Implement origin partitioning (top-origin/frame-origin) for BroadcastChannel

Modified: trunk/Tools/Scripts/git-webkit (282107 => 282108)


--- trunk/Tools/Scripts/git-webkit	2021-09-07 21:21:02 UTC (rev 282107)
+++ trunk/Tools/Scripts/git-webkit	2021-09-07 22:04:55 UTC (rev 282108)
@@ -26,9 +26,25 @@
 import sys
 
 from webkitpy.common.config.committers import CommitterList
-from webkitscmpy import program, Contributor
+from webkitscmpy import local, program, remote, Contributor
 
 
+def is_webkit_filter(to_return):
+    def callback(repository):
+        if isinstance(repository, local.Scm):
+            repository = repository.remote()
+        if not isinstance(repository, remote.Scm):
+            return None
+        if getattr(repository, 'name', None) == 'WebKit':
+            return to_return
+        url = "" 'url', '')
+        if 'svn.webkit.org' in url or 'git.webkit.org' in url:
+            return to_return
+        return None
+
+    return callback
+
+
 if '__main__' == __name__:
     contributors = Contributor.Mapping()
     for contributor in CommitterList().contributors():
@@ -44,8 +60,8 @@
 
     sys.exit(program.main(
         path=os.path.dirname(__file__),
-        contributors=contributors,
-        identifier_template='Canonical link: https://commits.webkit.org/{}',
-        subversion='https://svn.webkit.org/repository/webkit',
+        contributors=is_webkit_filter(contributors),
+        identifier_template=is_webkit_filter('Canonical link: https://commits.webkit.org/{}'),
+        subversion=is_webkit_filter('https://svn.webkit.org/repository/webkit'),
     ))
 

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (282107 => 282108)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2021-09-07 21:21:02 UTC (rev 282107)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2021-09-07 22:04:55 UTC (rev 282108)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='2.1.1',
+    version='2.1.2',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (282107 => 282108)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2021-09-07 21:21:02 UTC (rev 282107)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2021-09-07 22:04:55 UTC (rev 282108)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(2, 1, 1)
+version = Version(2, 1, 2)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('monotonic', Version(1, 5)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py (282107 => 282108)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py	2021-09-07 21:21:02 UTC (rev 282107)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/__init__.py	2021-09-07 22:04:55 UTC (rev 282108)
@@ -99,10 +99,17 @@
             parsed = parser.parse_args(args=args)
 
     if parsed.repository.startswith(('https://', 'http://')):
-        repository = remote.Scm.from_url(parsed.repository, contributors=contributors)
+        repository = remote.Scm.from_url(parsed.repository, contributors=None if callable(contributors) else contributors)
     else:
-        repository = local.Scm.from_path(path=parsed.repository, contributors=contributors)
+        repository = local.Scm.from_path(path=parsed.repository, contributors=None if callable(contributors) else contributors)
 
+    if callable(contributors):
+        repository.contributors = contributors(repository)
+    if callable(identifier_template):
+        identifier_template = identifier_template(repository)
+    if callable(subversion):
+        subversion = subversion(repository)
+
     if not getattr(parsed, 'main', None):
         parser.print_help()
         return -1
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to