Skip to content

Instantly share code, notes, and snippets.

@gazpachoking
Last active March 5, 2016 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gazpachoking/2f9c9ba49baede94b3f6 to your computer and use it in GitHub Desktop.
Save gazpachoking/2f9c9ba49baede94b3f6 to your computer and use it in GitHub Desktop.

Changelog

This is the fg changelog.

1.2.472 (2016-03-04)

all commits

Fixed

  • trakt auth cli command displays waiting message properly in all situations
  • [tvmaze API] Correctly pass LookupError. Closed #919

Changed

  • flush output buffer in console function

1.2.471 (2016-03-04)

all commits

Changed

  • Python 2.6 is no longer supported
  • Move testing suite from nose to py.test

1.2.470 (2016-03-03)

all commits

Fixed

  • [apple_trailers] bug with genres
  • task_exit phase could be skipped when hitting a task's max_reruns

Changed

  • [seen API] Reduced default return value to 10
  • [series API] Added episode pagination
  • [series API] Reduced GET default number to 10

Added

  • [series API] Added TVmaze embedd option
  • Added TVMaze series endpoint
  • [series API] Added support for lookup request embedding
  • [series API] Added in_tasks attribute to show return object

1.2.469 (2016-03-02)

all commits

Fixed

  • require account in schema in trakt_add and trakt_remove
  • [api_trakt] wrap request in try-except

Changed

  • [search_rarbg] more sensible logging, no more error spam

Added

  • [seen] Added ability to use Seen plugin with a custom list of attributes to filter by. Closes #911

1.2.468 (2016-03-01)

all commits

Fixed

  • include requirements files fixes #909

1.2.467 (2016-03-01)

all commits

Fixed

  • [series API] Correctly slice data
  • [seen API] Correctly slice method

Added

  • [trakt] Added device authorization and deprecated PIN auth
  • [TVDB API] Added episode lookup endpoint and change series lookup structure
  • [seen API] Added number of entries per page value to respone

Changed

  • api tests changed to work with pytest
  • Pagination
  • use new pytest fixtures

1.2.466 (2016-03-01)

all commits

Fixed

  • include templates in manifest for packaging closes #901 and #902

1.2.465 (2016-03-01)

all commits

Fixed

  • [series API] Fix series query logic
  • [trakt_emit] remove year from series_name before the entry is made to avoid manipulating two fields
  • [trakt_emit] also remove year from series_name

Changed

  • changed logic for pytest to use self.execute
  • [feature]Series search
  • [seen API] Change CLI to match seen search return
  • [seen API] Pass pagination logic to db
  • changed to execute plugin
  • [series API] Improve series list performance by passing pagination logic to db

Added

  • Series search

1.2.464 (2016-02-29)

all commits

Fixed

  • [ui] place log filter icon correctly
  • [trakt] code smells
  • [trakt] return the access_token
  • [trakt] removed debugging end_time
  • [seen] Make sure items added from the cli work properly. fix #879
  • [movie_queue] Fix 'clear' command. fix #894
  • fix typo
  • ui login and api auth

Changed

  • upgrade to angular material 1.0.5
  • replace nodetests with pytest
  • [trakt] split token requests into their own helper methods
  • [trakt] put device auth into its own function and changed CLI helper messages
  • [trakt] Added device authorization and deprecated PIN auth
  • [trakt_emit] add strip_dates to remove year from series names
  • [discover] release_estimations can reject entries with no release date
  • add message to ui if no password has been set

Added

    • Added ability to reset downloaded releases status in Series API

1.2.463 (2016-02-28)

all commits

Fixed

  • Include correct static files for webui

1.2.462 (2016-02-28)

all commits

1.2.461 (2016-02-28)

all commits

