changeset 3011:25d77aef2729 beta

Optimized look of compare view of changesets. Added cut off limit for compare view
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 17 Nov 2012 17:14:02 +0100
parents bf96fd1920c1
children 58f3bba0ddc1
files rhodecode/controllers/compare.py rhodecode/templates/compare/compare_cs.html rhodecode/templates/compare/compare_diff.html
diffstat 3 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/compare.py	Fri Nov 16 21:27:04 2012 +0100
+++ b/rhodecode/controllers/compare.py	Sat Nov 17 17:14:02 2012 +0100
@@ -41,6 +41,7 @@
 from rhodecode.model.pull_request import PullRequestModel
 from webob.exc import HTTPBadRequest
 from rhodecode.lib.utils2 import str2bool
+from rhodecode.lib.diffs import LimitedDiffContainer
 
 log = logging.getLogger(__name__)
 
@@ -88,6 +89,7 @@
         other_ref = (other_ref_type, other_ref)
         other_repo = request.GET.get('repo', org_repo)
         bundle_compare = str2bool(request.GET.get('bundle', True))
+        c.fulldiff = fulldiff = request.GET.get('fulldiff')
 
         c.swap_url = h.url('compare_url', repo_name=other_repo,
               org_ref_type=other_ref[0], org_ref=other_ref[1],
@@ -138,9 +140,15 @@
 
         _diff = diffs.differ(other_repo, other_ref, org_repo, org_ref,
                              discovery_data, bundle_compare=bundle_compare)
-        diff_processor = diffs.DiffProcessor(_diff, format='gitdiff')
+        diff_limit = self.cut_off_limit if not fulldiff else None
+        diff_processor = diffs.DiffProcessor(_diff, format='gitdiff',
+                                             diff_limit=diff_limit)
         _parsed = diff_processor.prepare()
 
+        c.limited_diff = False
+        if isinstance(_parsed, LimitedDiffContainer):
+            c.limited_diff = True
+
         c.files = []
         c.changes = {}
 
--- a/rhodecode/templates/compare/compare_cs.html	Fri Nov 16 21:27:04 2012 +0100
+++ b/rhodecode/templates/compare/compare_cs.html	Sat Nov 17 17:14:02 2012 +0100
@@ -18,10 +18,11 @@
         %endif
         </td>
         <td><div class="author">${h.person(cs.author)}</div></td>
-        <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
-        <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
+        <td><span class="tooltip" title="${h.tooltip(h.age(cs.date))}">${cs.date}</span></td>
+        <td><div class="message tooltip" title="${h.tooltip(cs.message)}" style="white-space:normal">${h.urlify_commit(h.shorter(cs.message, 60),c.repo_name)}</div></td>
         </tr>
     %endfor
+
   %endif
   </table>
 </div>
--- a/rhodecode/templates/compare/compare_diff.html	Fri Nov 16 21:27:04 2012 +0100
+++ b/rhodecode/templates/compare/compare_diff.html	Sat Nov 17 17:14:02 2012 +0100
@@ -47,6 +47,9 @@
                   </div>
               %endfor
             </div>
+            % if c.limited_diff:
+              <h5>${_('Changeset was too big and was cut off...')}</h5>
+            % endif            
         </div>
     </div>
 
@@ -55,7 +58,9 @@
     %for fid, change, f, stat in c.files:
       ${diff_block.diff_block_simple([c.changes[fid]])}
     %endfor
-
+    % if c.limited_diff:
+      <h4>${_('Changeset was too big and was cut off...')}</h4>
+    % endif
      <script type="text/javascript">
 
       YUE.onDOMReady(function(){