diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index b0cc905..9339687 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -204,6 +204,11 @@ right:6px!important; text-overflow: ellipsis; } +.ellipsis-left +{ + direction:rtl; +} + .projecticon .oi { font-size: 3.5rem; @@ -509,3 +514,8 @@ color: #999; th[data-sort] { cursor: pointer; } + +.pr-changes-description +{ + font-size: 0.8em; +} diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index b9e42fd..219ee99 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -238,8 +238,8 @@ -
{% if authenticated and pull_request %}
Changes summary
+ + + {% macro changeschangedfile(filepath, added, removed) -%} +
+
+{{added}} -{{removed}}
+
file changed
+
+
+ {{filepath}} +
+ {%- endmacro %} + {% macro changesrenamedfile(oldfilepath, newfilepath, added, removed) -%} +
+
+{{added}} -{{removed}}
+
file renamed
+
+
+ {{oldfilepath}}
{{newfilepath}} +
+ {%- endmacro %} + {% macro changesdeletedfile(filepath, added, removed) -%} +
+
-{{removed}}
+
file deleted
+
+
+ {{filepath}} +
+ {%- endmacro %} + {% macro changesaddedfile(filepath, added, removed) -%} +
+
+{{added}}
+
file added
+
+
+ {{filepath}} +
+ {%- endmacro %}
{% for patch in diff %}
- - {%- 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 -%}
{% endfor %}