Changeset - b94eac50ec4d
[Not reviewed]
codereview
0 2 0
Marcin Kuzminski - 13 years ago 2012-06-05 22:00:40
marcin@python-works.com
added changeset review status into repo/branch compare view
2 files changed with 11 insertions and 9 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/compare.py
Show inline comments
 
@@ -46,13 +46,12 @@ class CompareController(BaseRepoControll
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def __before__(self):
 
        super(CompareController, self).__before__()
 

	
 

	
 
    def _get_discovery(self, org_repo, org_ref, other_repo, other_ref):
 
        from mercurial import discovery
 
        other = org_repo._repo
 
        repo = other_repo._repo
 
        tip = other[org_ref[1]]
 
        log.debug('Doing discovery for %s@%s vs %s@%s' % (
 
@@ -116,25 +115,28 @@ class CompareController(BaseRepoControll
 
        c.cs_ranges = self._get_changesets(org_repo.scm_instance,
 
                                           org_ref,
 
                                           other_repo.scm_instance,
 
                                           other_ref,
 
                                           discovery_data)
 

	
 
        c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
 
                                                   c.cs_ranges])
 

	
 

	
 
        c.org_ref = org_ref[1]
 
        c.other_ref = other_ref[1]
 
        # diff needs to have swapped org with other to generate proper diff
 
        _diff = diffs.differ(other_repo, other_ref, org_repo, org_ref,
 
                             discovery_data)
 
        diff_processor = diffs.DiffProcessor(_diff, format='gitdiff')
 
        _parsed = diff_processor.prepare()
 

	
 
        c.files = []
 
        c.changes = {}
 
        # sort Added first then Modified last Deleted files
 
        sorter = lambda info: {'A': 0, 'M': 1, 'D': 2}.get(info['operation'])
 
        for f in sorted(_parsed, key=sorter):
 

	
 
        for f in _parsed:
 
            fid = h.FID('', f['filename'])
 
            c.files.append([fid, f['operation'], f['filename'], f['stats']])
 
            diff = diff_processor.as_html(enable_comments=False, diff_lines=[f])
 
            c.changes[fid] = [f['operation'], f['filename'], diff]
 

	
 
        return render('compare/compare_diff.html')
rhodecode/templates/compare/compare_diff.html
Show inline comments
 
@@ -35,20 +35,20 @@
 
        <div id="changeset_compare_view_content">
 
            <div class="container">
 
            <table class="compare_view_commits noborder">
 
            %for cnt, cs in enumerate(c.cs_ranges):
 
                <tr>
 
                <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),14)}"/></div></td>
 
                <td>
 
                  %if cs.raw_id in c.statuses:
 
                    <div title="${c.statuses[cs.raw_id][1]}" class="changeset-status-ico"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cs.raw_id][0])}" /></div>
 
                  %endif
 
                </td>                
 
                <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</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>
 
                  %if hasattr(c,'statuses') and c.statuses:
 
                    <div title="${_('Changeset status')}" class="changeset-status-ico"><img src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cnt])}" /></div>
 
                  %endif
 
                </td>
 
                <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message),c.repo_name)}</div></td>
 
                </tr>
 
            %endfor
 
            </table>
 
            </div>
 
            <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
0 comments (0 inline, 0 general)