{% macro breadcrumb(ref, permaref, repo, path, entry, view, path_join, stat, pygit2, humanize) %} {% set ref_s = ref.decode("utf-8", "replace") %} {% if ref_s != repo.git_repo.default_branch_name() %} ref: {{ ref_s }} {% endif %} {% if path != [''] %} {{repo.name}}{% endif %}/{% for part in path%}{% if loop.last %}{{part}}{% else %}{{part}}/{% endif %}{% endfor %} {% set is_blob = entry and entry.type == pygit2.GIT_OBJ_BLOB %} {% if entry %} {# Root tree has no filemode #} {% set filemode = entry.filemode or stat.S_IFDIR %} {{stat.filemode(filemode)}} {% if is_blob %} {{humanize.naturalsize(entry.size, binary=True).replace("Byte", "byte")}} {% endif %} {% endif %} {% set path = path_join(*path) %}
{{ c.message | commit_links(repo) | safe }} {%- if diff %} {{diffstat(diff, anchor=c.oid.hex + "-")}}{% endif -%}{% else %}
{{ trim_commit(c.message) }}{% endif %} {% endif %} {% endmacro %} {% macro commit_diff(repo, commit, diff, anchor="", target_blank=False) %} {# God, working with
tags is such a fucking mess #} {% if diff.stats.insertions + diff.stats.deletions > 10000 %}This diff is too large to display. Try viewing the raw diff instead.{% else %} {% for patch in diff %}{# #}{{patch.delta.status_char()}} {% if parent %}{{patch.delta.old_file.raw_path.decode('utf-8', 'replace')}}{# #}{% endif %} => {# #}{{patch.delta.new_file.raw_path.decode('utf-8', 'replace')}}{# #} +{{patch.line_stats[1]}}{# #} -{{patch.line_stats[2]}}{% if patch.delta.old_file.mode != patch.delta.new_file.mode %}{# #}{# #}{% endif %}
{% if patch.hunks|length %}{% endif %} {% endfor %} {% endif %} {% endmacro %}{% for hunk in patch.hunks %} {% set hunk_index = loop.index %}@@ {# #}{% if parent %}{{hunk.old_start}},{{hunk.old_lines}} {# #}{% endif %}{{hunk.new_start}},{{hunk.new_lines}} {# #}@@{{hunk.header.split('@@')[-1][:-1]}} {% for line in hunk.lines %}{% endfor %} {% endfor %} {{line.content}}{# #}