kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: KAFKA-2548; kafka-merge-pr tool fails to update JIRA with fix version 0.9.0.0
Date Thu, 24 Sep 2015 17:31:28 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 1daf6ac51 -> 8943b08c9


KAFKA-2548; kafka-merge-pr tool fails to update JIRA with fix version 0.9.0.0

Simplified the logic to choose the default fix version. We just hardcode
it for `trunk` and try to compute it based on the branch name for the
rest.

Removed logic that tries to handle forked release branches as it
seems to be specific to how the Spark project handles their JIRA.

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

Reviewers: Guozhang Wang

Closes #238 from ijuma/kafka-2548-merge-pr-tool-4-segment-fix-version


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

Branch: refs/heads/trunk
Commit: 8943b08c9fbd31f7c50d5e06934a5fc225d56460
Parents: 1daf6ac
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Thu Sep 24 10:35:05 2015 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Thu Sep 24 10:35:05 2015 -0700

----------------------------------------------------------------------
 kafka-merge-pr.py | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/8943b08c/kafka-merge-pr.py
----------------------------------------------------------------------
diff --git a/kafka-merge-pr.py b/kafka-merge-pr.py
index 7f48bf9..078708e 100644
--- a/kafka-merge-pr.py
+++ b/kafka-merge-pr.py
@@ -65,7 +65,9 @@ TEMP_BRANCH_PREFIX = "PR_TOOL"
 # TODO Introduce a convention as this is too brittle
 RELEASE_BRANCH_PREFIX = "0."
 
-DEV_BRANCH_NAME="trunk"
+DEV_BRANCH_NAME = "trunk"
+
+DEFAULT_FIX_VERSION = os.environ.get("DEFAULT_FIX_VERSION", "0.9.0.0")
 
 def get_json(url):
     try:
@@ -238,9 +240,17 @@ def cherry_pick(pr_num, merge_hash, default_branch):
 def fix_version_from_branch(branch, versions):
     # Note: Assumes this is a sorted (newest->oldest) list of un-released versions
     if branch == DEV_BRANCH_NAME:
-        return versions[0]
+        versions = filter(lambda x: x == DEFAULT_FIX_VERSION, versions)
+        if len(versions) > 0:
+            return versions[0]
+        else:
+            return None
     else:
-        return filter(lambda x: x.name.startswith(branch), versions)[-1]
+        versions = filter(lambda x: x.startswith(branch), versions)
+        if len(versions) > 0:
+            return versions[-1]
+        else:
+            return None
 
 
 def resolve_jira_issue(merge_branches, comment, default_jira_id=""):
@@ -273,20 +283,10 @@ def resolve_jira_issue(merge_branches, comment, default_jira_id=""):
     versions = asf_jira.project_versions(CAPITALIZED_PROJECT_NAME)
     versions = sorted(versions, key=lambda x: x.name, reverse=True)
     versions = filter(lambda x: x.raw['released'] is False, versions)
-    # Consider only x.y.z versions
-    versions = filter(lambda x: re.match('\d+\.\d+\.\d+', x.name), versions)
-
-    default_fix_versions = map(lambda x: fix_version_from_branch(x, versions).name, merge_branches)
-    for v in default_fix_versions:
-        # Handles the case where we have forked a release branch but not yet made the release.
-        # In this case, if the PR is committed to the master branch and the release branch,
we
-        # only consider the release branch to be the fix version. E.g. it is not valid to
have
-        # both 1.1.0 and 1.0.0 as fix versions.
-        (major, minor, patch) = v.split(".")
-        if patch == "0":
-            previous = "%s.%s.%s" % (major, int(minor) - 1, 0)
-            if previous in default_fix_versions:
-                default_fix_versions = filter(lambda x: x != v, default_fix_versions)
+
+    version_names = map(lambda x: x.name, versions)
+    default_fix_versions = map(lambda x: fix_version_from_branch(x, version_names), merge_branches)
+    default_fix_versions = filter(lambda x: x != None, default_fix_versions)
     default_fix_versions = ",".join(default_fix_versions)
 
     fix_versions = raw_input("Enter comma-separated fix version(s) [%s]: " % default_fix_versions)


Mime
View raw message