You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@parquet.apache.org by ti...@apache.org on 2014/09/11 01:13:29 UTC
git commit: PARQUET-24: enforce JIRA prefix
Repository: incubator-parquet-mr
Updated Branches:
refs/heads/master fbe458f84 -> 8d878afb4
PARQUET-24: enforce JIRA prefix
Author: julien <ju...@twitter.com>
Closes #54 from julienledem/PARQUET-24 and squashes the following commits:
d444f2f [julien] add option to not close JIRA
00d4b13 [julien] fix close jira
7cf9bb3 [julien] enforce JIRA prefix
Project: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/commit/8d878afb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/tree/8d878afb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/diff/8d878afb
Branch: refs/heads/master
Commit: 8d878afb497810ceb34a0b8a4788914d9debf74b
Parents: fbe458f
Author: julien <ju...@twitter.com>
Authored: Wed Sep 10 16:13:20 2014 -0700
Committer: Tianshuo Deng <td...@twitter.com>
Committed: Wed Sep 10 16:13:20 2014 -0700
----------------------------------------------------------------------
dev/merge_parquet_pr.py | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-parquet-mr/blob/8d878afb/dev/merge_parquet_pr.py
----------------------------------------------------------------------
diff --git a/dev/merge_parquet_pr.py b/dev/merge_parquet_pr.py
index 413f2df..524fe9f 100755
--- a/dev/merge_parquet_pr.py
+++ b/dev/merge_parquet_pr.py
@@ -31,6 +31,7 @@ import subprocess
import sys
import tempfile
import urllib2
+import getpass
try:
import jira.client
@@ -210,15 +211,27 @@ def fix_version_from_branch(branch, versions):
branch_ver = branch.replace("branch-", "")
return filter(lambda x: x.name.startswith(branch_ver), versions)[-1]
+def exctract_jira_id(title):
+ m = re.search('^(PARQUET-[0-9]+):.*$', title)
+ if m and m.groups > 0:
+ return m.group(1)
+ else:
+ fail("PR title should be prefixed by a jira id \"PARQUET-XXX: ...\", found: \"%s\"" % title)
+
+def check_jira(title):
+ jira_id = exctract_jira_id(title)
+ asf_jira = jira.client.JIRA({'server': JIRA_API_BASE},
+ basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))
+ try:
+ issue = asf_jira.issue(jira_id)
+ except Exception as e:
+ fail("ASF JIRA could not find %s\n%s" % (jira_id, e))
def resolve_jira(title, merge_branches, comment):
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]
+ default_jira_id = exctract_jira_id(title)
jira_id = raw_input("Enter a JIRA id [%s]: " % default_jira_id)
if jira_id == "":
@@ -281,7 +294,7 @@ if not JIRA_USERNAME:
JIRA_USERNAME = raw_input("Env JIRA_USERNAME not set, please enter your JIRA username:")
if not JIRA_PASSWORD:
- JIRA_PASSWORD = raw_input("Env JIRA_PASSWORD not set, please enter your JIRA password:")
+ JIRA_PASSWORD = getpass.getpass("Env JIRA_PASSWORD not set, please enter your JIRA password:")
branches = get_json("%s/branches" % GITHUB_API_BASE)
branch_names = filter(lambda x: x.startswith("branch-"), [x['name'] for x in branches])
@@ -294,6 +307,7 @@ pr = get_json("%s/pulls/%s" % (GITHUB_API_BASE, pr_num))
url = pr["url"]
title = pr["title"]
+check_jira(title)
body = pr["body"]
target_ref = pr["base"]["ref"]
user_login = pr["user"]["login"]
@@ -334,7 +348,7 @@ while raw_input("\n%s (y/n): " % pick_prompt).lower() == "y":
merged_refs = merged_refs + [cherry_pick(pr_num, merge_hash, latest_branch)]
if JIRA_IMPORTED:
- continue_maybe("Would you like to update an associated JIRA?")
+ continue_maybe("Would you like to update the 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)
else: