Skip to content

Commit

Permalink
Add links to upgrade actions in the change log
Browse files Browse the repository at this point in the history
  • Loading branch information
gazpachoking committed Sep 9, 2013
1 parent 270b6f2 commit 4235543
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion gen-changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import sys

import dateutil.parser
import requests

from flexget.utils.soup import get_soup

out_path = 'ChangeLog'
if len(sys.argv) > 1:
Expand All @@ -18,6 +21,9 @@
sys.exit(1)
out_path = sys.argv[1]

ua_response = requests.get('http://flexget.com/wiki/UpgradeActions')
ua_soup = get_soup(ua_response.text)

# 1.0.3280 was last revision on svn
git_log_output = subprocess.check_output(['git', 'log', '--pretty=%n---%n.%d%n%ci%n%h%n%s%n%-b%n---%n',
'--topo-order', '--decorate=full','refs/tags/1.0.3280..HEAD'])
Expand All @@ -31,7 +37,12 @@
commit_hash = next(git_log_iter)
body = list(iter(git_log_iter.next, '---'))
if tag:
out_file.write('\n=== %s (%s) ===\n\n' % (tag.group(1), date.strftime('%Y.%m.%d')))
ver = tag.group(1)
ua_link = ''
result = ua_soup.find('h3', text=re.compile(re.escape(ver)))
if result:
ua_link = '^[wiki:UpgradeActions#%s upgrade actions]^ ' % result['id']
out_file.write('\n=== %s (%s) %s===\n\n' % (ver, date.strftime('%Y.%m.%d'), ua_link))
out_file.write(' * (%s) %s\n' % (commit_hash, '[[BR]]\n '.join(body)))


Expand Down

0 comments on commit 4235543

Please sign in to comment.