Serve commit page entirely from the db

This commit is contained in:
Joscha 2023-08-06 11:37:22 +02:00
parent 0d3cd15b03
commit 7768e4ad4b
12 changed files with 241 additions and 79 deletions

View file

@ -2,6 +2,26 @@
{% block title %}{{ summary }}{% endblock %}
{% macro r_class(reachable) %}
{%- if reachable == 0 -%}
orphaned
{%- else if reachable == 1 -%}
reachable
{%- else -%}
tracked
{%- endif -%}
{% endmacro %}
{% macro r_title(reachable) %}
{%- if reachable == 0 -%}
This commit is orphaned. It can't be reached from any ref.
{%- else if reachable == 1 -%}
This commit can only be reached from untracked refs.
{%- else -%}
This commit can be reached from a tracked ref.
{%- endif -%}
{% endmacro %}
{% block body %}
<h2>Commit</h2>
<div class="commit">
@ -20,20 +40,19 @@
<dd>{{ commit_date }}</dd>
{% for commit in parents %}
<dt>Parent:</dt>
<dd><a href="{{ commit.hash }}">{{ commit.description }}</a></dd>
<dt class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">Parent:</dt>
<dd class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">
<a href="{{ commit.hash }}">{{ commit.description }}</a>
</dd>
{% endfor %}
{% for commit in children %}
{% if commit.tracked %}
<dt>Child:</dt>
<dd><a href="{{ commit.hash }}">{{ commit.description }}</a></dd>
{% else %}
<dt class="untracked">Child:</dt>
<dd class="untracked"><a href="{{ commit.hash }}">{{ commit.description }}</a></dd>
{% endif %}
<dt class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">Child:</dt>
<dd class="{% call r_class(commit.reachable) %}" title="{% call r_title(commit.reachable) %}">
<a href="{{ commit.hash }}">{{ commit.description }}</a>
</dd>
{% endfor %}
</dl>
<pre class="message">{{ message }}</pre>
<pre class="message {% call r_class(reachable) %}" title="{% call r_title(reachable) %}">{{ message }}</pre>
</div>
{% endblock %}