Repository: kafka
Updated Branches:
  refs/heads/trunk fd3b4cc41 -> 18adec7ed


KAFKA-2344; kafka-merge-pr improvements

The first 4 commits are adapted from changes that have been done to the Spark 
version and the last one is the feature that gwenshap asked for.

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

Reviewers: Gwen Shapira <csh...@gmail.com>

Closes #90 from ijuma/kafka-2344-merge-pr-improvements and squashes the 
following commits:

900c371 [Ismael Juma] Allow reviewers to be entered during merge
ac06347 [Ismael Juma] Allow primary author to be overridden during merge
b309829 [Ismael Juma] Set JIRA resolution to "Fixed" instead of relying on 
default transition
0c69a64 [Ismael Juma] Check return value of doctest.testmod()
061cdce [Ismael Juma] Fix instructions on how to install the `jira-python` 
library


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

Branch: refs/heads/trunk
Commit: 18adec7ed5ad71eb73171aff0e0c82d627cfa5d5
Parents: fd3b4cc
Author: Ismael Juma <ism...@juma.me.uk>
Authored: Thu Jul 23 08:46:47 2015 -0700
Committer: Gwen Shapira <csh...@gmail.com>
Committed: Thu Jul 23 08:46:47 2015 -0700

----------------------------------------------------------------------
 kafka-merge-pr.py | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/18adec7e/kafka-merge-pr.py
----------------------------------------------------------------------
diff --git a/kafka-merge-pr.py b/kafka-merge-pr.py
index c6ef3df..876f530 100644
--- a/kafka-merge-pr.py
+++ b/kafka-merge-pr.py
@@ -130,7 +130,15 @@ def merge_pr(pr_num, target_ref, title, body, 
pr_repo_desc):
                              '--pretty=format:%an <%ae>']).split("\n")
     distinct_authors = sorted(set(commit_authors),
                               key=lambda x: commit_authors.count(x), 
reverse=True)
-    primary_author = distinct_authors[0]
+    primary_author = raw_input(
+        "Enter primary author in the format of \"name <email>\" [%s]: " %
+        distinct_authors[0])
+    if primary_author == "":
+        primary_author = distinct_authors[0]
+
+    reviewers = raw_input(
+        "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")
 
@@ -146,6 +154,9 @@ def merge_pr(pr_num, target_ref, title, body, pr_repo_desc):
 
     merge_message_flags += ["-m", authors]
 
+    if (reviewers != ""):
+        merge_message_flags += ["-m", "Reviewers: %s" % reviewers]
+
     if had_conflicts:
         committer_name = run_cmd("git config --get user.name").strip()
         committer_email = run_cmd("git config --get user.email").strip()
@@ -278,7 +289,10 @@ def resolve_jira_issue(merge_branches, comment, 
default_jira_id=""):
     jira_fix_versions = map(lambda v: get_version_json(v), fix_versions)
 
     resolve = filter(lambda a: a['name'] == "Resolve Issue", 
asf_jira.transitions(jira_id))[0]
-    asf_jira.transition_issue(jira_id, resolve["id"], 
fixVersions=jira_fix_versions, comment=comment)
+    resolution = filter(lambda r: r.raw['name'] == "Fixed", 
asf_jira.resolutions())[0]
+    asf_jira.transition_issue(
+        jira_id, resolve["id"], fixVersions = jira_fix_versions,
+        comment = comment, resolution = {'id': resolution.raw['id']})
 
     print "Successfully resolved %s with fixVersions=%s!" % (jira_id, 
fix_versions)
 
@@ -435,11 +449,13 @@ def main():
             print "JIRA_USERNAME and JIRA_PASSWORD not set"
             print "Exiting without trying to close the associated JIRA."
     else:
-        print "Could not find jira-python library. Run 'sudo pip install 
jira-python' to install."
+        print "Could not find jira-python library. Run 'sudo pip install jira' 
to install."
         print "Exiting without trying to close the associated JIRA."
 
 if __name__ == "__main__":
     import doctest
-    doctest.testmod()
+    (failure_count, test_count) = doctest.testmod()
+    if (failure_count):
+        exit(-1)
 
     main()

Reply via email to