def all_versions(filename):
"""
Find, open and parse all tagged versions of a json file, including the current version
:param filename: The filename to find
:return: a dictionary of all the versions, in the form
{
'current': {...},
'1.0': {...},
'1.1': {...}
}
"""
repo = git.Repo()
versions = {
'current': get_json(filename)
}
for tag in repo.tags:
version_dict = repo.git.show('%s:%s' % (tag.name, filename))
versions[tag.name.strip('v')] = json.loads(version_dict)
return versions
评论列表
文章目录