[asterisk-commits] jira-release-update: Don't rely on commit message parser for... (repotools[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 9 18:02:31 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: jira-release-update: Don't rely on commit message parser for closed issues
......................................................................


jira-release-update: Don't rely on commit message parser for closed issues

The JIRA release update script updates the versions in JIRA from closed
issues. Rather than relying on the commit message to tell us that an
issue is closed - which may not be correct due to an issue being
reopened - this patch instead pulls all issues referenced in the commit
messages, then use the status of the issue in JIRA itself to decide
whether the version should be updated.

Change-Id: Ia8a87a1c75ef46992cda5f334fe2e7d0fd4cce49
---
M jira-release-update.py
1 file changed, 9 insertions(+), 5 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/jira-release-update.py b/jira-release-update.py
index e5e6735..6cd62dc 100755
--- a/jira-release-update.py
+++ b/jira-release-update.py
@@ -16,7 +16,8 @@
 from digium_jira import get_jira_client
 
 # The upstream Gerrit repo
-GERRIT = 'https://gerrit.asterisk.org'
+GERRIT = 'ssh://gerrit.asterisk.org:29418'
+
 
 def update_issues(options):
     """Update the fixVersion field in the JIRA issues
@@ -48,7 +49,7 @@
 
     for i, log_message in enumerate(log_messages):
 
-        issues = log_message.get_issues(closed=True)
+        issues = log_message.get_issues()
 
         if len(issues) == 0:
             pbar.update(i + 1)
@@ -62,6 +63,10 @@
                 print "Could not get issue {0}".format(issue_id)
                 continue
 
+            status = str(issue.fields.status).lower()
+            if status != 'closed' and status != 'complete':
+                continue
+
             # Get the actual version object for the project. This
             # is what must be passed to JIRA to update the fixVersion
             # field for the issue.
@@ -70,7 +75,7 @@
                 project_versions = jira.project_versions(project)
                 try:
                     version, = [ver.id for ver in project_versions
-                                    if ver.name == options.version]
+                                if ver.name == options.version]
                 except Exception:
                     print "Could not handle versions for {0}".format(issue_id)
                     continue
@@ -79,7 +84,7 @@
             # Make sure we don't update the fixVersion more than once for
             # a particular issue
             matches = [match for match in issue.fields.fixVersions
-                            if match.name == options.version]
+                       if match.name == options.version]
             if len(matches) == 0:
                 version_array = [{'id': u'{0}'.format(ver.id)} for ver in
                                  issue.fields.fixVersions]
@@ -91,7 +96,6 @@
     pbar.finish()
 
     return
-
 
 
 def main(argv=None):

-- 
To view, visit https://gerrit.asterisk.org/610
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia8a87a1c75ef46992cda5f334fe2e7d0fd4cce49
Gerrit-PatchSet: 1
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list