Changeset - 25d77aef2729
[Not reviewed]
beta
0 3 0
Marcin Kuzminski - 13 years ago 2012-11-17 17:14:02
marcin@python-works.com
Optimized look of compare view of changesets.
Added cut off limit for compare view
3 files changed with 18 insertions and 4 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/compare.py
Show inline comments
 
@@ -38,12 +38,13 @@ from rhodecode.lib.auth import LoginRequ
 
from rhodecode.lib import diffs
 

	
 
from rhodecode.model.db import Repository
 
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__)
 

	
 

	
 
class CompareController(BaseRepoController):
 

	
 
@@ -85,12 +86,13 @@ class CompareController(BaseRepoControll
 

	
 
        org_repo = c.rhodecode_db_repo.repo_name
 
        org_ref = (org_ref_type, org_ref)
 
        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],
 
              other_ref_type=org_ref[0], other_ref=org_ref[1],
 
              repo=org_repo, as_form=request.GET.get('as_form'),
 
              bundle=bundle_compare)
 
@@ -135,15 +137,21 @@ class CompareController(BaseRepoControll
 

	
 
        c.org_ref = org_ref[1]
 
        c.other_ref = other_ref[1]
 

	
 
        _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 = {}
 

	
 
        for f in _parsed:
 
            fid = h.FID('', f['filename'])
 
            c.files.append([fid, f['operation'], f['filename'], f['stats']])
rhodecode/templates/compare/compare_cs.html
Show inline comments
 
@@ -15,13 +15,14 @@
 
        <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.target_repo,revision=cs.raw_id))}
 
        %if c.as_form:
 
          ${h.hidden('revisions',cs.raw_id)}
 
        %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>
rhodecode/templates/compare/compare_diff.html
Show inline comments
 
@@ -44,21 +44,26 @@
 
                  <div class="cs_${change}">
 
                    <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div>
 
                    <div class="changes">${h.fancy_file_stats(stat)}</div>
 
                  </div>
 
              %endfor
 
            </div>
 
            % if c.limited_diff:
 
              <h5>${_('Changeset was too big and was cut off...')}</h5>
 
            % endif            
 
        </div>
 
    </div>
 

	
 
    ## diff block
 
    <%namespace name="diff_block" file="/changeset/diff_block.html"/>
 
    %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(){
 

	
 
          YUE.on(YUQ('.diff-menu-activate'),'click',function(e){
 
              var act = e.currentTarget.nextElementSibling;
0 comments (0 inline, 0 general)