Title: [288968] trunk/Tools
Revision
288968
Author
[email protected]
Date
2022-02-02 10:46:12 -0800 (Wed, 02 Feb 2022)

Log Message

[git-webkit] Improve user prompts (Part 4)
https://bugs.webkit.org/show_bug.cgi?id=235655
<rdar://problem/88082697>

Reviewed by Aakash Jain and Dewei Zhu.

* Tools/Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py:
(Branch.main): Make it clear why we're prompting the user for a branch name.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py:
(TestBranch.test_prompt_git):

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (288967 => 288968)


--- trunk/Tools/ChangeLog	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/ChangeLog	2022-02-02 18:46:12 UTC (rev 288968)
@@ -1,5 +1,20 @@
 2022-01-26  Jonathan Bedard  <[email protected]>
 
+        [git-webkit] Improve user prompts (Part 4)
+        https://bugs.webkit.org/show_bug.cgi?id=235655
+        <rdar://problem/88082697>
+
+        Reviewed by Aakash Jain and Dewei Zhu.
+
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py:
+        (Branch.main): Make it clear why we're prompting the user for a branch name.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py:
+        (TestBranch.test_prompt_git):
+
+2022-01-26  Jonathan Bedard  <[email protected]>
+
         [git-webkit] Improve user prompts (Part 3)
         https://bugs.webkit.org/show_bug.cgi?id=235655
         <rdar://problem/88082697>

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (288967 => 288968)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2022-02-02 18:46:12 UTC (rev 288968)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='3.1.6',
+    version='3.1.7',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (288967 => 288968)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2022-02-02 18:46:12 UTC (rev 288968)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(3, 1, 6)
+version = Version(3, 1, 7)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('jinja2', Version(2, 11, 3)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py (288967 => 288968)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/branch.py	2022-02-02 18:46:12 UTC (rev 288968)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Apple Inc. All rights reserved.
+# Copyright (C) 2021, 2022 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -70,13 +70,13 @@
         return commit
 
     @classmethod
-    def main(cls, args, repository, **kwargs):
+    def main(cls, args, repository, why=None, **kwargs):
         if not isinstance(repository, local.Git):
             sys.stderr.write("Can only 'branch' on a native Git repository\n")
             return 1
 
         if not args.issue:
-            args.issue = Terminal.input('Branch name: ')
+            args.issue = Terminal.input('{}nter name of new branch: '.format('{}, e'.format(why) if why else 'E'))
         args.issue = cls.normalize_branch_name(args.issue)
 
         if run([repository.executable(), 'check-ref-format', args.issue], capture_output=True).returncode:
@@ -94,5 +94,5 @@
             sys.stderr.write("Failed to create '{}'\n".format(args.issue))
             return 1
         repository._branch = args.issue  # Assign the cache because of repository.branch's caching
-        print("Created the local development branch '{}'!".format(args.issue))
+        print("Created the local development branch '{}'".format(args.issue))
         return 0

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


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/pull_request.py	2022-02-02 18:46:12 UTC (rev 288968)
@@ -108,7 +108,7 @@
             return 1
 
         if not repository.DEV_BRANCHES.match(repository.branch):
-            if Branch.main(args, repository, **kwargs):
+            if Branch.main(args, repository, why="'{}' is not a pull request branch".format(repository.branch), **kwargs):
                 sys.stderr.write("Abandoning pushing pull-request because '{}' could not be created\n".format(args.issue))
                 return 1
         elif args.issue and repository.branch != args.issue:

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py (288967 => 288968)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/branch_unittest.py	2022-02-02 18:46:12 UTC (rev 288968)
@@ -1,4 +1,4 @@
-# Copyright (C) 2021 Apple Inc. All rights reserved.
+# Copyright (C) 2021, 2022 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -56,7 +56,7 @@
             ))
             self.assertEqual(local.Git(self.path).branch, 'eng/1234')
         self.assertEqual(captured.root.log.getvalue(), "Creating the local development branch 'eng/1234'...\n")
-        self.assertEqual(captured.stdout.getvalue(), "Created the local development branch 'eng/1234'!\n")
+        self.assertEqual(captured.stdout.getvalue(), "Created the local development branch 'eng/1234'\n")
 
     def test_prompt_git(self):
         with MockTerminal.input('eng/example'), OutputCapture(level=logging.INFO) as captured, mocks.local.Git(self.path), mocks.local.Svn(), MockTime:
@@ -63,7 +63,7 @@
             self.assertEqual(0, program.main(args=('branch', '-v'), path=self.path))
             self.assertEqual(local.Git(self.path).branch, 'eng/example')
         self.assertEqual(captured.root.log.getvalue(), "Creating the local development branch 'eng/example'...\n")
-        self.assertEqual(captured.stdout.getvalue(), "Branch name: \nCreated the local development branch 'eng/example'!\n")
+        self.assertEqual(captured.stdout.getvalue(), "Enter name of new branch: \nCreated the local development branch 'eng/example'\n")
 
     def test_invalid_branch(self):
         with OutputCapture() as captured, mocks.local.Git(self.path), mocks.local.Svn(), MockTime:

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


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py	2022-02-02 18:46:06 UTC (rev 288967)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/pull_request_unittest.py	2022-02-02 18:46:12 UTC (rev 288968)
@@ -291,7 +291,7 @@
 Rebasing 'eng/pr-branch' on 'main'...
 Rebased 'eng/pr-branch' on 'main!'
     Found 1 commit...""")
-        self.assertEqual(captured.stdout.getvalue(), "Created the local development branch 'eng/pr-branch'!\n")
+        self.assertEqual(captured.stdout.getvalue(), "Created the local development branch 'eng/pr-branch'\n")
         self.assertEqual(captured.stderr.getvalue(), "'{}' doesn't have a recognized remote\n".format(self.path))
 
     def test_modified(self):
@@ -328,7 +328,7 @@
 
         self.assertEqual(
             captured.stdout.getvalue(),
-            "Created the local development branch 'eng/pr-branch'!\n"
+            "Created the local development branch 'eng/pr-branch'\n"
             "Created 'PR 1 | [Testing] Creating commits'!\n"
             "https://github.example.com/WebKit/WebKit/pull/1\n",
         )
@@ -437,7 +437,7 @@
 
         self.assertEqual(
             captured.stdout.getvalue(),
-            "Created the local development branch 'eng/pr-branch'!\n"
+            "Created the local development branch 'eng/pr-branch'\n"
             "Created 'PR 1 | [Testing] Creating commits'!\n"
             "https://bitbucket.example.com/projects/WEBKIT/repos/webkit/pull-requests/1/overview\n",
         )
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to