Title: [293986] trunk/Tools
Revision
293986
Author
[email protected]
Date
2022-05-09 13:04:36 -0700 (Mon, 09 May 2022)

Log Message

[git-webkit] Verify forks after creation
https://bugs.webkit.org/show_bug.cgi?id=240085
<rdar://problem/92978491>

Reviewed by Stephanie Lewis.

* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py:
(Setup.github): Check parent of fork, wait until fork is created before continuing.

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (293985 => 293986)


--- trunk/Tools/ChangeLog	2022-05-09 19:40:08 UTC (rev 293985)
+++ trunk/Tools/ChangeLog	2022-05-09 20:04:36 UTC (rev 293986)
@@ -1,3 +1,16 @@
+2022-05-09  Jonathan Bedard  <[email protected]>
+
+        [git-webkit] Verify forks after creation
+        https://bugs.webkit.org/show_bug.cgi?id=240085
+        <rdar://problem/92978491>
+
+        Reviewed by Stephanie Lewis.
+
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py:
+        (Setup.github): Check parent of fork, wait until fork is created before continuing.
+
 2022-05-06  Keith Miller  <[email protected]>
 
         Test262 runner should show progress

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (293985 => 293986)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-05-09 19:40:08 UTC (rev 293985)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-05-09 20:04:36 UTC (rev 293986)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='4.13.1',
+    version='4.13.2',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (293985 => 293986)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-05-09 19:40:08 UTC (rev 293985)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-05-09 20:04:36 UTC (rev 293986)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(4, 13, 1)
+version = Version(4, 13, 2)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('jinja2', Version(2, 11, 3)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py (293985 => 293986)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py	2022-05-09 19:40:08 UTC (rev 293985)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/setup.py	2022-05-09 20:04:36 UTC (rev 293986)
@@ -24,6 +24,7 @@
 import os
 import requests
 import sys
+import time
 
 from .command import Command
 from requests.auth import HTTPBasicAuth
@@ -54,9 +55,12 @@
             username,
             forked_name,
         ), auth=auth, headers=dict(Accept='application/vnd.github.v3+json'))
+
         if response.status_code == 200:
-            log.info("User already owns a fork of '{}'!".format(repository.name))
-            return result
+            parent_name = response.json().get('parent', {}).get('full_name', None)
+            if parent_name == '{}/{}'.format(repository.owner, repository.name):
+                log.info("User already owns a fork of '{}'!".format(parent_name))
+                return result
 
         if repository.owner == username or args.defaults or Terminal.choose(
             "Create a private fork of '{}' belonging to '{}'".format(forked_name, username),
@@ -91,6 +95,26 @@
                 sys.stderr.write("Fork created with name '{}' belonging to '{}'\n Failed to change name to {}\n".format(set_name, username, forked_name))
                 return 1
 
+        response = None
+        attempts = 0
+        while response and response.status_code != 200:
+            if attempts > 3:
+                sys.stderr.write("Waiting on '{}' belonging to '{}' took to long\n".format(forked_name, username))
+                sys.stderr.write("Wait until '{}/{}/{}' is accessible and then re-run setup\n".format(
+                    '/'.join(repository.url.split('/')[:3]),
+                    username, forked_name,
+                ))
+                return 1
+            if response:
+                log.warning("Waiting for '{}' belonging to '{}'...".format(forked_name, username))
+                time.sleep(10)
+            attempts += 1
+            response = requests.get('{}/repos/{}/{}'.format(
+                repository.api_url,
+                username,
+                forked_name,
+            ), auth=auth, headers=dict(Accept='application/vnd.github.v3+json'))
+
         log.info("Created a private fork of '{}' belonging to '{}'!".format(forked_name, username))
         return result
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to