{% extends "repo_master.html" %} {% block title %}Commit - {{ repo.namespace + '/' if repo.namespace }}{{ repo.name }} - {{ commitid }}{% endblock %} {% set tag = "commit"%} {% block header %} {% if splitview %} {% endif %} {% endblock %} {% block repo %} {% set splitted_message = commit.message.split('\n') %} {# we recognize non-executable file, executable file and symlink #} {% set expected_modes = [33188, 33261, 40960] %}
{% block overviewtabs %}{{ super() }}{% endblock %}

{{ commitid|short }} {{ splitted_message[0] }}

{% if commit.author| author2user == commit.committer| author2user %} {% if commit.parents | length == 1 %} Authored and Committed by {{ commit.author | author2user |safe }} {% else %} Merged and Committed by {{ commit.author | author2user |safe }} {% endif %} {{ commit.commit_time | humanize_tooltip | safe }} {% else %} {{ diff|count}} file{{'s' if diff|count > 1 }} {% if commit.parents | length == 1 %} Authored by {{ commit.author | author2user |safe }} {% else %} Merged by {{ commit.author | author2user |safe }} {% endif %} {{ commit.commit_time | humanize_tooltip | safe }}, Committed by {{ commit.committer | author2user |safe }} {{ commit.commit_time | humanize_tooltip | safe }}, {% endif%}
raw patch tree {% if commit.parents|length == 1 %} parent {% elif commit.parents|length > 1 %}
{% endif%}
{% macro changeschangedfile(filepath, added, removed, diffanchor) -%}
{{ filepath | unicode }}
file modified
+{{added}} -{{removed}}
{%- endmacro %} {% macro changesrenamedfile(oldfilepath, newfilepath, added, removed, diffanchor) -%}
{{ newfilepath | unicode }}{{ oldfilepath | unicode }}
file renamed
+{{added}} -{{removed}}
{%- endmacro %} {% macro changesdeletedfile(filepath, added, removed, diffanchor) -%}
{{filepath | unicode }}
file removed
-{{removed}}
{%- endmacro %} {% macro changesaddedfile(filepath, added, removed, diffanchor) -%}
{{filepath | unicode }}
file added
+{{added}}
{%- endmacro %}
{{diff.stats.files_changed}} file{{'s' if diff.stats.files_changed > 1 }} changed. {{diff.stats.insertions}} lines added. {{diff.stats.deletions}} lines removed.
{% for patch in diff %} {% set linesadded = patch.line_stats[1] %} {% set linesremoved = patch.line_stats[2] %} {% if patch | hasattr('new_file_path') %} {%- if patch.new_file_path == patch.old_file_path -%} {%- if patch.status == 'D' -%} {{ changesdeletedfile(patch.new_file_path, linesadded, linesremoved, loop.index) }} {%- elif patch.status == 'A' -%} {{ changesaddedfile(patch.new_file_path | string, linesadded, linesremoved, loop.index) }} {%- elif patch.status == 'M' -%} {{ changeschangedfile(patch.new_file_path, linesadded, linesremoved, loop.index) }} {%-endif-%} {%- else -%} {{changesrenamedfile(patch.old_file_path, patch.new_file_path, linesadded, linesremoved, loop.index)}} {%- endif -%} {%- elif patch | hasattr('delta') -%} {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} {%- if patch.delta.new_file.mode == 0 and patch.delta.old_file.mode in expected_modes -%} {{ changesdeletedfile(patch.delta.new_file.path, linesadded, linesremoved, loop.index) }} {%- elif patch.delta.new_file.mode in expected_modes and patch.delta.old_file.mode == 0 -%} {{ changesaddedfile( patch.delta.new_file.path, linesadded, linesremoved, loop.index) }} {%- elif patch.delta.new_file.mode in expected_modes and patch.delta.old_file.mode in expected_modes -%} {{ changeschangedfile(patch.delta.new_file.path, linesadded, linesremoved, loop.index) }} {%-endif-%} {%- else -%} {{changesrenamedfile(patch.delta.old_file.path, patch.delta.new_file.path, linesadded, linesremoved, loop.index)}} {%- endif -%} {%- endif -%} {% endfor %}
{% if splitted_message|length > 1 %}
            {% for message in splitted_message %}
    {{ message | linkify | safe}}
            {% endfor %}
        
{% endif %}
{% if flags %}
    {% for flag in flags %}
  • {{ flag.username }}
    {{- flag.status -}} {%- if flag.percent %} ({{ flag.percent }}%) {%- endif -%}
    {{ flag.comment }}
    {{ flag.date_updated | humanize_tooltip | safe }}
  • {% endfor %}
{% endif %} {% if diff %} {% for patch in diff %} {% if patch |hasattr('new_id') %} {% set patch_new_id = patch.new_id %} {% elif patch |hasattr('delta') %} {% set patch_new_id = patch.delta.new_file.id %} {% else %} {% set patch_new_id = patch.new_oid %} {% endif %} {% if patch |hasattr('old_id') %} {% set patch_old_id = patch.old_id %} {% elif patch |hasattr('delta') %} {% set patch_old_id = patch.delta.old_file.id %} {% else %} {% set patch_old_id = patch.old_oid %} {% endif %} {% if patch | hasattr('new_file_path') %} {% set patch_new_file_path = patch.new_file_path -%} {% if patch.new_file_path != patch.old_file_path %} {% set patch_old_file_path = patch.old_file_path %} {%- endif -%} {%- elif patch | hasattr('delta') -%} {% set patch_new_file_path = patch.delta.new_file.path -%} {%- if patch.delta.new_file.path != patch.delta.old_file.path -%} {% set patch_old_file_path = patch.delta.old_file.path %} {%- endif -%} {%- endif -%}
{% set linesadded = patch.line_stats[1] %} {% set linesremoved = patch.line_stats[2] %} {% macro lineschanged(added, removed) -%}
{%if added%} +{{linesadded}} {%endif%} {%if removed%} -{{linesremoved}} {%endif%}
{%endmacro%} {% macro viewfilelink(filepath)%} {{ filepath | unicode }} {% endmacro %} {% macro viewfilelinkbutton(filepath, disabled=False)%} {% endmacro %} {% macro changedlabel(thelabel, thecolor)%}
{{- thelabel -}}
{% endmacro %} {% macro diffcollapsebtn()%} {% endmacro %} {% if patch | hasattr('new_file_path') %} {%- if patch.new_file_path == patch.old_file_path -%} {%- if patch.status == 'D' -%} {% set patchtype = "removed"%}
{{ viewfilelink(patch.new_file.path) }}
{{ changedlabel("file removed", "danger")}} {{ lineschanged(False, True) }} {{ viewfilelinkbutton(patch.new_file.path, disabled=True) }} {{ diffcollapsebtn() }}
{%-elif patch.status == 'A' -%} {% set patchtype = "added"%}
{{ viewfilelink(patch.new_file.path) }}
{{ changedlabel("file added", "success")}} {{ lineschanged(True, False) }} {{ viewfilelinkbutton(patch.new_file.path) }} {% if linesadded != 0%} {{ diffcollapsebtn() }} {% endif %}
{%-elif patch.status == 'M' -%} {% set patchtype = "changed"%}
{{ viewfilelink(patch.new_file.path) }}
{{ changedlabel("file modified", "secondary")}} {{ lineschanged(True, True) }} {{ viewfilelinkbutton(patch.new_file.path) }} {{ diffcollapsebtn() }}
{%-endif-%} {%- else -%} {% set patchtype = "moved"%}
{{ viewfilelink(patch.new_file.path) }}{{patch.old_file.path}}
{{ changedlabel("file renamed", "info")}} {% if linesadded != 0 and linesremoved != 0%} {{ lineschanged(True, True) }} {% endif %} {{ viewfilelinkbutton(patch.new_file.path) }} {% if linesadded != 0 and linesremoved != 0%} {{ diffcollapsebtn() }} {% endif %}
{%- endif -%} {%- elif patch | hasattr('delta') -%} {%- if patch.delta.new_file.path == patch.delta.old_file.path -%} {%- if patch.delta.new_file.mode == 0 and patch.delta.old_file.mode in expected_modes -%} {% set patchtype = "removed"%}
{{ viewfilelink(patch.delta.new_file.path) }}
{{ changedlabel("file removed", "danger")}} {{ lineschanged(False, True) }} {{ viewfilelinkbutton(patch.delta.new_file.path, disabled=True) }} {{ diffcollapsebtn() }}
{%-elif patch.delta.new_file.mode in expected_modes and patch.delta.old_file.mode == 0 -%} {% set patchtype = "added"%}
{{ viewfilelink(patch.delta.new_file.path) }}
{{ changedlabel("file added", "success")}} {{ lineschanged(True, False) }} {{ viewfilelinkbutton(patch.delta.new_file.path) }} {% if linesadded != 0%} {{ diffcollapsebtn() }} {% endif %}
{%-elif patch.delta.new_file.mode in expected_modes and patch.delta.old_file.mode in expected_modes -%} {% set patchtype = "changed"%}
{{ viewfilelink(patch.delta.new_file.path) }}
{{ changedlabel("file modified", "secondary")}} {{ lineschanged(True, True) }} {{ viewfilelinkbutton(patch.delta.new_file.path) }} {{ diffcollapsebtn() }}
{%-endif-%} {%- else -%} {% set patchtype = "moved"%}
{{ viewfilelink(patch.delta.new_file.path) }}{{patch.delta.old_file.path}}
{{ changedlabel("file renamed", "info")}} {% if linesadded != 0 and linesremoved != 0%} {{ lineschanged(True, True) }} {% endif %} {{ viewfilelinkbutton(patch.delta.new_file.path) }} {% if linesadded != 0 and linesremoved != 0%} {{ diffcollapsebtn() }} {% endif %}
{%- endif -%} {%- endif -%}
{% if patchtype == "moved" and linesadded == 0 and linesremoved == 0%}
file was renamed with no change to the file
{% elif patchtype == "added" and linesadded == 0 %}
empty file added
{% else %}
{% endif %}
{% endfor %} {% endif %}
{% endblock %} {% block jscripts %} {{ super() }} {% endblock %}