diff options
author | Takayuki Hasegawa <takayuki.hasegawa0311@gmail.com> | 2014-11-29 23:12:10 -0500 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-11-29 23:12:10 -0500 |
commit | 4316a7b0103977a2a1547e28cd04c842d9839f1e (patch) | |
tree | 079fbaabe7f97a100216e0ed195993852837a837 /dev | |
parent | c06222427f866fe216d819bbf4eba7b1c834835c (diff) | |
download | spark-4316a7b0103977a2a1547e28cd04c842d9839f1e.tar.gz spark-4316a7b0103977a2a1547e28cd04c842d9839f1e.tar.bz2 spark-4316a7b0103977a2a1547e28cd04c842d9839f1e.zip |
SPARK-4507: PR merge script should support closing multiple JIRA tickets
This will fix SPARK-4507.
For pull requests that reference multiple JIRAs in their titles, it would be helpful if the PR merge script offered to close all of them.
Author: Takayuki Hasegawa <takayuki.hasegawa0311@gmail.com>
Closes #3428 from hase1031/SPARK-4507 and squashes the following commits:
bf6d64b [Takayuki Hasegawa] SPARK-4507: try to resolve issue when no JIRAs in title
401224c [Takayuki Hasegawa] SPARK-4507: moved codes as before
ce89021 [Takayuki Hasegawa] SPARK-4507: PR merge script should support closing multiple JIRA tickets
Diffstat (limited to 'dev')
-rwxr-xr-x | dev/merge_spark_pr.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py index 02ac20984a..dfa924d2aa 100755 --- a/dev/merge_spark_pr.py +++ b/dev/merge_spark_pr.py @@ -214,15 +214,10 @@ def fix_version_from_branch(branch, versions): return filter(lambda x: x.name.startswith(branch_ver), versions)[-1] -def resolve_jira(title, merge_branches, comment): +def resolve_jira_issue(merge_branches, comment, default_jira_id=""): asf_jira = jira.client.JIRA({'server': JIRA_API_BASE}, basic_auth=(JIRA_USERNAME, JIRA_PASSWORD)) - default_jira_id = "" - search = re.findall("SPARK-[0-9]{4,5}", title) - if len(search) > 0: - default_jira_id = search[0] - jira_id = raw_input("Enter a JIRA id [%s]: " % default_jira_id) if jira_id == "": jira_id = default_jira_id @@ -280,6 +275,15 @@ def resolve_jira(title, merge_branches, comment): print "Succesfully resolved %s with fixVersions=%s!" % (jira_id, fix_versions) +def resolve_jira_issues(title, merge_branches, comment): + jira_ids = re.findall("SPARK-[0-9]{4,5}", title) + + if len(jira_ids) == 0: + resolve_jira_issue(merge_branches, comment) + for jira_id in jira_ids: + resolve_jira_issue(merge_branches, comment, jira_id) + + branches = get_json("%s/branches" % GITHUB_API_BASE) branch_names = filter(lambda x: x.startswith("branch-"), [x['name'] for x in branches]) # Assumes branch names can be sorted lexicographically @@ -338,7 +342,7 @@ if JIRA_IMPORTED: 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(title, merged_refs, jira_comment) + resolve_jira_issues(title, merged_refs, jira_comment) else: print "JIRA_USERNAME and JIRA_PASSWORD not set" print "Exiting without trying to close the associated JIRA." |