Repository: kafka Updated Branches: refs/heads/trunk 23a36eb54 -> b152c0604
KAFKA-2384: Override commit message title in kafka-merge-pr.py Author: Ismael Juma <ism...@juma.me.uk> Reviewers: Guozhang Closes #105 from ijuma/kafka-2384-override-commit-message-title and squashes the following commits: e042242 [Ismael Juma] Support overriding of commit message title in kafka-merge-pr.py Project: http://git-wip-us.apache.org/repos/asf/kafka/repo Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/b152c060 Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/b152c060 Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/b152c060 Branch: refs/heads/trunk Commit: b152c0604cdce8882028b62601916b5d2b82d6a5 Parents: 23a36eb Author: Ismael Juma <ism...@juma.me.uk> Authored: Mon Aug 3 13:08:57 2015 -0700 Committer: Guozhang Wang <wangg...@gmail.com> Committed: Mon Aug 3 13:08:57 2015 -0700 ---------------------------------------------------------------------- kafka-merge-pr.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kafka/blob/b152c060/kafka-merge-pr.py ---------------------------------------------------------------------- diff --git a/kafka-merge-pr.py b/kafka-merge-pr.py index 876f530..576d315 100644 --- a/kafka-merge-pr.py +++ b/kafka-merge-pr.py @@ -380,22 +380,24 @@ def main(): url = pr["url"] + pr_title = pr["title"] + commit_title = raw_input("Commit title [%s]: " % pr_title) + if commit_title == "": + commit_title = pr_title + # Decide whether to use the modified title or not - modified_title = standardize_jira_ref(pr["title"]) - if modified_title != pr["title"]: + modified_title = standardize_jira_ref(commit_title) + if modified_title != commit_title: print "I've re-written the title as follows to match the standard format:" - print "Original: %s" % pr["title"] + print "Original: %s" % commit_title print "Modified: %s" % modified_title result = raw_input("Would you like to use the modified title? (y/n): ") if result.lower() == "y": - title = modified_title + commit_title = modified_title print "Using modified title:" else: - title = pr["title"] print "Using original title:" - print title - else: - title = pr["title"] + print commit_title body = pr["body"] target_ref = pr["base"]["ref"] @@ -428,13 +430,13 @@ def main(): continue_maybe(msg) print ("\n=== Pull Request #%s ===" % pr_num) - print ("title\t%s\nsource\t%s\ntarget\t%s\nurl\t%s" % ( - title, pr_repo_desc, target_ref, url)) + print ("PR title\t%s\nCommit title\t%s\nSource\t\t%s\nTarget\t\t%s\nURL\t\t%s" % ( + pr_title, commit_title, pr_repo_desc, target_ref, url)) continue_maybe("Proceed with merging pull request #%s?" % pr_num) merged_refs = [target_ref] - merge_hash = merge_pr(pr_num, target_ref, title, body, pr_repo_desc) + merge_hash = merge_pr(pr_num, target_ref, commit_title, body, pr_repo_desc) pick_prompt = "Would you like to pick %s into another branch?" % merge_hash while raw_input("\n%s (y/n): " % pick_prompt).lower() == "y": @@ -444,7 +446,7 @@ def main(): if JIRA_USERNAME and JIRA_PASSWORD: continue_maybe("Would you like to update an associated JIRA?") jira_comment = "Issue resolved by pull request %s\n[%s/%s]" % (pr_num, GITHUB_BASE, pr_num) - resolve_jira_issues(title, merged_refs, jira_comment) + resolve_jira_issues(commit_title, merged_refs, jira_comment) else: print "JIRA_USERNAME and JIRA_PASSWORD not set" print "Exiting without trying to close the associated JIRA."