[PATCH 1 of 7 v3] diff: move looping over files to simple_diff

Jan Heylen heyleke at gmail.com
Sat Jan 2 12:15:01 UTC 2016


# HG changeset patch
# User Jan Heylen <heyleke at gmail.com>
# Date 1451732136 -3600
#      Sat Jan 02 11:55:36 2016 +0100
# Node ID e2a12ba47a16d4258b2c5c946f38f32c9e6c367e
# Parent  eb072b2cfa18fb4248fd55c5175dea5556afcbeb
diff: move looping over files to simple_diff

diff -r eb072b2cfa18 -r e2a12ba47a16 kallithea/templates/changeset/diff_block.html
--- a/kallithea/templates/changeset/diff_block.html	Fri Dec 25 13:50:37 2015 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Sat Jan 02 11:55:36 2016 +0100
@@ -65,8 +65,11 @@
 </div>
 </%def>
 
-<%def name="diff_block_simple(change)">
-
+<%def name="diff_block_simple(files, changes, hidden=False)">
+%for fid, ch, f, stat in files:
+  <%
+  change = [changes[fid]]
+  %>
   %for op,filenode_path,diff in change:
     <div id="${h.FID('',filenode_path)}_target" style="clear:both;margin-top:25px"></div>
     <div id="${h.FID('',filenode_path)}" class="diffblock  margined comm">
@@ -124,6 +127,7 @@
         </div>
     </div>
   %endfor
+%endfor
 </%def>
 
 <%def name="diff_block_js()">
diff -r eb072b2cfa18 -r e2a12ba47a16 kallithea/templates/compare/compare_diff.html
--- a/kallithea/templates/compare/compare_diff.html	Fri Dec 25 13:50:37 2015 +0100
+++ b/kallithea/templates/compare/compare_diff.html	Sat Jan 02 11:55:36 2016 +0100
@@ -88,9 +88,7 @@
         ## diff block
         <%namespace name="diff_block" file="/changeset/diff_block.html"/>
         ${diff_block.diff_block_js()}
-        %for fid, change, f, stat in c.files:
-          ${diff_block.diff_block_simple([c.changes[fid]])}
-        %endfor
+        ${diff_block.diff_block_simple(c.files,c.changes)}
         % if c.limited_diff:
           <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h4>
         % endif
diff -r eb072b2cfa18 -r e2a12ba47a16 kallithea/templates/pullrequests/pullrequest_show.html
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Fri Dec 25 13:50:37 2015 +0100
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Sat Jan 02 11:55:36 2016 +0100
@@ -356,9 +356,7 @@
     <div class="commentable-diff">
     <%namespace name="diff_block" file="/changeset/diff_block.html"/>
     ${diff_block.diff_block_js()}
-    %for fid, change, f, stat in c.files:
-      ${diff_block.diff_block_simple([c.changes[fid]])}
-    %endfor
+      ${diff_block.diff_block_simple(c.files, c.changes)}
     % if c.limited_diff:
       <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff anyway')}</a></h4>
     % endif


More information about the kallithea-general mailing list