from __future__ import unicode_literals, print_function
import collections
import datetime
import io
import re
from git import Repo
class MDChangeSet(object):
"""Represets a markdown changeset for a single version."""
CATEGORIES = [
('### Added\n', ['add', 'added', 'feature']),
('### Changed\n', ['change', 'changed', 'update']),
('### Fixed\n', ['fix', 'fixed']),
('### Deprecated\n', ['deprecate', 'deprecated']),
('### Removed\n', ['remove', 'removed']),
]
def __init__(self):
self.pre_header = ['\n']
self.version_header = ''
self.post_header = []
self.sections = collections.OrderedDict()
self.footer = []
@classmethod
def from_md_lines(cls, lines):
"""Parse an existing markdown changeset section and return the VersionLog instance."""
instance = cls()
instance.pre_header, instance.version_header, tail = isplit('## ', lines)
instance.post_header, section, tail = isplit('### ', tail)
while section:
instance.sections[section], section, tail = isplit('### ', tail)
return instance
def parse_message(self, message):
"""Parses a git commit message and formats and adds any tagged messages to this changeset."""
for cat, item in self.change_items(message):
item = re.sub('#(\d{3,4})', r'[#\1](https://github.com/Flexget/Flexget/issues/\1)', item)
item = '- {0}\n'.format(item)
self.sections.setdefault(cat, ['\n']).insert(0, item)
def change_items(self, message):
"""An iterator of changelog updates from a commit message in the form (category, message)"""
for line in message.split('\n'):
for cat_match in re.finditer('\[(\w+)\]', line):
found_cat = self.cat_lookup(cat_match.group(1))
if found_cat:
line = line.replace(cat_match.group(0), '').strip()
yield found_cat, line
def cat_lookup(self, cat):
"""Return an official category for `cat` tag text."""
for cat_item in self.CATEGORIES:
if cat in cat_item[1]:
return cat_item[0]
def to_md_lines(self):
"""An iterator over the markdown lines representing this changeset."""
for l in self.pre_header:
yield l
yield self.version_header
for l in self.post_header:
yield l
for section, items in self.sections.items():
yield section
for item in items:
yield item
for l in self.footer:
yield l
def isplit(start_text, iterator):
"""Returns head, match, tail tuple, where match is the first line that starts with `start_text`"""
head = []
iterator = iter(iterator)
for item in iterator:
if item.startswith(start_text):
return head, item, iterator
head.append(item)
return head, None, iterator
if __name__ == '__main__':
with io.open('changelog.md', encoding='utf-8') as logfile:
pre_lines, start_comment, tail = isplit('<!---', logfile)
active_lines, end_comment, tail = isplit('<!---', tail)
post_lines = list(tail)
repo = Repo('.')
cur_ver = MDChangeSet.from_md_lines(active_lines)
latestref = re.match('<!---\s*([\d\w]+)', start_comment).group(1)
oldestref = re.match('<!---\s*([\d\w]+)', end_comment).group(1)
released_vers = []
commits = list(repo.iter_commits('{0}..HEAD'.format(latestref), reverse=True))
if commits:
tags = {}
for tag in repo.tags:
tags[tag.commit] = tag.tag
for commit in commits:
cur_ver.parse_message(commit.message)
if commit in tags:
# Tag changeset with release date and version and create new current changeset
version = tags[commit].tag
release_date = datetime.datetime.fromtimestamp(tags[commit].tagged_date).strftime('%Y-%m-%d')
cur_ver.version_header = '## {0} ({1})\n'.format(version, release_date)
cur_ver.post_header.insert(0, '[all commits](https://github.com/Flexget/Flexget/compare/{0}...{1})\n'.
format(oldestref, commit.hexsha))
released_vers.insert(0, cur_ver)
cur_ver = MDChangeSet()
oldestref = commit.hexsha
if cur_ver.sections and not cur_ver.version_header:
verfile = repo.tree('HEAD')['flexget/_version.py'].data_stream.read()
__version__ = None
try:
exec(verfile)
except Exception:
pass
cur_ver.version_header = '## {0} (unreleased)\n'.format(__version__)
with io.open('changelogo.md', 'w', encoding='utf-8') as logfile:
logfile.writelines(pre_lines)
logfile.write('<!---{0}--->\n'.format(commit.hexsha))
logfile.writelines(cur_ver.to_md_lines())
logfile.write('<!---{0}--->\n'.format(oldestref))
for ver in released_vers:
logfile.writelines(ver.to_md_lines())
logfile.writelines(post_lines)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment