changeset 6303:1cf51cd05e36

diff: use list instead of OrderedDict - keep it simple
author Mads Kiilerich <madski@unity3d.com>
date Thu, 10 Nov 2016 16:10:41 +0100
parents 84eb5b7b1bac
children a6af26b5ffc1
files kallithea/controllers/changeset.py kallithea/controllers/compare.py kallithea/controllers/files.py kallithea/controllers/pullrequests.py kallithea/templates/changeset/changeset.html kallithea/templates/changeset/changeset_range.html kallithea/templates/changeset/diff_block.html kallithea/templates/compare/compare_diff.html kallithea/templates/pullrequests/pullrequest_show.html
diffstat 9 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/changeset.py	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/controllers/changeset.py	Thu Nov 10 16:10:41 2016 +0100
@@ -280,7 +280,7 @@
                                                  vcs=c.db_repo_scm_instance.alias,
                                                  format='gitdiff',
                                                  diff_limit=diff_limit)
-            file_diff_data = OrderedDict()
+            file_diff_data = []
             if method == 'show':
                 _parsed = diff_processor.prepare()
                 c.limited_diff = False
@@ -295,11 +295,11 @@
                     url_fid = h.FID('', filename)
                     diff = diff_processor.as_html(enable_comments=enable_comments,
                                                   parsed_lines=[f])
-                    file_diff_data[fid] = (url_fid, f['operation'], f['old_filename'], filename, diff, st)
+                    file_diff_data.append((fid, url_fid, f['operation'], f['old_filename'], filename, diff, st))
             else:
                 # downloads/raw we only need RAW diff nothing else
                 diff = diff_processor.as_raw()
-                file_diff_data[''] = (None, None, None, diff, None)
+                file_diff_data.append(('', None, None, None, diff, None))
             c.changes[changeset.raw_id] = (cs1, cs2, file_diff_data)
 
         #sort comments in creation order
--- a/kallithea/controllers/compare.py	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/controllers/compare.py	Thu Nov 10 16:10:41 2016 +0100
@@ -283,7 +283,7 @@
         if isinstance(_parsed, LimitedDiffContainer):
             c.limited_diff = True
 
-        c.file_diff_data = OrderedDict()
+        c.file_diff_data = []
         c.lines_added = 0
         c.lines_deleted = 0
         for f in _parsed:
@@ -294,6 +294,6 @@
             fid = h.FID('', filename)
             diff = diff_processor.as_html(enable_comments=False,
                                           parsed_lines=[f])
-            c.file_diff_data[fid] = (None, f['operation'], f['old_filename'], filename, diff, st)
+            c.file_diff_data.append((fid, None, f['operation'], f['old_filename'], filename, diff, st))
 
         return render('compare/compare_diff.html')
--- a/kallithea/controllers/files.py	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/controllers/files.py	Thu Nov 10 16:10:41 2016 +0100
@@ -690,7 +690,7 @@
                                          ignore_whitespace=ign_whitespace_lcl,
                                          line_context=line_context_lcl,
                                          enable_comments=False)
-            c.file_diff_data = {fid: (fid, op, a_path, node2.path, diff, st)}
+            c.file_diff_data = [(fid, fid, op, a_path, node2.path, diff, st)]
 
             return render('files/file_diff.html')
 
--- a/kallithea/controllers/pullrequests.py	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/controllers/pullrequests.py	Thu Nov 10 16:10:41 2016 +0100
@@ -738,7 +738,7 @@
         if isinstance(_parsed, LimitedDiffContainer):
             c.limited_diff = True
 
-        c.file_diff_data = OrderedDict()
+        c.file_diff_data = []
         c.lines_added = 0
         c.lines_deleted = 0
 
@@ -750,7 +750,7 @@
             fid = h.FID('', filename)
             diff = diff_processor.as_html(enable_comments=True,
                                           parsed_lines=[f])
-            c.file_diff_data[fid] = (None, f['operation'], f['old_filename'], filename, diff, st)
+            c.file_diff_data.append((fid, None, f['operation'], f['old_filename'], filename, diff, st))
 
         # inline comments
         c.inline_cnt = 0
--- a/kallithea/templates/changeset/changeset.html	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/templates/changeset/changeset.html	Thu Nov 10 16:10:41 2016 +0100
@@ -168,7 +168,7 @@
               %endif
               </div>
               <div class="cs_files">
-                %for fid, (url_fid, op, a_path, path, diff, stats) in file_diff_data.iteritems():
+                %for fid, url_fid, op, a_path, path, diff, stats in file_diff_data:
                     <div class="cs_${op}">
                       <div class="node">
                           <i class="icon-diff-${op}"></i>
--- a/kallithea/templates/changeset/changeset_range.html	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/templates/changeset/changeset_range.html	Thu Nov 10 16:10:41 2016 +0100
@@ -60,7 +60,7 @@
                 %for cs in c.cs_ranges:
                     <div class="cur_cs">${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}</div>
                     <% a_rev, cs_rev, file_diff_data = c.changes[cs.raw_id] %>
-                    %for fid, (url_fid, op, a_path, path, diff, stats) in file_diff_data.iteritems():
+                    %for fid, url_fid, op, a_path, path, diff, stats in file_diff_data:
                         <div class="cs_${op}">
                             <div class="node">
                                 <i class="icon-diff-${op}"></i>
--- a/kallithea/templates/changeset/diff_block.html	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/templates/changeset/diff_block.html	Thu Nov 10 16:10:41 2016 +0100
@@ -7,7 +7,7 @@
     <span target="${'diff-container-%s' % (id(file_diff_data))}" class="diff-collapse-button">&uarr; ${_('Collapse Diff')} &uarr;</span>
 </div>
 <div class="diff-container" id="${'diff-container-%s' % (id(file_diff_data))}">
-%for id_fid, (url_fid, op, a_filename, cs_filename, diff, stats) in file_diff_data.iteritems():
+%for id_fid, url_fid, op, a_filename, cs_filename, diff, stats in file_diff_data:
     ${diff_block_diffblock(id_fid, url_fid, op, diff,
         a_repo_name, a_rev, a_ref_type, a_ref_name, a_filename,
         cs_repo_name, cs_rev, cs_ref_type, cs_ref_name, cs_filename)}
--- a/kallithea/templates/compare/compare_diff.html	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/templates/compare/compare_diff.html	Thu Nov 10 16:10:41 2016 +0100
@@ -70,7 +70,7 @@
                   %if not c.file_diff_data:
                      <span class="empty_data">${_('No files')}</span>
                   %endif
-                  %for fid, (url_fid, op, a_path, path, diff, stats) in c.file_diff_data.iteritems():
+                  %for fid, url_fid, op, a_path, path, diff, stats in c.file_diff_data:
                     <div class="cs_${op}">
                       <div class="node">
                           <i class="icon-diff-${op}"></i>
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Wed Feb 11 03:05:00 2015 +0100
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Thu Nov 10 16:10:41 2016 +0100
@@ -315,7 +315,7 @@
                 %if not c.file_diff_data:
                    <span class="empty_data">${_('No files')}</span>
                 %endif
-                %for fid, (url_fid, op, a_path, path, diff, stats) in c.file_diff_data.iteritems():
+                %for fid, url_fid, op, a_path, path, diff, stats in c.file_diff_data:
                     <div class="cs_${op}">
                       <div class="node">
                           <i class="icon-diff-${op}"></i>