[asterisk-dev] Change in repotools[master]: Update commit_msg.py output format.

Matt Jordan (Code Review) asteriskteam at digium.com
Thu Mar 26 07:49:12 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: Update commit_msg.py output format.
......................................................................


Update commit_msg.py output format.

* Produce new syntax for linking to JIRA tickets.
* Retreive license number for patches from JIRA.
* Replace "Patches:" with "patches:".
* Replace "uploaded by" with "submitted by".
* Update digium_commits.py to recognize "submitted by".

Change-Id: If9f3a7adf2ca0d1d38d625fc5ba6922b99fb37f7
---
M commit_msg.py
M digium_commits.py
2 files changed, 18 insertions(+), 5 deletions(-)

Approvals:
  Michael L. Young: Looks good to me, but someone else must approve
  Matt Jordan: Looks good to me, approved; Verified



diff --git a/commit_msg.py b/commit_msg.py
index efb1f45..e342d47 100755
--- a/commit_msg.py
+++ b/commit_msg.py
@@ -36,9 +36,9 @@
 
 print "\nDoes this commit close issue %s? (y/n)" % (args[0],),
 if raw_input()[0] in ['y', 'Y']:
-    closes = "closes "
+    closes = "#close"
 else:
-    closes = ""
+    closes = "#comment <Enter a comment>"
 
 # This should be required
 reporter = data['fields']['reporter']['displayName']
@@ -55,7 +55,16 @@
     testers = None
 
 try:
-    attachments = ["    %s uploaded by %s" % (x['filename'], x['author']['displayName']) for x in data['fields']['attachment']]
+    attachments = []
+    for x in data['fields']['attachment']:
+        licenseid = 0
+        try:
+            con.request("GET", "/jira/rest/api/2/attachment/%s/" % x['id'])
+            res = con.getresponse()
+            licenseid = json.loads(res.read())['properties']['license']
+        except:
+            '''Supress Exception'''
+        attachments.append("    %s submitted by %s (license %d)" % (x['filename'], x['author']['name'], licenseid))
 except:
     attachments = None
     patches = None
@@ -86,14 +95,14 @@
 
 f.write("One-line summary\n\n")
 f.write("Multi-line description\n\n")
-f.write("(%sissue %s)\n" % (closes, args[0]))
+f.write("%s %s\n" % (args[0], closes))
 f.write("Reported by: %s\n" % (reporter,))
 if testers:
     f.write("Tested by: %s\n" % ", ".join(testers))
 if reviewboard_link:
     f.write("Review: %s\n" % (reviewboard_link,))
 if patches:
-    f.write("Patches:\n")
+    f.write("patches:\n")
     for patch in patches:
         f.write("%s\n" % (patch,))
 f.close()
diff --git a/digium_commits.py b/digium_commits.py
index 9b21010..c7745ee 100644
--- a/digium_commits.py
+++ b/digium_commits.py
@@ -164,8 +164,12 @@
                 patches = True
             if not patches:
                 continue
+            name = None
             if 'uploaded by' in token.lower():
                 name = token[token.lower().index('uploaded by') + 11:]
+            if 'submitted by' in token.lower():
+                name = token[token.lower().index('submitted by') + 12:]
+            if name:
                 if ':' in name:
                     name.replace(':', '')
                 if '(' in name:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If9f3a7adf2ca0d1d38d625fc5ba6922b99fb37f7
Gerrit-PatchSet: 6
Gerrit-Project: repotools
Gerrit-Branch: master
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Michael L. Young <elgueromexicano at gmail.com>



More information about the asterisk-dev mailing list