This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 60600c8  [SPARK-28857][INFRA] Clean up the comments of PR template 
during merging
60600c8 is described below

commit 60600c8a91d1546381e3a8edd5efbb6815d71b3c
Author: Dongjoon Hyun <dh...@apple.com>
AuthorDate: Fri Aug 23 18:08:10 2019 +0900

    [SPARK-28857][INFRA] Clean up the comments of PR template during merging
    
    ### What changes were proposed in this pull request?
    
    This PR aims to clean up the commit logs by removing the comments of our PR 
template.
    
    ### Why are the changes needed?
    
    Apache Spark PR template has comments. Sometime we forget to clean up them 
because GitHub hides them nicely. It would be great if we clean up this. 
Otherwise, this makes the commit logs too verbose. (There are a few commits 
already.)
    
    ### Does this PR introduce any user-facing change?
    
    No. (only for committers)
    
    ### How was this patch tested?
    
    Manually with Python2/Python3.
    
    Closes #25564 from dongjoon-hyun/SPARK-28857.
    
    Authored-by: Dongjoon Hyun <dh...@apple.com>
    Signed-off-by: HyukjinKwon <gurwls...@apache.org>
    (cherry picked from commit 1fd7f290aba421d86e8afd19a23d2482d6a8106b)
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 dev/merge_spark_pr.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index 03ff428..2bac395 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -475,7 +475,24 @@ def main():
     else:
         title = pr["title"]
 
-    body = pr["body"]
+    modified_body = re.sub(re.compile(r'<!--[^>]*-->\n?', re.DOTALL), '', 
pr["body"]).lstrip()
+    if modified_body != pr["body"]:
+        print("=" * 80)
+        print(modified_body)
+        print("=" * 80)
+        print("I've removed the comments from PR template like the above:")
+        result = input("Would you like to use the modified body? (y/n): ")
+        if result.lower() == "y":
+            body = modified_body
+            print("Using modified body:")
+        else:
+            body = pr["body"]
+            print("Using original body:")
+        print("=" * 80)
+        print(body)
+        print("=" * 80)
+    else:
+        body = pr["body"]
     target_ref = pr["base"]["ref"]
     user_login = pr["user"]["login"]
     base_ref = pr["head"]["ref"]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to