Title: [286623] trunk/Tools
Revision
286623
Author
[email protected]
Date
2021-12-07 14:31:12 -0800 (Tue, 07 Dec 2021)

Log Message

[commits.webkit.org] Fallback to remote repository (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=233904
<rdar://problem/86131927>

Reviewed by Dewei Zhu.

* Tools/Scripts/libraries/reporelaypy/reporelaypy/__init__.py: Bump version.
* Tools/Scripts/libraries/reporelaypy/reporelaypy/checkout.py:
(Checkout.Encoder.default):
(Checkout.__init__): Allow user to specify a remote fallback repository.
* Tools/Scripts/libraries/reporelaypy/reporelaypy/checkoutroute.py:
(CheckoutRoute.commit): If no commit is found, query the fallback repository.
* Tools/Scripts/libraries/reporelaypy/run: Add --fallback option.
* Tools/Scripts/libraries/reporelaypy/setup.py: Bump version.

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (286622 => 286623)


--- trunk/Tools/ChangeLog	2021-12-07 22:17:49 UTC (rev 286622)
+++ trunk/Tools/ChangeLog	2021-12-07 22:31:12 UTC (rev 286623)
@@ -1,3 +1,20 @@
+2021-12-06  Jonathan Bedard  <[email protected]>
+
+        [commits.webkit.org] Fallback to remote repository (Part 1)
+        https://bugs.webkit.org/show_bug.cgi?id=233904
+        <rdar://problem/86131927>
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/libraries/reporelaypy/reporelaypy/__init__.py: Bump version.
+        * Scripts/libraries/reporelaypy/reporelaypy/checkout.py:
+        (Checkout.Encoder.default):
+        (Checkout.__init__): Allow user to specify a remote fallback repository.
+        * Scripts/libraries/reporelaypy/reporelaypy/checkoutroute.py:
+        (CheckoutRoute.commit): If no commit is found, query the fallback repository.
+        * Scripts/libraries/reporelaypy/run: Add --fallback option.
+        * Scripts/libraries/reporelaypy/setup.py: Bump version.
+
 2021-12-07  Lauro Moura  <[email protected]>
 
         [reporelaypy] Autoinstall missing lupa fakeredis dependency

Modified: trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/__init__.py (286622 => 286623)


--- trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/__init__.py	2021-12-07 22:17:49 UTC (rev 286622)
+++ trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/__init__.py	2021-12-07 22:31:12 UTC (rev 286623)
@@ -44,7 +44,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(0, 1, 2)
+version = Version(0, 2, 0)
 
 import webkitflaskpy
 

Modified: trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/checkout.py (286622 => 286623)


--- trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/checkout.py	2021-12-07 22:17:49 UTC (rev 286622)
+++ trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/checkout.py	2021-12-07 22:31:12 UTC (rev 286623)
@@ -27,7 +27,7 @@
 import sys
 
 from webkitcorepy import run
-from webkitscmpy import local
+from webkitscmpy import local, remote
 
 
 class Checkout(object):
@@ -43,11 +43,14 @@
             if not isinstance(obj, Checkout):
                 return super(Checkout.Encoder, self).default(obj)
 
-            return dict(
+            result = dict(
                 path=obj.path,
                 url=""
                 sentinal=obj.sentinal,
             )
+            if obj.fallback_repository:
+                result['fallback_url'] = obj.fallback_repository.url
+            return result
 
     @classmethod
     def from_json(cls, data):
@@ -66,12 +69,15 @@
                 cloned.write('yes\n')
         return 0
 
-    def __init__(self, path, url="" http_proxy=None, sentinal=True, primary=True):
+    def __init__(self, path, url="" http_proxy=None, sentinal=True, fallback_url=None, primary=True):
         self.sentinal = sentinal
         self.path = path
         self.url = ""
         self._repository = None
         self._child_process = None
+        self.fallback_repository = remote.Scm.from_url(fallback_url) if fallback_url else None
+        if self.fallback_repository:
+            self.fallback_repository.commit()
 
         containing_path = os.path.dirname(path)
         if not os.path.isdir(containing_path):

Modified: trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/checkoutroute.py (286622 => 286623)


--- trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/checkoutroute.py	2021-12-07 22:17:49 UTC (rev 286622)
+++ trunk/Tools/Scripts/libraries/reporelaypy/reporelaypy/checkoutroute.py	2021-12-07 22:31:12 UTC (rev 286623)
@@ -145,9 +145,19 @@
         if not self.checkout.repository:
             return None
 
-        commit = self.checkout.repository.find(ref) if ref else self.checkout.repository.commit()
+        commit = None
+        try:
+            commit = self.checkout.repository.find(ref) if ref else self.checkout.repository.commit()
+        except (RuntimeError, ValueError):
+            pass
+
         if not commit:
-            return commit
+            try:
+                if self.checkout.fallback_repository:
+                    return self.checkout.fallback_repository.find(ref)
+            except (RuntimeError, ValueError):
+                pass
+            return None
 
         encoded = json.dumps(commit, cls=Commit.Encoder)
         self.database.set(commit.hash, encoded)

Modified: trunk/Tools/Scripts/libraries/reporelaypy/run (286622 => 286623)


--- trunk/Tools/Scripts/libraries/reporelaypy/run	2021-12-07 22:17:49 UTC (rev 286622)
+++ trunk/Tools/Scripts/libraries/reporelaypy/run	2021-12-07 22:31:12 UTC (rev 286623)
@@ -68,6 +68,10 @@
         '--update', dest='update_interval', default=0, action='', type=int,
         help='Set the number of seconds to wait between polling git checkout',
     )
+    group.add_argument(
+        '--fallback', dest='fallback', default=None, action='', type=str,
+        help='Fallback repository URL',
+    )
 
     group = parser.add_argument_group('Database')
     group.add_argument(
@@ -111,10 +115,18 @@
     print('Connected to database!')
 
     print('Finding checkout...')
-    checkout = Checkout(path=args.path, url="" http_proxy=args.http_proxy, sentinal=args.sentinal)
+    checkout = Checkout(
+        path=args.path,
+        url=""
+        http_proxy=args.http_proxy,
+        sentinal=args.sentinal,
+        fallback_url=args.fallback,
+    )
     print('Git checkout:')
     print('    Path: {}'.format(checkout.path))
     print('    URL: {}'.format(checkout.url))
+    if checkout.fallback_repository:
+        print('    Fallback: {}'.format(checkout.fallback_repository.url))
     if not checkout.repository:
         print('    Cloning repository...')
 

Modified: trunk/Tools/Scripts/libraries/reporelaypy/setup.py (286622 => 286623)


--- trunk/Tools/Scripts/libraries/reporelaypy/setup.py	2021-12-07 22:17:49 UTC (rev 286622)
+++ trunk/Tools/Scripts/libraries/reporelaypy/setup.py	2021-12-07 22:31:12 UTC (rev 286623)
@@ -30,7 +30,7 @@
 
 setup(
     name='reporelaypy',
-    version='0.1.2',
+    version='0.2.0',
     description='Library for visualizing, processing and storing test results.',
     long_description=readme(),
     classifiers=[
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to