mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-08 16:43:47 +01:00
Add commit hash to releases
This commit is contained in:
parent
ecdb755dd3
commit
8c3b1c8c95
@ -591,6 +591,7 @@ class PackageRelease(db.Model):
|
|||||||
url = db.Column(db.String(200), nullable=False)
|
url = db.Column(db.String(200), nullable=False)
|
||||||
approved = db.Column(db.Boolean, nullable=False, default=False)
|
approved = db.Column(db.Boolean, nullable=False, default=False)
|
||||||
task_id = db.Column(db.String(37), nullable=True)
|
task_id = db.Column(db.String(37), nullable=True)
|
||||||
|
commit_hash = db.Column(db.String(41), nullable=True, default=None)
|
||||||
|
|
||||||
|
|
||||||
def getEditURL(self):
|
def getEditURL(self):
|
||||||
|
@ -344,9 +344,10 @@ def makeVCSReleaseFromGithub(id, branch, release, url):
|
|||||||
if len(commits) == 0 or not "sha" in commits[0]:
|
if len(commits) == 0 or not "sha" in commits[0]:
|
||||||
raise TaskError("No commits found")
|
raise TaskError("No commits found")
|
||||||
|
|
||||||
release.url = urlmaker.getCommitDownload(commits[0]["sha"])
|
release.url = urlmaker.getCommitDownload(commits[0]["sha"])
|
||||||
|
release.task_id = None
|
||||||
|
release.commit_hash = commits[0]["sha"]
|
||||||
print(release.url)
|
print(release.url)
|
||||||
release.task_id = None
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return release.url
|
return release.url
|
||||||
@ -374,9 +375,10 @@ def makeVCSRelease(id, branch):
|
|||||||
with open(destPath, "wb") as fp:
|
with open(destPath, "wb") as fp:
|
||||||
repo.archive(fp, format="zip")
|
repo.archive(fp, format="zip")
|
||||||
|
|
||||||
release.url = "/uploads/" + filename
|
release.url = "/uploads/" + filename
|
||||||
|
release.task_id = None
|
||||||
|
release.commit_hash = repo.head.object.hexsha
|
||||||
print(release.url)
|
print(release.url)
|
||||||
release.task_id = None
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
return release.url
|
return release.url
|
||||||
|
@ -21,6 +21,10 @@
|
|||||||
Url: <a href="{{ release.url }}">{{ release.url }}</a><br />
|
Url: <a href="{{ release.url }}">{{ release.url }}</a><br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if release.commit_hash %}
|
||||||
|
Commit Hash: {{ release.commit_hash }}<br />
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if release.task_id %}
|
{% if release.task_id %}
|
||||||
Importing... <a href="{ url_for('check_task', id=release.task_id, r=release.getEditURL()) }}">view task</a><br />
|
Importing... <a href="{ url_for('check_task', id=release.task_id, r=release.getEditURL()) }}">view task</a><br />
|
||||||
{% if package.checkPerm(current_user, "CHANGE_RELEASE_URL") %}
|
{% if package.checkPerm(current_user, "CHANGE_RELEASE_URL") %}
|
||||||
|
@ -188,7 +188,8 @@
|
|||||||
<li>
|
<li>
|
||||||
{% if not rel.approved %}<i>{% endif %}
|
{% if not rel.approved %}<i>{% endif %}
|
||||||
|
|
||||||
<a href="{{ rel.url }}">{{ rel.title }}</a>,
|
<a href="{{ rel.url }}">{{ rel.title }}</a>{% if rel.commit_hash %}
|
||||||
|
[{{ rel.commit_hash | truncate(5, end='') }}]{% endif %},
|
||||||
created {{ rel.releaseDate | datetime }}.
|
created {{ rel.releaseDate | datetime }}.
|
||||||
{% if rel.task_id %}
|
{% if rel.task_id %}
|
||||||
<a href="{{ url_for('check_task', id=rel.task_id, r=package.getDetailsURL()) }}">Importing...</a>
|
<a href="{{ url_for('check_task', id=rel.task_id, r=package.getDetailsURL()) }}">Importing...</a>
|
||||||
|
28
migrations/versions/44e138485931_.py
Normal file
28
migrations/versions/44e138485931_.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
"""empty message
|
||||||
|
|
||||||
|
Revision ID: 44e138485931
|
||||||
|
Revises: 9e2ac631efb0
|
||||||
|
Create Date: 2018-07-28 14:45:28.879331
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = '44e138485931'
|
||||||
|
down_revision = '9e2ac631efb0'
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.add_column('package_release', sa.Column('commit_hash', sa.String(length=41), nullable=True, server_default=None))
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_column('package_release', 'commit_hash')
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user