Repository: VirtusLab/git-machete
Pull request #578 (2022-07-12 13:14:31)

Issue #576: Modify `create-pr` output


Patch:
diff --git a/git_machete/client.py b/git_machete/client.py
index 6f2c3f2..441575b 100644
--- a/git_machete/client.py
+++ b/git_machete/client.py
@@ -2123,7 +2123,7 @@ class MacheteClient:
         description_path = self.__git.get_main_git_subpath('info', 'description')
         description: str = utils.slurp_file_or_empty(description_path)
 
-        ok_str = ' <green>-> <b>OK</b></green>'
+        ok_str = ' <green><b>OK</b></green>'
         print(fmt(f'Creating a {"draft " if opt_draft else ""}PR from `{head}` to `{base}`...'), end='', flush=True)
         pr: GitHubPullRequest = create_pull_request(org, repo, head=head, base=base, title=commits[0].subject,
                                                     description=description, draft=opt_draft)


Test patch:
diff --git a/tests/test_github.py b/tests/test_github.py
index 92eb7c7..31f5414 100644
--- a/tests/test_github.py
+++ b/tests/test_github.py
@@ -580,7 +580,7 @@ class TestGithub:
 
         expected_msg = ("Fetching origin...\n"
                         "Warn: Base branch for this PR (`feature/api_handling`) is not found on remote, pushing...\n"
-                        "Creating a PR from `feature/api_exception_handling` to `feature/api_handling`... -> OK, see www.github.com\n")
+                        "Creating a PR from `feature/api_exception_handling` to `feature/api_handling`... OK, see www.github.com\n")
         assert_command(['github', 'create-pr'], expected_msg, strip_indentation=False)
         assert_command(
             ['status'],
@@ -662,7 +662,7 @@ class TestGithub:
             o-feature *
 
         Fetching origin_1...
-        Creating a PR from `feature` to `branch-1`... -> OK, see www.github.com
+        Creating a PR from `feature` to `branch-1`... OK, see www.github.com
         """  # noqa: W291
         assert_command(
             ['github', 'create-pr'],
@@ -681,7 +681,7 @@ class TestGithub:
         expected_result = """
         Added branch `feature_1` onto `feature`
         Fetching origin_2...
-        Creating a PR from `feature_1` to `feature`... -> OK, see www.github.com
+        Creating a PR from `feature_1` to `feature`... OK, see www.github.com
         """
         assert_command(
             ['github', 'create-pr'],
@@ -714,7 +714,7 @@ class TestGithub:
               o-feature_2 *
 
         Fetching origin_1...
-        Creating a PR from `feature_2` to `feature`... -> OK, see www.github.com
+        Creating a PR from `feature_2` to `feature`... OK, see www.github.com
         """  # noqa: W291
         assert_command(
             ['github', 'create-pr'],
@@ -747,7 +747,7 @@ class TestGithub:
                 o-feature_3 *
 
         Fetching origin_1...
-        Creating a PR from `feature_3` to `feature_2`... -> OK, see www.github.com
+        Creating a PR from `feature_3` to `feature_2`... OK, see www.github.com
         """
         assert_command(
             ['github', 'create-pr'],
@@ -763,16 +763,16 @@ class TestGithub:
                 .push(remote='origin_2')
         )
 
-        expected_result = """Added branch `feature_4` onto `feature_3`
-Fetching origin_2...
-Warn: Base branch for this PR (`feature_3`) is not found on remote, pushing...
-Creating a PR from `feature_4` to `feature_3`... -> OK, see www.github.com
-"""
-
+        expected_result = """
+        Added branch `feature_4` onto `feature_3`
+        Fetching origin_2...
+        Warn: Base branch for this PR (`feature_3`) is not found on remote, pushing...
+        Creating a PR from `feature_4` to `feature_3`... OK, see www.github.com
+        """
         assert_command(
             ['github', 'create-pr'],
             expected_result,
-            strip_indentation=False
+            indent=''
         )
 
     git_api_state_for_test_checkout_prs = MockGitHubAPIState(