Repository: VirtusLab/git-machete
Pull request #1265 (2024-06-10 10:22:25)

Improve readability of generated PR descriptions


Patch:
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 260c9f8..2b484ae 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -2,6 +2,8 @@
 
 ## New in git-machete 3.26.1
 
+- fixed: readability of autogenerated PR/MR descriptions
+
 ## New in git-machete 3.26.0
 
 - added: better detection of squash merges and rebases, controlled by flag `--squash-merge-detection={none,simple,exact}` (`status` and `traverse`) and git config key `machete.squashMergeDetection` (contributed by @gjulianm)
diff --git a/git_machete/client.py b/git_machete/client.py
index 34531ed..6433171 100644
--- a/git_machete/client.py
+++ b/git_machete/client.py
@@ -2538,7 +2538,8 @@ class MacheteClient:
         current_date = utils.get_current_date()
         prepend += f'## Full chain of {pr_short_name}s as of {current_date}\n\n'
         for ancestor_pr in pr_path:
-            prepend += f'* {ancestor_pr.display_text(fmt=False)}: `{ancestor_pr.head}` ➔ `{ancestor_pr.base}`\n'
+            prepend += f'* {ancestor_pr.display_text(fmt=False)}:\n'
+            prepend += f'  `{ancestor_pr.head}` ➔ `{ancestor_pr.base}`\n'
         prepend += '\n'
         prepend += f'{self.END_GIT_MACHETE_GENERATED_COMMENT}\n'
         return prepend


Test patch:
diff --git a/tests/test_github_create_pr.py b/tests/test_github_create_pr.py
index 104246a..858c2c7 100644
--- a/tests/test_github_create_pr.py
+++ b/tests/test_github_create_pr.py
@@ -161,8 +161,10 @@ class TestGitHubCreatePR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #5: `chore/fields` ➔ `ignore-trailing`
-            * PR #3: `ignore-trailing` ➔ `hotfix/add-trigger`
+            * PR #5:
+              `chore/fields` ➔ `ignore-trailing`
+            * PR #3:
+              `ignore-trailing` ➔ `hotfix/add-trigger`
 
             <!-- end git-machete generated -->
 
@@ -364,9 +366,12 @@ class TestGitHubCreatePR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #3: `call-ws` ➔ `build-chain`
-            * PR #2: `build-chain` ➔ `allow-ownership-link`
-            * PR #1: `allow-ownership-link` ➔ `develop`
+            * PR #3:
+              `call-ws` ➔ `build-chain`
+            * PR #2:
+              `build-chain` ➔ `allow-ownership-link`
+            * PR #1:
+              `allow-ownership-link` ➔ `develop`
 
             <!-- end git-machete generated -->
         ''')[1:]
@@ -383,10 +388,14 @@ class TestGitHubCreatePR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #4: `drop-constraint` ➔ `call-ws`
-            * PR #3: `call-ws` ➔ `build-chain`
-            * PR #2: `build-chain` ➔ `allow-ownership-link`
-            * PR #1: `allow-ownership-link` ➔ `develop`
+            * PR #4:
+              `drop-constraint` ➔ `call-ws`
+            * PR #3:
+              `call-ws` ➔ `build-chain`
+            * PR #2:
+              `build-chain` ➔ `allow-ownership-link`
+            * PR #1:
+              `allow-ownership-link` ➔ `develop`
 
             <!-- end git-machete generated -->
 
@@ -582,8 +591,10 @@ class TestGitHubCreatePR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #16: `feature` ➔ `branch-1`
-            * PR #15: `branch-1` ➔ `root`
+            * PR #16:
+              `feature` ➔ `branch-1`
+            * PR #15:
+              `branch-1` ➔ `root`
 
             <!-- end git-machete generated -->
 
diff --git a/tests/test_github_retarget_pr.py b/tests/test_github_retarget_pr.py
index 3fdfe84..099122a 100644
--- a/tests/test_github_retarget_pr.py
+++ b/tests/test_github_retarget_pr.py
@@ -267,8 +267,10 @@ class TestGitHubRetargetPR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #20: `feature_1` ➔ `feature`
-            * PR #15: `feature` ➔ `master`
+            * PR #20:
+              `feature_1` ➔ `feature`
+            * PR #15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->
             # Summary''')[1:]
@@ -314,8 +316,10 @@ class TestGitHubRetargetPR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #25: `feature_2` ➔ `feature`
-            * PR #15: `feature` ➔ `master`
+            * PR #25:
+              `feature_2` ➔ `feature`
+            * PR #15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->''')[1:]
 
