incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [01/50] git commit: [#6422] Improve changelog script to reduce API requests
Date Tue, 22 Oct 2013 21:50:11 GMT
Updated Branches:
  refs/heads/cj/6422 8c89156a3 -> ce4317caa (forced update)


[#6422] Improve changelog script to reduce API requests

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/5915cdd6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/5915cdd6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/5915cdd6

Branch: refs/heads/cj/6422
Commit: 5915cdd6be4ca27e635a5196b693a306f086fbf3
Parents: 99ae2e0
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Wed Oct 9 15:23:39 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Oct 9 15:24:26 2013 +0000

----------------------------------------------------------------------
 scripts/changelog.py | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5915cdd6/scripts/changelog.py
----------------------------------------------------------------------
diff --git a/scripts/changelog.py b/scripts/changelog.py
index 02eabd0..2d6a40d 100755
--- a/scripts/changelog.py
+++ b/scripts/changelog.py
@@ -25,7 +25,7 @@ from datetime import datetime
 
 
 CHANGELOG = 'CHANGES'
-API_URL = 'http://sourceforge.net/rest/p/allura/tickets/{0}'
+API_URL = 'http://sourceforge.net/rest/p/allura/tickets/search?q=ticket_num:({0})'
 
 
 def main():
@@ -43,20 +43,18 @@ def get_tickets(from_ref, to_ref):
     ticket_nums = set()
     ref_spec = '..'.join([from_ref, to_ref])
     for commit in repo.iter_commits(ref_spec):
-        match = re.match(r'\s*\[#([^]]*)\]', commit.summary)
+        match = re.match(r'\s*\[#(\d+)\]', commit.summary)
         if match:
             ticket_nums.add(match.group(1))
     return list(ticket_nums)
 
 def get_ticket_summaries(tickets):
     summaries = {}
-    for ticket in tickets:
-        r = requests.get(API_URL.format(ticket))
-        if r.status_code == 401:
-            continue  # skip private tickets
-        if r.status_code != 200:
-            raise ValueError('Unexpected response code: {}'.format(r.status_code))
-        summaries[ticket] = r.json()['ticket']['summary']
+    r = requests.get(API_URL.format(' '.join(tickets)))
+    if r.status_code != 200:
+        raise ValueError('Unexpected response code: {0}'.format(r.status_code))
+    for ticket in r.json()['tickets']:
+        summaries[ticket['ticket_num']] = ticket['summary']
     return summaries
 
 def print_changelog(version, summaries):


Mime
View raw message