From d5c8ac41b519a858c3a4aacc5574a1736a68637e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 28 2015 08:23:55 +0000 Subject: [PATCH 1/4] Improve the display of renamed files in pull-requests --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 7120aa8..4e5bbb2 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -253,7 +253,13 @@ {% for patch in diff %}
-

{{ patch.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 %} +

  • {% if (patch.additions + patch.deletions) %} diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index bbfab9a..79e0831 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -241,6 +241,8 @@ def request_pull(repo, requestid, username=None): 'Could not update this pull-request in the database', 'error') + diff.find_similar() + form = pagure.forms.ConfirmationForm() return flask.render_template( From 54164e7464ace26e2e042cd6e722979a68f195ee Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 28 2015 09:13:59 +0000 Subject: [PATCH 2/4] Only find similarity if there is a diff --- diff --git a/pagure/ui/fork.py b/pagure/ui/fork.py index 79e0831..13e209e 100644 --- a/pagure/ui/fork.py +++ b/pagure/ui/fork.py @@ -241,7 +241,8 @@ def request_pull(repo, requestid, username=None): 'Could not update this pull-request in the database', 'error') - diff.find_similar() + if diff: + diff.find_similar() form = pagure.forms.ConfirmationForm() From 41bf90238386b935aa41d3bf81d1aa5652770179 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 28 2015 09:32:26 +0000 Subject: [PATCH 3/4] Fix layout/spacing in the pull-request template to fix the unit-tests --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 4e5bbb2..e980865 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -253,13 +253,11 @@ {% for patch in diff %}
    -

    - {% if patch.new_file_path == patch.old_file_path %} +

    {% if patch.new_file_path == patch.old_file_path -%} {{ patch.new_file_path }} - {% else %} + {%- else -%} {{ patch.new_file_path }} (Renamed from "{{ patch.old_file_path }}") - {% endif %} -

    + {%- endif %}
    • {% if (patch.additions + patch.deletions) %} From 60c648f1e92d7ea6fb6dea51a27b940f2062f882 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 28 2015 09:35:23 +0000 Subject: [PATCH 4/4] Make the code a little prettier to read --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index e980865..9ed3346 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -253,11 +253,13 @@ {% for patch in diff %}
      -

      {% if patch.new_file_path == patch.old_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 %}

      + {%- endif -%} +
      • {% if (patch.additions + patch.deletions) %}