Overhaul project changelog links for upgrade pkg diff table
This commit is contained in:
parent
fdcf23f65f
commit
1283a794df
|
@ -288,30 +288,62 @@ class UpgradeView(MasterView):
|
|||
|
||||
commit_hash_pattern = re.compile(r'^.{40}$')
|
||||
|
||||
def get_changelog_url(self, project, old_version, new_version):
|
||||
def get_changelog_projects(self):
|
||||
projects = {
|
||||
'rattail': 'rattail',
|
||||
'Tailbone': 'tailbone',
|
||||
'pyCatapult': 'pycatapult',
|
||||
'rattail-catapult': 'rattail-catapult',
|
||||
'rattail-tempmon': 'rattail-tempmon',
|
||||
'tailbone-catapult': 'tailbone-catapult',
|
||||
'rattail': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'Tailbone': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'pyCOREPOS': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-project/pycorepos/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-project/pycorepos/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'rattail_corepos': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-corepos/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-corepos/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'tailbone_corepos': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone-corepos/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-project/tailbone-corepos/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'onager': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-restricted/onager/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-restricted/onager/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'rattail-onager': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-restricted/rattail-onager/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-restricted/rattail-onager/files/{new_version}/CHANGELOG.md',
|
||||
},
|
||||
'rattail_tempmon': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-tempmon/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-project/rattail-tempmon/files/{new_version}/CHANGES.rst',
|
||||
},
|
||||
'tailbone-onager': {
|
||||
'commit_url': 'https://kallithea.rattailproject.org/rattail-restricted/tailbone-onager/changelog/{new_version}/?size=10',
|
||||
'release_url': 'https://kallithea.rattailproject.org/rattail-restricted/tailbone-onager/files/{new_version}/CHANGELOG.md',
|
||||
},
|
||||
}
|
||||
if project not in projects:
|
||||
return projects
|
||||
|
||||
def get_changelog_url(self, project, old_version, new_version):
|
||||
projects = self.get_changelog_projects()
|
||||
|
||||
project_name = project
|
||||
if project_name not in projects:
|
||||
# cannot generate a changelog URL for unknown project
|
||||
return
|
||||
|
||||
project = projects[project_name]
|
||||
|
||||
if self.commit_hash_pattern.match(new_version):
|
||||
if new_version == old_version:
|
||||
return 'https://rattailproject.org/trac/log/{}/?rev={}&limit=100'.format(
|
||||
projects[project], new_version)
|
||||
else:
|
||||
return 'https://rattailproject.org/trac/log/{}/?rev={}&stop_rev={}&limit=100'.format(
|
||||
projects[project], new_version, old_version)
|
||||
return project['commit_url'].format(new_version=new_version, old_version=old_version)
|
||||
|
||||
elif re.match(r'^\d+\.\d+\.\d+$', new_version):
|
||||
return 'https://rattailproject.org/trac/browser/{}/CHANGES.rst?rev=v{}'.format(
|
||||
projects[project], new_version)
|
||||
else:
|
||||
return 'https://rattailproject.org/trac/browser/{}/CHANGES.rst'.format(
|
||||
projects[project])
|
||||
return project['release_url'].format(new_version=new_version, old_version=old_version)
|
||||
|
||||
def render_diff_field(self, field, diff):
|
||||
old_version = diff.old_value(field)
|
||||
|
|
Loading…
Reference in a new issue