Tweak changelog URL config for upgrade pkg diff table

This commit is contained in:
Lance Edgar 2020-09-05 17:49:46 -05:00
parent b9cf911688
commit 34ab56247b

View file

@ -3,8 +3,6 @@
Upgrade views Upgrade views
""" """
from __future__ import unicode_literals, absolute_import
import re import re
from tailbone.views import upgrades as base from tailbone.views import upgrades as base
@ -12,23 +10,17 @@ from tailbone.views import upgrades as base
class UpgradeView(base.UpgradeView): class UpgradeView(base.UpgradeView):
def get_changelog_url(self, project, old_version, new_version): def get_changelog_projects(self):
projects = super(UpgradeView, self).get_changelog_projects()
if project == 'rattail-demo': projects.update({
if self.commit_hash_pattern.match(new_version): 'rattail_demo': {
if new_version == old_version: 'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-demo/changelog/{new_version}/?size=10',
return 'https://rattailproject.org/trac/log/rattail-demo/?rev={}&limit=100'.format( 'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-demo/files/{new_version}/CHANGES.rst',
new_version) },
else: })
return 'https://rattailproject.org/trac/log/rattail-demo/?rev={}&stop_rev={}&limit=100'.format(
new_version, old_version)
elif re.match(r'^\d+\.\d+\.\d+$', new_version):
return 'https://rattailproject.org/trac/browser/rattail-demo/CHANGES.rst?rev=v{}'.format(
new_version)
else:
return 'https://rattailproject.org/trac/browser/rattail-demo/CHANGES.rst'
return super(UpgradeView, self).get_changelog_url(project, old_version, new_version) return projects
def includeme(config): def includeme(config):