Title: [280967] trunk/Tools
Revision
280967
Author
jbed...@apple.com
Date
2021-08-12 08:23:37 -0700 (Thu, 12 Aug 2021)

Log Message

[check-github-mirror-integrity] Differentiate between slow sync and collapsed commits
https://bugs.webkit.org/show_bug.cgi?id=229004
<rdar://problem/81795644>

Reviewed by Aakash Jain.

* Scripts/check-github-mirror-integrity: Use commit timestamps to differentiate between a slow sync between svn.webkit.org
and GitHub and git-svn combining commits

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280966 => 280967)


--- trunk/Tools/ChangeLog	2021-08-12 13:53:44 UTC (rev 280966)
+++ trunk/Tools/ChangeLog	2021-08-12 15:23:37 UTC (rev 280967)
@@ -1,3 +1,14 @@
+2021-08-12  Jonathan Bedard  <jbed...@apple.com>
+
+        [check-github-mirror-integrity] Differentiate between slow sync and collapsed commits
+        https://bugs.webkit.org/show_bug.cgi?id=229004
+        <rdar://problem/81795644>
+
+        Reviewed by Aakash Jain.
+
+        * Scripts/check-github-mirror-integrity: Use commit timestamps to differentiate between a slow sync between svn.webkit.org
+        and GitHub and git-svn combining commits
+
 2021-08-12  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Simplify TestWebKitAccessibility

Modified: trunk/Tools/Scripts/check-github-mirror-integrity (280966 => 280967)


--- trunk/Tools/Scripts/check-github-mirror-integrity	2021-08-12 13:53:44 UTC (rev 280966)
+++ trunk/Tools/Scripts/check-github-mirror-integrity	2021-08-12 15:23:37 UTC (rev 280967)
@@ -27,9 +27,13 @@
 import time
 
 from webkitpy import webkitscmpy
+from webkitcorepy.string_utils import pluralize
 from webkitscmpy import local, remote
 
 
+SYNC_TIME_LIMIT = 5 * 60  # 5 minutes
+
+
 def main():
     cache_path = None
     try:
@@ -44,19 +48,26 @@
     mirror_tip = mirror.commit(branch='main')
     canonical_tip = repository.commit(branch='trunk')
 
-    if mirror_tip.identifier == canonical_tip.identifier:
+    timestamps_equal = mirror_tip.timestamp == canonical_tip.timestamp
+
+    if timestamps_equal and mirror_tip.identifier == canonical_tip.identifier:
         print('GitHub and svn.webkit.org are in sync')
         print(f'HEAD commit on GitHub {mirror_tip} matches HEAD commit on svn.webkit.org {canonical_tip}')
         return 0
 
-    if time.time() >= canonical_tip.timestamp - 5 * 60 and mirror_tip.identifier == canonical_tip.identifier - 1:
-        print('GitHub is 1 commit behind svn.webkit.org. This is ok.')
+    if timestamps_equal and mirror_tip.identifier != canonical_tip.identifier:
+        print('ERROR: GitHub and svn.webkit.org are out of sync')
+        print(f'HEAD commit on GitHub {mirror_tip} out of sync with HEAD commit on svn.webkit.org {canonical_tip}')
+        return 1
+
+    difference = canonical_tip.identifier - mirror_tip.identifier
+    if time.time() < canonical_tip.timestamp + SYNC_TIME_LIMIT:
+        print('GitHub is {} behind svn.webkit.org, but might be updating, This is ok.'.format(pluralize(difference, 'commit')))
         print(f'HEAD commit on GitHub {mirror_tip} slightly behind HEAD commit on svn.webkit.org {canonical_tip}')
         return 0
 
-    print('ERROR: GitHub and svn.webkit.org are out of sync')
+    print('ERROR: GitHub is not syncing from svn.webkit.org and is {} behind'.format(pluralize(difference, 'commit')))
     print(f'HEAD commit on GitHub {mirror_tip} out of sync with HEAD commit on svn.webkit.org {canonical_tip}')
-    print('This indicates a serious error with the repository, please inform ad...@webkit.org urgently')
     return 1
 
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to