Repository: spark
Updated Branches:
  refs/heads/master fcf66a327 -> dbd492b7e


[SPARK-22921][PROJECT-INFRA] Choices for Assigning Jira on Merge

In general jiras are assigned to the original reporter or one of
the commentors.  This updates the merge script to give you a simple
choice to do that, so you don't have to do it manually.

Author: Imran Rashid <[email protected]>

Closes #20107 from squito/SPARK-22921.


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

Branch: refs/heads/master
Commit: dbd492b7e293f0bf4c13076ba21deb506c5f0969
Parents: fcf66a3
Author: Imran Rashid <[email protected]>
Authored: Fri Dec 29 07:30:49 2017 -0600
Committer: Sean Owen <[email protected]>
Committed: Fri Dec 29 07:30:49 2017 -0600

----------------------------------------------------------------------
 dev/merge_spark_pr.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/dbd492b7/dev/merge_spark_pr.py
----------------------------------------------------------------------
diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py
index 28971b8..cd5dd1e 100755
--- a/dev/merge_spark_pr.py
+++ b/dev/merge_spark_pr.py
@@ -242,6 +242,9 @@ def resolve_jira_issue(merge_branches, comment, 
default_jira_id=""):
     cur_summary = issue.fields.summary
     cur_assignee = issue.fields.assignee
     if cur_assignee is None:
+        cur_assignee = choose_jira_assignee(issue)
+    # Check again, we might not have chose an assignee
+    if cur_assignee is None:
         cur_assignee = "NOT ASSIGNED!!!"
     else:
         cur_assignee = cur_assignee.displayName
@@ -290,6 +293,31 @@ def resolve_jira_issue(merge_branches, comment, 
default_jira_id=""):
     print("Successfully resolved %s with fixVersions=%s!" % (jira_id, 
fix_versions))
 
 
+def choose_jira_assignee(issue, asf_jira):
+    """
+    Prompt the user to choose who to assign the issue to in jira, given a list 
of candidates,
+    including the original reporter and all commentors
+    """
+    reporter = issue.fields.reporter
+    commentors = map(lambda x: x.author, issue.fields.comment.comments)
+    candidates = set(commentors)
+    candidates.add(reporter)
+    candidates = list(candidates)
+    print("JIRA is unassigned, choose assignee")
+    for idx, author in enumerate(candidates):
+        annotations = ["Reporter"] if author == reporter else []
+        if author in commentors:
+            annotations.append("Commentor")
+        print("[%d] %s (%s)" % (idx, author.displayName, 
",".join(annotations)))
+    assignee = raw_input("Enter number of user to assign to (blank to leave 
unassigned):")
+    if assignee == "":
+        return None
+    else:
+        assignee = candidates[int(assignee)]
+        asf_jira.assign_issue(issue.key, assignee.key)
+        return assignee
+
+
 def resolve_jira_issues(title, merge_branches, comment):
     jira_ids = re.findall("SPARK-[0-9]{4,5}", title)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to