Title: [288253] trunk/Tools
Revision
288253
Author
[email protected]
Date
2022-01-19 16:51:34 -0800 (Wed, 19 Jan 2022)

Log Message

[git-webkit] pull-request command should print the pr url
https://bugs.webkit.org/show_bug.cgi?id=235358
<rdar://problem/87793470>

Reviewed by Aakash Jain.

* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py: Make created
and modified commits in tests have more issue-friendly titles.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
(PullRequest.main): Print out PullRequest URL.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/pull_request.py:
(PullRequest.__init__): Constructor may define printable URL.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/bitbucket.py:
(BitBucket.PRGenerator.PullRequest): Set printable URL.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:
(GitHub.PRGenerator.PullRequest): Set printable URL.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py:

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (288252 => 288253)


--- trunk/Tools/ChangeLog	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/ChangeLog	2022-01-20 00:51:34 UTC (rev 288253)
@@ -1,5 +1,27 @@
 2022-01-19  Jonathan Bedard  <[email protected]>
 
+        [git-webkit] pull-request command should print the pr url
+        https://bugs.webkit.org/show_bug.cgi?id=235358
+        <rdar://problem/87793470>
+
+        Reviewed by Aakash Jain.
+
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py: Make created
+        and modified commits in tests have more issue-friendly titles.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py:
+        (PullRequest.main): Print out PullRequest URL.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/pull_request.py:
+        (PullRequest.__init__): Constructor may define printable URL.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/remote/bitbucket.py:
+        (BitBucket.PRGenerator.PullRequest): Set printable URL.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py:
+        (GitHub.PRGenerator.PullRequest): Set printable URL.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py:
+
+2022-01-19  Jonathan Bedard  <[email protected]>
+
         [EWS] Report basic statuses to GitHub
         https://bugs.webkit.org/show_bug.cgi?id=235210
         <rdar://problem/87576183>

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='3.1.2',
+    version='3.1.3',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(3, 1, 2)
+version = Version(3, 1, 3)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('jinja2', Version(2, 11, 3)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -830,8 +830,8 @@
             self.commits[self.branch].append(self.head)
 
         self.head.author = Contributor(self.config()['user.name'], [self.config()['user.email']])
-        self.head.message = '{} commit\nReviewed by Jonathan Bedard\n\n * {}\n'.format(
-            'Amended' if amend else 'Created',
+        self.head.message = '[Testing] {} commits\nReviewed by Jonathan Bedard\n\n * {}\n'.format(
+            'Amending' if amend else 'Creating',
             '\n * '.join(self.staged.keys()),
         )
         self.head.hash = hashlib.sha256(string_utils.encode(self.head.message)).hexdigest()[:40]

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -198,5 +198,7 @@
                 sys.stderr.write("Failed to create pull-request for '{}'\n".format(repository.branch))
                 return 1
             print("Created '{}'!".format(pr))
+        if pr.url:
+            print(pr.url)
 
         return 0

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/pull_request.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/pull_request.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/pull_request.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -139,6 +139,7 @@
         body=None, author=None,
         head=None, base=None,
         opened=None, generator=None, metadata=None,
+        url=""
     ):
         self.number = number
         self.title = title
@@ -153,6 +154,7 @@
         self._metadata = metadata
         self._comments = None
         self.generator = generator
+        self.url = ""
 
     @property
     def reviewers(self):

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/bitbucket.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/bitbucket.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/bitbucket.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -51,6 +51,7 @@
                 base=data['toRef']['displayId'],
                 opened=True if data.get('open') else (False if data.get('closed') else None),
                 generator=self,
+                url=''.format(self.repository.url, data['id']),
             )
 
             result._reviewers = []

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/remote/git_hub.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -57,7 +57,7 @@
                 generator=self,
                 metadata=dict(
                     issue=data.get('_links', {}).get('issue', {}).get('href'),
-                ),
+                ), url=''.format(self.repository.url, data['number']),
             )
 
         def get(self, number):

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py (288252 => 288253)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py	2022-01-20 00:22:17 UTC (rev 288252)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py	2022-01-20 00:51:34 UTC (rev 288253)
@@ -281,7 +281,7 @@
                 path=self.path,
             ))
             self.assertDictEqual(repo.staged, {})
