allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject [05/18] allura git commit: [#7925] fix template display: specify copy/rename, say file was binary instead of skip entirely, etc
Date Mon, 10 Aug 2015 13:39:29 GMT
[#7925] fix template display: specify copy/rename, say file was binary instead of skip entirely,
etc


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/3a8037c1
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/3a8037c1
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/3a8037c1

Branch: refs/heads/master
Commit: 3a8037c16afa1fb00f58f6e4aa307c505e5e1c61
Parents: 5adbb28
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Fri Jul 31 19:14:26 2015 +0000
Committer: Heith Seewald <hseewald@slashdotmedia.com>
Committed: Mon Aug 10 09:38:36 2015 -0400

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py  | 16 +++++++++++-----
 Allura/allura/templates/repo/commit.html | 16 +++++++---------
 2 files changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/3a8037c1/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 0524589..c17f06a 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -563,11 +563,17 @@ class CommitBrowser(BaseController):
         limit, page, start = g.handle_paging(limit, page,
                                              default=self.DEFAULT_PAGE_LIMIT)
         diffs = self._commit.paged_diffs(start=start, end=start + limit)
-        result['artifacts'] = [
-            (t, f, 'blob' if tree.get_blob_by_path(f) else 'tree',
-            tree.get_blob_by_path(f) and tree.get_blob_by_path(f).has_html_view)
-            for t in ('added', 'removed', 'changed', 'copied', 'renamed')
-            for f in diffs[t]]
+        result['artifacts'] = []
+        for t in ('added', 'removed', 'changed', 'copied', 'renamed'):
+            for f in diffs[t]:
+                if t in ('copied', 'renamed'):
+                    filepath = f['new']
+                else:
+                    filepath = f
+                is_text = filepath and tree.get_blob_by_path(filepath) and tree.get_blob_by_path(filepath).has_html_view
+                result['artifacts'].append(
+                    (t, f, 'blob' if tree.get_blob_by_path(f) else 'tree', is_text)
+                )
         count = diffs['total']
         result.update(dict(page=page, limit=limit, count=count))
         return result

http://git-wip-us.apache.org/repos/asf/allura/blob/3a8037c1/Allura/allura/templates/repo/commit.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/repo/commit.html b/Allura/allura/templates/repo/commit.html
index f7206d4..b0adabc 100644
--- a/Allura/allura/templates/repo/commit.html
+++ b/Allura/allura/templates/repo/commit.html
@@ -132,9 +132,8 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
 </table>
 
     {% for type, file, obj_type, is_text in artifacts %}
-        {% if is_text %}
-            <div class="inline-diff">
-                <h6>
+        <div class="inline-diff">
+            <h6>
             {% if type in ('added', 'changed') %}
                 {% if obj_type == 'tree' %}
                     <a href="{{commit.url()}}tree/{{h.urlquote(h.really_unicode(file))}}">{{h.really_unicode(file)}}</a>
@@ -145,9 +144,7 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
                 {% endif %}
             {% elif type == 'removed' %}
                 <a href="{{prev[0].url()}}tree/{{h.urlquote(h.really_unicode(file))}}">{{h.really_unicode(file)}}</a>
-            {% elif type == 'renamed' %}
-                <a href="{{prev[0].url()}}tree/{{h.urlquote(h.really_unicode(file))}}">{{h.really_unicode(file)}}</a>
-            {% elif type == 'copied' %}
+            {% elif type in ('copied', 'renamed') %}
                 <a href="{{prev[0].url()}}tree/{{h.urlquote(h.really_unicode(file.old))}}">{{h.really_unicode(file.old)}}</a>
                 to
                 <a href="{{commit.url()}}tree/{{h.urlquote(h.really_unicode(file.new))}}">{{h.really_unicode(file.new)}}</a>
@@ -156,14 +153,16 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
             <div id="diff-{{loop.index}}" class="inline-diff-body">
                 {% if type == 'removed' %}
                   <span class="empty-diff">File was removed.</span>
-                {% elif type == 'copied' %}
+                {% elif type in ('copied', 'renamed') %}
                   {% if file.ratio == 1 %}
-                    <span class="empty-diff">File was copied or renamed.</span>
+                    <span class="empty-diff">File was {{ type }}.</span>
                   {% else %}
                     {{g.highlight(file.diff, lexer='diff')}}
                   {% endif %}
                 {% elif obj_type == 'tree' %}
                     <span class="empty-diff">Directory.</span>
+                {% elif not is_text %}
+                    <span class="empty-diff">Binary file was {{ type }}.</span>
                 {% else %}
                     <img src="{{g.forge_static('images/spinner.gif')}}" class="loading_icon"
alt="Loading..."/>
                     <script type="text/javascript">
@@ -175,7 +174,6 @@ Commit <a href="{{commit.url()}}">{{commit.shorthand_id()}}</a>
{{commit_labels(
                 {% endif %}
             </div>
         </div>
-        {% endif %}
     {% endfor %}
     {{ c.page_list.display(page=page, limit=limit, count=count) }}
 {% endblock %}


Mime
View raw message