From 8eac2b839d7d08fe94d03bf7535b6b9199fa80c6 Mon Sep 17 00:00:00 2001
From: Ryan Lerch <rlerch@redhat.com>
Date: May 26 2016 09:51:01 +0000
Subject: [PATCH 1/3] fixed display of files moved on both old and new pygit2


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 8766827..32d504e 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -317,25 +317,35 @@
               {% endmacro %}
 
               {% if patch | hasattr('new_file_path') %}
-                {%- if patch.status == 'D' -%}
-                  {% set patchtype = "removed"%}
-                  <div class="clearfix">
-                    {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(False, True) }}
-                  </div>
-                  <div><small>file removed</small></div>
-                {%-elif patch.status == 'A' -%}
-                  {% set patchtype = "added"%}
-                  <div class="clearfix">
-                    {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, False) }}
-                  </div>
-                  <div><small>file added</small></div>
-                {%-elif patch.status == 'M' -%}
-                  {% set patchtype = "changed"%}
+                {%- if patch.new_file_path == patch.old_file_path -%}
+                  {%- if patch.status == 'D' -%}
+                    {% set patchtype = "removed"%}
+                    <div class="clearfix">
+                      {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(False, True) }}
+                    </div>
+                    <div><small>file removed</small></div>
+                  {%-elif patch.status == 'A' -%}
+                    {% set patchtype = "added"%}
+                    <div class="clearfix">
+                      {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, False) }}
+                    </div>
+                    <div><small>file added</small></div>
+                  {%-elif patch.status == 'M' -%}
+                    {% set patchtype = "changed"%}
+                    <div class="clearfix">
+                      {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, True) }}
+                    </div>
+                    <div><small>file changed</small></div>
+                  {%-endif-%}
+                {%- else -%}
+                  {% set patchtype = "moved"%}
+                  {{lineschanged(True, True)}}
                   <div class="clearfix">
-                    {{ viewfilelink(patch.new_file_path) }} {{ lineschanged(True, True) }}
+                    <strike>{{patch.old_file_path}}</strike><br/>
+                    {{viewfilelink(patch.new_file_path)}}
                   </div>
-                  <div><small>file changed</small></div>
-                {%-endif-%}
+                  <div><small>file moved</small></div>
+                {%- 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 -%}
@@ -353,6 +363,14 @@
                     </div>
                     <div><small>file changed</small></div>
                   {%-endif-%}
+                {%- else -%}
+                  {% set patchtype = "moved"%}
+                  {{lineschanged(True, True)}}
+                  <div class="clearfix">
+                    <strike>{{patch.delta.old_file.path}}</strike><br/>
+                    {{viewfilelink(patch.delta.new_file.path)}}
+                  </div>
+                  <div><small>file moved</small></div>
                 {%- endif -%}
               {%- endif -%}
             </h5>

From 18c312ff0e9fce9d526da79db8da50f22fd2e590 Mon Sep 17 00:00:00 2001
From: Ryan Lerch <rlerch@redhat.com>
Date: May 26 2016 09:51:01 +0000
Subject: [PATCH 2/3] fixed changes summary sidebar for older versions of pygit


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 32d504e..89c5bdb 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -592,7 +592,7 @@
     {% macro changeschangedfile(filepath, added, removed, diffanchor) -%}
         <div class="clearfix" style="margin-left:-4px;">
           <div class="pull-xs-right"><span class="label label-success">+{{added}}</span> <span class="label label-danger">-{{removed}}</span></div>
-          <div class="pull-xs-left pr-changes-description"><strong>file <span class="text-primary">changed</span></strong></div>
+          <div class="pull-xs-left pr-changes-description"><strong>file <span class="text-muted">changed</span></strong></div>
         </div>
         <div class="ellipsis pr-changes-description">
           <a href="#_{{diffanchor}}">{{filepath}}</a>
@@ -641,10 +641,15 @@
               {% 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, count) }}
+              {%- if patch.status == 'D' -%}
+                {{ changesdeletedfile(patch.new_file_path, linesadded, linesremoved, count) }}
+              {%-elif patch.status == 'A' -%}
+                {{ changesaddedfile(patch.new_file_path, linesadded, linesremoved, count) }}
+              {%-elif patch.status == 'M' -%}
+                {{ changeschangedfile(patch.new_file_path, linesadded, linesremoved, count) }}
+              {%-endif-%}
             {%- else -%}
               {{changesrenamedfile(patch.old_file_path, patch.new_file_path, linesadded, linesremoved, count)}}
             {%- endif -%}

From be7be8e622e5c014058c3489a56262fce03ec0fe Mon Sep 17 00:00:00 2001
From: Ryan Lerch <rlerch@redhat.com>
Date: May 26 2016 09:51:01 +0000
Subject: [PATCH 3/3] split the long lines out


---

diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html
index 89c5bdb..4f0361d 100644
--- a/pagure/templates/pull_request.html
+++ b/pagure/templates/pull_request.html
@@ -591,8 +591,13 @@
       </div>
     {% macro changeschangedfile(filepath, added, removed, diffanchor) -%}
         <div class="clearfix" style="margin-left:-4px;">
-          <div class="pull-xs-right"><span class="label label-success">+{{added}}</span> <span class="label label-danger">-{{removed}}</span></div>
-          <div class="pull-xs-left pr-changes-description"><strong>file <span class="text-muted">changed</span></strong></div>
+          <div class="pull-xs-right">
+            <span class="label label-success">+{{added}}</span>
+            <span class="label label-danger">-{{removed}}</span>
+          </div>
+          <div class="pull-xs-left pr-changes-description">
+            <strong>file <span class="text-muted">changed</span></strong>
+          </div>
         </div>
         <div class="ellipsis pr-changes-description">
           <a href="#_{{diffanchor}}">{{filepath}}</a>