-            self.assertEqual(repo.head.hash, 'e4390abc95a2026370b8c9813b7e55c61c5d6ebb')
+            self.assertEqual(repo.head.hash, 'c28f53f7fabd7bd9535af890cb7dc473cb342999')
 
         self.assertEqual(
             '\n'.join([line for line in captured.root.log.getvalue().splitlines() if 'Mock process' not in line]),
@@ -303,7 +303,7 @@
             ))
             self.assertDictEqual(repo.modified, dict())
             self.assertDictEqual(repo.staged, dict())
-            self.assertEqual(repo.head.hash, 'd05082bf6707252aef3472692598a587ed3fb213')
+            self.assertEqual(repo.head.hash, '488ea15fdbafb3ddfe827f913776208ad3217d79')
 
         self.assertEqual(captured.stderr.getvalue(), "'{}' doesn't have a recognized remote\n".format(self.path))
         self.assertEqual(
@@ -329,7 +329,8 @@
         self.assertEqual(
             captured.stdout.getvalue(),
             "Created the local development branch 'eng/pr-branch'!\n"
-            "Created 'PR 1 | Created commit'!\n",
+            "Created 'PR 1 | [Testing] Creating commits'!\n"
+            "https://github.example.com/WebKit/WebKit/pulls/1\n",
         )
         self.assertEqual(captured.stderr.getvalue(), '')
         log = captured.root.log.getvalue().splitlines()
@@ -362,7 +363,11 @@
                     path=self.path,
                 ))
 
-        self.assertEqual(captured.stdout.getvalue(), "Updated 'PR 1 | Amended commit'!\n")
+        self.assertEqual(
+            captured.stdout.getvalue(),
+            "Updated 'PR 1 | [Testing] Amending commits'!\n"
+            "https://github.example.com/WebKit/WebKit/pulls/1\n",
+        )
         self.assertEqual(captured.stderr.getvalue(), '')
         log = captured.root.log.getvalue().splitlines()
         self.assertEqual(
@@ -400,9 +405,10 @@
 
         self.assertEqual(
             captured.stdout.getvalue(),
-            "'eng/pr-branch' is already associated with 'PR 1 | Created commit', which is closed.\n"
+            "'eng/pr-branch' is already associated with 'PR 1 | [Testing] Creating commits', which is closed.\n"
             'Would you like to create a new pull-request? (Yes/[No]): \n'
-            "Updated 'PR 1 | Amended commit'!\n",
+            "Updated 'PR 1 | [Testing] Amending commits'!\n"
+            "https://github.example.com/WebKit/WebKit/pulls/1\n",
         )
         self.assertEqual(captured.stderr.getvalue(), '')
         log = captured.root.log.getvalue().splitlines()
@@ -432,7 +438,8 @@
         self.assertEqual(
             captured.stdout.getvalue(),
             "Created the local development branch 'eng/pr-branch'!\n"
-            "Created 'PR 1 | Created commit'!\n",
+            "Created 'PR 1 | [Testing] Creating commits'!\n"
+            "https://bitbucket.example.com/projects/WEBKIT/repos/webkit/pull-requests/1/overview\n",
         )
         self.assertEqual(captured.stderr.getvalue(), '')
         log = captured.root.log.getvalue().splitlines()
@@ -467,7 +474,11 @@
                     path=self.path,
                 ))
 
-        self.assertEqual(captured.stdout.getvalue(), "Updated 'PR 1 | Amended commit'!\n")
+        self.assertEqual(
+            captured.stdout.getvalue(),
+            "Updated 'PR 1 | [Testing] Amending commits'!\n"
+            "https://bitbucket.example.com/projects/WEBKIT/repos/webkit/pull-requests/1/overview\n"
+        )
         self.assertEqual(captured.stderr.getvalue(), '')
         log = captured.root.log.getvalue().splitlines()
         self.assertEqual(
@@ -507,9 +518,10 @@
 
         self.assertEqual(
             captured.stdout.getvalue(),
-            "'eng/pr-branch' is already associated with 'PR 1 | Created commit', which is closed.\n"
+            "'eng/pr-branch' is already associated with 'PR 1 | [Testing] Creating commits', which is closed.\n"
             'Would you like to create a new pull-request? (Yes/[No]): \n'
-            "Updated 'PR 1 | Amended commit'!\n",
+            "Updated 'PR 1 | [Testing] Amending commits'!\n"
+            "https://bitbucket.example.com/projects/WEBKIT/repos/webkit/pull-requests/1/overview\n",
         )
         self.assertEqual(captured.stderr.getvalue(), '')
         log = captured.root.log.getvalue().splitlines()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to