kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-2430; Listing of PR commits in commit message should be optional
Date Thu, 13 Aug 2015 17:33:44 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 78685dc16 -> e2ebae809


KAFKA-2430; Listing of PR commits in commit message should be optional

If there is a single commit in the PR, then it's never listed.

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Guozhang Wang

Closes #136 from ijuma/kafka-2430-optional-listing-commits and squashes the following commits:

64f1aec [Ismael Juma] Listing of PR commits in commit message should be optional


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/e2ebae80
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/e2ebae80
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/e2ebae80

Branch: refs/heads/trunk
Commit: e2ebae80982c45c65f709efaedd89d10e109600f
Parents: 78685dc
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Thu Aug 13 10:35:09 2015 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Thu Aug 13 10:35:09 2015 -0700

----------------------------------------------------------------------
 kafka-merge-pr.py | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/e2ebae80/kafka-merge-pr.py
----------------------------------------------------------------------
diff --git a/kafka-merge-pr.py b/kafka-merge-pr.py
index 5e8cbf5..7f48bf9 100644
--- a/kafka-merge-pr.py
+++ b/kafka-merge-pr.py
@@ -140,7 +140,16 @@ def merge_pr(pr_num, target_ref, title, body, pr_repo_desc):
         "Enter reviewers in the format of \"name1 <email1>, name2 <email2>\":
").strip()
 
     commits = run_cmd(['git', 'log', 'HEAD..%s' % pr_branch_name,
-                      '--pretty=format:%h [%an] %s']).split("\n\n")
+                      '--pretty=format:%h [%an] %s']).split("\n")
+    
+    if len(commits) > 1:
+        result = raw_input("List pull request commits in squashed commit message? (y/n):
")
+        if result.lower() == "y":
+          should_list_commits = True
+        else:
+          should_list_commits = False
+    else:
+        should_list_commits = False
 
     merge_message_flags = []
 
@@ -165,11 +174,13 @@ def merge_pr(pr_num, target_ref, title, body, pr_repo_desc):
         merge_message_flags += ["-m", message]
 
     # The string "Closes #%s" string is required for GitHub to correctly close the PR
-    merge_message_flags += [
-        "-m",
-        "Closes #%s from %s and squashes the following commits:" % (pr_num, pr_repo_desc)]
-    for c in commits:
-        merge_message_flags += ["-m", c]
+    close_line = "Closes #%s from %s" % (pr_num, pr_repo_desc)
+    if should_list_commits:
+        close_line += " and squashes the following commits:"
+    merge_message_flags += ["-m", close_line]
+
+    if should_list_commits:
+        merge_message_flags += ["-m", "\n".join(commits)]
 
     run_cmd(['git', 'commit', '--author="%s"' % primary_author] + merge_message_flags)
 


Mime
View raw message