{% macro breadcrumb(ref, 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) %}
{% endmacro %} {% macro commit_event(repo, c, full_body=False, refs={}, full_id=False, diff=None, href=None, parents=False, skip_body=False, target_blank=False, path=None, lookup=lookup_user) %}
{% if full_id %} {{c.id.hex}} {% else %} {{c.id.hex[:8]}} {% endif %} — {% set author_user = lookup(c.author.email) %} {% if author_user %} {{c.author.name}} {% else %} {{c.author.name}} {% endif %} {{ commit_time(c) | date }} {% if parents and any(c.parents) %} {{icon('code-branch', cls="sm")}} {% for parent in c.parents %} {{parent.short_id}} {% if not loop.last %} + {% endif %} {% endfor %} {% endif %} {% if c.id.hex in refs %} {% for ref in refs[c.id.hex] %} {{ref.name.decode("utf-8", "replace")}} {% endfor %} {% endif %}
{% if not skip_body %} {% if full_body %}
{{ 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 %}
{% 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
%}{{line.content}}{#
#}{% endfor %}
{% endfor %}
{% endif %} {% endfor %} {% endif %} {% endmacro %}