Commit 25d3882e authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[utils][commands][install] Make link_contribution_versions aware of author

This avoids the need to have a dedicated version of Database
as well as ProtocolTemplates
parent 837dcc81
......@@ -901,33 +901,20 @@ def upload_dispatcher(prefix, project, type, name, data):
return True
def link_database_versions():
"""Link object versions together"""
from ....databases.models import Database
for obj in Database.objects.all():
if obj.version > 1:
# search for similar
existing = Database.objects.get(, version=obj.version - 1)"Linking database `%s' -> `%s' (version)", obj, existing)
obj.previous_version = existing
except Database.DoesNotExist:
pass # ignores
def link_contribution_versions(klass):
"""Link object versions together"""
for obj in klass.objects.all():
if obj.version > 1:
# search for similar
args = {"name":, "version": obj.version - 1}
if hasattr(obj, "author"):
args["author"] =
existing = klass.objects.get(,, version=obj.version - 1
existing = klass.objects.get(**args)
"Linking %s `%s' -> `%s' (version)",
......@@ -995,7 +982,10 @@ def install_contributions(source_prefix, project, template_data, db_root_file=No
if k in db_root:
template_data["root_folder"] = db_root[k]
upload_dispatcher(source_prefix, project, "databases", k, template_data)
from ....databases.models import Database
for k in list_objects(source_prefix, project, "toolchains", "*.json"):
upload_dispatcher(source_prefix, project, "toolchains", k, template_data)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment