[webkit-patch] Use commit.webkit.org instead of remote SVN to compute identifier
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Mar 2021 23:10:12 +0000 (23:10 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Mar 2021 23:10:12 +0000 (23:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=223820
<rdar://problem/75902125>

Reviewed by Dewei Zhu.

* Scripts/webkitpy/tool/commands/download_unittest.py:
(DownloadCommandsTest.mock_svn_remote): Replace mock Svn with mock requests.
* Scripts/webkitpy/tool/commands/upload_unittest.py:
* Scripts/webkitpy/tool/comments.py:
(bug_comment_from_svn_revision): Use commits.webkit.org instead of svn.webkit.org.
* Scripts/webkitpy/tool/steps/closebugforlanddiff_unittest.py:
(CloseBugForLandDiffTest.test_empty_state): Replace mock Svn with mock requests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275119 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/tool/commands/download_unittest.py
Tools/Scripts/webkitpy/tool/commands/upload_unittest.py
Tools/Scripts/webkitpy/tool/comments.py
Tools/Scripts/webkitpy/tool/steps/closebugforlanddiff_unittest.py

index d1065ddfc5441702b14337b3a7cfc76f2e432719..3d1a912af2da85d829be0fcac48cc051735a2372 100644 (file)
@@ -1,3 +1,19 @@
+2021-03-26  Jonathan Bedard  <jbedard@apple.com>
+
+        [webkit-patch] Use commit.webkit.org instead of remote SVN to compute identifier
+        https://bugs.webkit.org/show_bug.cgi?id=223820
+        <rdar://problem/75902125>
+
+        Reviewed by Dewei Zhu.
+
+        * Scripts/webkitpy/tool/commands/download_unittest.py:
+        (DownloadCommandsTest.mock_svn_remote): Replace mock Svn with mock requests.
+        * Scripts/webkitpy/tool/commands/upload_unittest.py:
+        * Scripts/webkitpy/tool/comments.py:
+        (bug_comment_from_svn_revision): Use commits.webkit.org instead of svn.webkit.org.
+        * Scripts/webkitpy/tool/steps/closebugforlanddiff_unittest.py:
+        (CloseBugForLandDiffTest.test_empty_state): Replace mock Svn with mock requests.
+
 2021-03-26  Don Olmstead  <don.olmstead@sony.com>
 
         [CMake] Deprecate using DERIVED_SOURCES_DIR/FOWARDING_HEADERS_DIR directly
index 596e9a1cbe71b96d2b6bc9fa7dbcb71f85ebb3a3..3dea713ceca77c226ce0139952257b92cd1abdb9 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright (C) 2009, 2011 Google Inc. All rights reserved.
+# Copyright (C) 2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -35,7 +36,7 @@ from webkitpy.tool.mocktool import MockOptions, MockTool
 from webkitpy.common.checkout.checkout_mock import MockCheckout
 
 from webkitcorepy import OutputCapture
-from webkitscmpy import mocks, Commit
+from webkitcorepy import mocks
 
 
 class AbstractRevertPrepCommandTest(unittest.TestCase):
@@ -98,21 +99,12 @@ class DownloadCommandsTest(CommandsTest):
         return options
 
     def mock_svn_remote(self):
-        repo = mocks.remote.Svn('svn.webkit.org/repository/webkit')
-        repo.commits['trunk'].append(Commit(
-            author=dict(name='Dmitry Titov', emails=['dimich@chromium.org']),
-            identifier='5@trunk',
-            revision=49824,
-            timestamp=1601668000,
-            message=
-                'Manual Test for crash caused by JS accessing DOMWindow which is disconnected from the Frame.\n'
-                'https://bugs.webkit.org/show_bug.cgi?id=30544\n'
-                '\n'
-                'Reviewed by Darin Adler.\n'
-                '\n'
-                '    manual-tests/crash-on-accessing-domwindow-without-frame.html: Added.\n',
-        ))
-        return repo
+        return mocks.Requests('commits.webkit.org', **{
+            'r49824/json': mocks.Response.fromJson(dict(
+                identifier='5@main',
+                revision=49824,
+            )),
+        })
 
     def test_build(self):
         expected_logs = "Updating working directory\nBuilding WebKit\n"
index 964de0c28ef7038717174d4ef066ac93e6964dda..b01b504b7c9622f42d0b3e260cd0e920f3b2038c 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (C) 2009 Google Inc. All rights reserved.
-# Copyright (C) 2018, 2019 Apple Inc. All rights reserved.
+# Copyright (C) 2018-2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -32,7 +32,7 @@ from webkitpy.tool.commands.commandtest import CommandsTest
 from webkitpy.tool.commands.upload import *
 from webkitpy.tool.mocktool import MockOptions, MockTool
 
-from webkitscmpy import mocks, Commit
+from webkitcorepy import mocks
 
 
 class UploadCommandsTest(CommandsTest):
@@ -206,14 +206,12 @@ Committed r9876 (5@main): <https://commits.webkit.org/5@main>
 --- End comment ---
 
 """
-        with mocks.remote.Svn('svn.webkit.org/repository/webkit') as repo:
-            repo.commits['trunk'].append(Commit(
-                author=dict(name='Justin Garcia', emails=['justin.garcia@apple.com']),
-                identifier='5@trunk',
+        with mocks.Requests('commits.webkit.org', **{
+            'r9876/json': mocks.Response.fromJson(dict(
+                identifier='5@main',
                 revision=9876,
-                timestamp=1601668000,
-                message='Patch by opendarwin.org@mitzpettel.com\n    Reviewed by darin and hyatt\n',
-            ))
+            )),
+        }):
             self.assert_execute_outputs(MarkBugFixed(), [], expected_logs=expected_logs, tool=tool, options=options)
 
     def test_edit_changelog(self):
index 98c8834942caf5dd840cb757d2c0b340b9f247f1..38cf8b1a3cffe7dca040a9a225474f25f18e2f1d 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (c) 2009 Google Inc. All rights reserved.
-# Copyright (c) 2009 Apple Inc. All rights reserved.
+# Copyright (c) 2009-2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
 # A tool for automating dealing with bugzilla, posting patches, committing
 # patches, etc.
 
+import requests
 from webkitpy.common.config import urls
-from webkitscmpy import remote
 
 
 def bug_comment_from_svn_revision(svn_revision):
-    repo = remote.Svn('https://svn.webkit.org/repository/webkit')
-    identifier = str(repo.commit(revision=svn_revision)).replace('trunk', 'main')
-    return 'Committed r{} ({}): <{}>'.format(svn_revision, identifier, urls.view_identifier_url(identifier))
+    repr = 'r{}'.format(svn_revision)
+    response = requests.get('https://commits.webkit.org/{}/json'.format(repr))
+    if response.status_code == 200:
+        repr = response.json().get('identifier', repr)
+    return 'Committed r{} ({}): <{}>'.format(svn_revision, repr if '@' in repr else '?', urls.view_identifier_url(repr))
 
 
 def bug_comment_from_commit_text(scm, commit_text):
index decd8961c0ef28ec3879e0b3b7e0c27d052789a9..ec347be406bcc586f903fad55af241f798657933 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (C) 2009 Google Inc. All rights reserved.
-# Copyright (C) 2020 Apple Inc. All rights reserved.
+# Copyright (C) 2020-2021 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions are
@@ -33,27 +33,17 @@ import unittest
 from webkitpy.tool.mocktool import MockOptions, MockTool
 from webkitpy.tool.steps.closebugforlanddiff import CloseBugForLandDiff
 
-from webkitcorepy import OutputCapture
-from webkitscmpy import mocks, Commit
+from webkitcorepy import mocks, OutputCapture
 
 
 class CloseBugForLandDiffTest(unittest.TestCase):
     def test_empty_state(self):
-        with mocks.remote.Svn('svn.webkit.org/repository/webkit') as repo:
-            repo.commits['trunk'].append(Commit(
-                author=dict(name='Dmitry Titov', emails=['dimich@chromium.org']),
-                identifier='5@trunk',
+        with mocks.Requests('commits.webkit.org', **{
+            'r49824/json': mocks.Response.fromJson(dict(
+                identifier='5@main',
                 revision=49824,
-                timestamp=1601668000,
-                message=
-                    'Manual Test for crash caused by JS accessing DOMWindow which is disconnected from the Frame.\n'
-                    'https://bugs.webkit.org/show_bug.cgi?id=30544\n'
-                    '\n'
-                    'Reviewed by Darin Adler.\n'
-                    '\n'
-                    '    manual-tests/crash-on-accessing-domwindow-without-frame.html: Added.\n',
-            ))
-
+            )),
+        }):
             step = CloseBugForLandDiff(MockTool(), MockOptions())
             with OutputCapture(level=logging.INFO) as captured:
                 step.run(dict(commit_text='Mock commit text'))