diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 65b202a..523a9a6 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -280,6 +280,15 @@ {% 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 %} @@ -316,23 +325,29 @@ {%endif%} {%endmacro%} - {% macro viewfilelink(filepath)%} + {% macro viewfilelink(filepath, identifier=False)%} {% if pull_request %} + {% if not identifier %} + {% set identifier = pull_request.branch_from %} + {% endif %} {{filepath}} @@ -406,14 +421,24 @@
empty file added
{% else %} - {% autoescape false %} - {{ patch | patch_to_diff | html_diff | format_loc( - filename=patch_new_file_path, - commit=patch_new_id, - prequest=pull_request, - index=loop.index, - tree_id=diff_commits[0].tree.id)}} - {% endautoescape %} + {% if patchtype == "added" and patch.line_stats[1] > 100 %} +
+
View the large added file {{ viewfilelink(patch_new_file_path) }}
+
+ {% elif patchtype == "removed" %} +
+
view the removed file {{ viewfilelink(patch_new_file_path, patch_old_id) }}
+
+ {% else %} + {% autoescape false %} + {{ patch | patch_to_diff | html_diff | format_loc( + filename=patch_new_file_path, + commit=patch_new_id, + prequest=pull_request, + index=loop.index, + tree_id=diff_commits[0].tree.id)}} + {% endautoescape %} + {% endif %} {% endif %}