-
- {%- if patch | hasattr('new_file_path') -%}
- {%- if patch.new_file_path == patch.old_file_path -%}
- {{ patch.new_file_path }}
- {%- else -%}
- {{ patch.new_file_path }} (Renamed from "{{ patch.old_file_path }}")
- {%- endif -%}
- {%- elif patch | hasattr('delta') -%}
- {%- if patch.delta.new_file.path == patch.delta.old_file.path -%}
- {{ patch.delta.new_file.path }}
- {%- else -%}
- {{ patch.delta.new_file.path }} (Renamed from "{{ patch.delta.old_file.path }}")
- {%- endif -%}
+
+ {% if patch | hasattr('additions') %}
+ {# Version of pygit2 -0.21.4 -- F21/EL7 #}
+ {% set linesadded = patch.additions %}
+ {% set linesremoved = patch.deletions %}
+ {% else %}
+ {# Version of pygit2 -0.23.0 -- F23 #}
+ {% set linesadded = patch.line_stats[1] %}
+ {% set linesremoved = patch.line_stats[2] %}
+ {% endif %}
+
+ {% if patch | hasattr('new_file_path') %}
+ {%- if patch.new_file_path == patch.old_file_path -%}
+ {{ changeschangedfile(patch.new_file_path, linesadded, linesremoved) }}
+ {%- else -%}
+ {{changesrenamedfile(patch.old_file_path, patch.new_file_path, linesadded, linesremoved)}}
{%- endif -%}
-
-
- {% if patch | hasattr('additions') %}
- {# Version of pygit2 -0.21.4 -- F21/EL7 #}
- {% if (patch.additions + patch.deletions) %}
-
- {% if patch.additions > 0 %}+{{ patch.additions }}{% endif %}
- {% if patch.deletions > 0 %}-{{ patch.deletions }}{% endif %}
-
- {% endif %}
- {% else %}
- {# Version of pygit2 -0.23.0 -- F23 #}
- {% if (patch.line_stats[1] + patch.line_stats[2]) %}
-
- {% if patch.line_stats[1] > 0 %}+{{ patch.line_stats[1] }}{% endif %}
- {% if patch.line_stats[2] > 0 %}-{{ patch.line_stats[2] }}{% endif %}
-
- {% 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 == 33188 -%}
+ {{ changesdeletedfile(patch.delta.new_file.path, linesadded, linesremoved) }}
+ {%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 0 -%}
+ {{ changesaddedfile(patch.delta.new_file.path, linesadded, linesremoved) }}
+ {%-elif patch.delta.new_file.mode == 33188 and patch.delta.old_file.mode == 33188 -%}
+ {{ changeschangedfile(patch.delta.new_file.path, linesadded, linesremoved) }}
+ {%-endif-%}
+ {%- else -%}
+ {{changesrenamedfile(patch.delta.old_file.path, patch.delta.new_file.path, linesadded, linesremoved)}}
+ {%- endif -%}
+ {%- endif -%}