Title: [279488] trunk/Tools
Revision
279488
Author
jbed...@apple.com
Date
2021-07-01 17:20:52 -0700 (Thu, 01 Jul 2021)

Log Message

[webkitscmpy] Cache identifiers in Git checkouts (Follow-up fix)
https://bugs.webkit.org/show_bug.cgi?id=225616
<rdar://problem/77789230>

Reviewed by Dewei Zhu.

Python 2's Subprocess is 10x slower than Python 3, which means generating
the cache is impractical in Python 2.

* Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
(Git.__init__): Disable cache on Python 2 by default.
* Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
(test_cache): Force Git to use cache.
(test_revision_cache): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (279487 => 279488)


--- trunk/Tools/ChangeLog	2021-07-02 00:08:31 UTC (rev 279487)
+++ trunk/Tools/ChangeLog	2021-07-02 00:20:52 UTC (rev 279488)
@@ -1,5 +1,22 @@
 2021-07-01  Jonathan Bedard  <jbed...@apple.com>
 
+        [webkitscmpy] Cache identifiers in Git checkouts (Follow-up fix)
+        https://bugs.webkit.org/show_bug.cgi?id=225616
+        <rdar://problem/77789230>
+
+        Reviewed by Dewei Zhu.
+
+        Python 2's Subprocess is 10x slower than Python 3, which means generating
+        the cache is impractical in Python 2.
+
+        * Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:
+        (Git.__init__): Disable cache on Python 2 by default.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py:
+        (test_cache): Force Git to use cache.
+        (test_revision_cache): Ditto.
+
+2021-07-01  Jonathan Bedard  <jbed...@apple.com>
+
         [clean-webkit] Exclude autoinstalled directory
         https://bugs.webkit.org/show_bug.cgi?id=227588
         <rdar://problem/80033943>

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


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py	2021-07-02 00:08:31 UTC (rev 279487)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py	2021-07-02 00:20:52 UTC (rev 279488)
@@ -260,10 +260,10 @@
     def is_checkout(cls, path):
         return run([cls.executable(), 'rev-parse', '--show-toplevel'], cwd=path, capture_output=True).returncode == 0
 
-    def __init__(self, path, dev_branches=None, prod_branches=None, contributors=None, id=None):
+    def __init__(self, path, dev_branches=None, prod_branches=None, contributors=None, id=None, cached=sys.version_info > (3, 0)):
         super(Git, self).__init__(path, dev_branches=dev_branches, prod_branches=prod_branches, contributors=contributors, id=id)
         self._branch = None
-        self.cache = self.Cache(self) if self.root_path else None
+        self.cache = self.Cache(self) if self.root_path and cached else None
         if not self.root_path:
             raise OSError('Provided path {} is not a git repository'.format(path))
 

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py (279487 => 279488)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py	2021-07-02 00:08:31 UTC (rev 279487)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/git_unittest.py	2021-07-02 00:20:52 UTC (rev 279488)
@@ -368,7 +368,7 @@
     def test_cache(self):
         for mock in [mocks.local.Git(self.path), mocks.local.Git(self.path, git_svn=True)]:
             with mock, OutputCapture():
-                repo = local.Git(self.path)
+                repo = local.Git(self.path, cached=True)
 
                 self.assertEqual(repo.cache.to_hash(identifier='1@main'), '9b8311f25a77ba14923d9d5a6532103f54abefcb')
                 self.assertEqual(repo.cache.to_identifier(hash='d8bce26fa65c'), '5@main')
@@ -381,7 +381,7 @@
 
     def test_revision_cache(self):
         with mocks.local.Git(self.path, git_svn=True), OutputCapture():
-            repo = local.Git(self.path)
+            repo = local.Git(self.path, cached=True)
 
             self.assertEqual(repo.cache.to_revision(identifier='1@main'), 1)
             self.assertEqual(repo.cache.to_identifier(revision='r9'), '5@main')
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to