@@ -354,9 +358,12 @@ class TestGitHubRetargetPR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #30: `feature_3` ➔ `feature_2`
-            * PR #25: `feature_2` ➔ `feature`
-            * PR #15: `feature` ➔ `master`
+            * PR #30:
+              `feature_3` ➔ `feature_2`
+            * PR #25:
+              `feature_2` ➔ `feature`
+            * PR #15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->
             # Summary''')[1:]
@@ -388,8 +395,10 @@ class TestGitHubRetargetPR(BaseTest):
 
             ## Full chain of PRs as of 2023-12-31
 
-            * PR #30: `feature_3` ➔ `feature`
-            * PR #15: `feature` ➔ `master`
+            * PR #30:
+              `feature_3` ➔ `feature`
+            * PR #15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->
             # Summary''')[1:]
diff --git a/tests/test_gitlab_create_mr.py b/tests/test_gitlab_create_mr.py
index eaf1d36..f46b38e 100644
--- a/tests/test_gitlab_create_mr.py
+++ b/tests/test_gitlab_create_mr.py
@@ -160,8 +160,10 @@ class TestGitLabCreateMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !5: `chore/fields` ➔ `ignore-trailing`
-            * MR !3: `ignore-trailing` ➔ `hotfix/add-trigger`
+            * MR !5:
+              `chore/fields` ➔ `ignore-trailing`
+            * MR !3:
+              `ignore-trailing` ➔ `hotfix/add-trigger`
 
             <!-- end git-machete generated -->
 
@@ -359,9 +361,12 @@ class TestGitLabCreateMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !3: `call-ws` ➔ `build-chain`
-            * MR !2: `build-chain` ➔ `allow-ownership-link`
-            * MR !1: `allow-ownership-link` ➔ `develop`
+            * MR !3:
+              `call-ws` ➔ `build-chain`
+            * MR !2:
+              `build-chain` ➔ `allow-ownership-link`
+            * MR !1:
+              `allow-ownership-link` ➔ `develop`
 
             <!-- end git-machete generated -->
         ''')[1:]
@@ -378,10 +383,14 @@ class TestGitLabCreateMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !4: `drop-constraint` ➔ `call-ws`
-            * MR !3: `call-ws` ➔ `build-chain`
-            * MR !2: `build-chain` ➔ `allow-ownership-link`
-            * MR !1: `allow-ownership-link` ➔ `develop`
+            * MR !4:
+              `drop-constraint` ➔ `call-ws`
+            * MR !3:
+              `call-ws` ➔ `build-chain`
+            * MR !2:
+              `build-chain` ➔ `allow-ownership-link`
+            * MR !1:
+              `allow-ownership-link` ➔ `develop`
 
             <!-- end git-machete generated -->
 
@@ -577,8 +586,10 @@ class TestGitLabCreateMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !16: `feature` ➔ `branch-1`
-            * MR !15: `branch-1` ➔ `root`
+            * MR !16:
+              `feature` ➔ `branch-1`
+            * MR !15:
+              `branch-1` ➔ `root`
 
             <!-- end git-machete generated -->
 
diff --git a/tests/test_gitlab_retarget_mr.py b/tests/test_gitlab_retarget_mr.py
index c2f7a13..a8bb248 100644
--- a/tests/test_gitlab_retarget_mr.py
+++ b/tests/test_gitlab_retarget_mr.py
@@ -273,8 +273,10 @@ class TestGitLabRetargetMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !20: `feature_1` ➔ `feature`
-            * MR !15: `feature` ➔ `master`
+            * MR !20:
+              `feature_1` ➔ `feature`
+            * MR !15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->
             # Summary''')[1:]
@@ -320,8 +322,10 @@ class TestGitLabRetargetMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !25: `feature_2` ➔ `feature`
-            * MR !15: `feature` ➔ `master`
+            * MR !25:
+              `feature_2` ➔ `feature`
+            * MR !15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->''')[1:]
 
@@ -360,9 +364,12 @@ class TestGitLabRetargetMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !30: `feature_3` ➔ `feature_2`
-            * MR !25: `feature_2` ➔ `feature`
-            * MR !15: `feature` ➔ `master`
+            * MR !30:
+              `feature_3` ➔ `feature_2`
+            * MR !25:
+              `feature_2` ➔ `feature`
+            * MR !15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->
             # Summary''')[1:]
@@ -394,8 +401,10 @@ class TestGitLabRetargetMR(BaseTest):
 
             ## Full chain of MRs as of 2023-12-31
 
-            * MR !30: `feature_3` ➔ `feature`
-            * MR !15: `feature` ➔ `master`
+            * MR !30:
+              `feature_3` ➔ `feature`
+            * MR !15:
+              `feature` ➔ `master`
 
             <!-- end git-machete generated -->
             # Summary''')[1:]