Changeset - d5d7c40e8591
[Not reviewed]
beta
0 4 1
Marcin Kuzminski - 14 years ago 2011-07-16 19:30:38
marcin@python-works.com
changelog uses lazy loading of affected files details, in some scenarios this can improve speed
of changelog page dramatically especially for larger repositories.
5 files changed with 44 insertions and 12 deletions:
0 comments (0 inline, 0 general)
rhodecode/config/routing.py
Show inline comments
 
@@ -328,24 +328,28 @@ def make_map(config):
 
    rmap.connect('shortlog_home', '/{repo_name:.*}/shortlog',
 
                controller='shortlog', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('branches_home', '/{repo_name:.*}/branches',
 
                controller='branches', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('tags_home', '/{repo_name:.*}/tags',
 
                controller='tags', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('changelog_home', '/{repo_name:.*}/changelog',
 
                controller='changelog', conditions=dict(function=check_repo))
 

	
 
    rmap.connect('changelog_details', '/{repo_name:.*}/changelog_details/{cs}',
 
                controller='changelog', action='changelog_details',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_home', '/{repo_name:.*}/files/{revision}/{f_path:.*}',
 
                controller='files', revision='tip', f_path='',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_diff_home', '/{repo_name:.*}/diff/{f_path:.*}',
 
                controller='files', action='diff', revision='tip', f_path='',
 
                conditions=dict(function=check_repo))
 

	
 
    rmap.connect('files_rawfile_home',
 
                 '/{repo_name:.*}/rawfile/{revision}/{f_path:.*}',
 
                 controller='files', action='rawfile', revision='tip',
 
                 f_path='', conditions=dict(function=check_repo))
rhodecode/controllers/changelog.py
Show inline comments
 
@@ -67,24 +67,29 @@ class ChangelogController(BaseRepoContro
 

	
 
        p = int(request.params.get('page', 1))
 
        branch_name = request.params.get('branch', None)
 
        c.total_cs = len(c.rhodecode_repo)
 
        c.pagination = RepoPage(c.rhodecode_repo, page=p,
 
                                item_count=c.total_cs, items_per_page=c.size,
 
                                branch_name=branch_name)
 

	
 
        self._graph(c.rhodecode_repo, c.total_cs, c.size, p)
 

	
 
        return render('changelog/changelog.html')
 

	
 
    def changelog_details(self, cs):
 
        if request.environ.get('HTTP_X_PARTIAL_XHR'):
 
            c.cs = c.rhodecode_repo.get_changeset(cs)
 
            return render('changelog/changelog_details.html')
 

	
 
    def _graph(self, repo, repo_size, size, p):
 
        """
 
        Generates a DAG graph for mercurial
 

	
 
        :param repo: repo instance
 
        :param size: number of commits to show
 
        :param p: page number
 
        """
 
        if not repo.revisions:
 
            c.jsdata = json.dumps([])
 
            return
 

	
rhodecode/public/css/style.css
Show inline comments
 
@@ -1778,24 +1778,34 @@ vertical-align: text-top;
 
}
 
 
#graph_content .container .left .message {
 
font-size:100%;
 
padding-top:3px;
 
white-space:pre-wrap;
 
}
 
 
.right div {
 
clear:both;
 
}
 
 
.right .changes .changed_total{
 
border:1px solid #DDD;
 
display:block;
 
float:right;
 
text-align:center;
 
min-width:45px;
 
cursor: pointer;
 
background:#FD8;
 
font-weight: bold;
 
}
 
.right .changes .added,.changed,.removed {
 
border:1px solid #DDD;
 
display:block;
 
float:right;
 
text-align:center;
 
min-width:15px;
 
cursor: help;
 
}
 
.right .changes .large {
 
border:1px solid #DDD;
 
display:block;
 
float:right;
rhodecode/templates/changelog/changelog.html
Show inline comments
 
@@ -50,38 +50,33 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
							<span>${_('commit')} ${cs.revision}: ${h.short_id(cs.raw_id)}@${cs.date}</span>
 
							</div>
 
							<div class="author">
 
								<div class="gravatar">
 
									<img alt="gravatar" src="${h.gravatar_url(h.email(cs.author),20)}"/>
 
								</div>
 
								<span>${h.person(cs.author)}</span><br/>
 
								<span><a href="mailto:${h.email_or_none(cs.author)}">${h.email_or_none(cs.author)}</a></span><br/>
 
							</div>
 
							<div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
 
						</div>	
 
						<div class="right">
 
									<div class="changes">
 
									   % if len(cs.affected_files) <= c.affected_files_cut_off:						
 
										<span class="removed tooltip" title="<b>${_('removed')}</b>${h.changed_tooltip(cs.removed)}">${len(cs.removed)}</span>
 
										<span class="changed tooltip" title="<b>${_('changed')}</b>${h.changed_tooltip(cs.changed)}">${len(cs.changed)}</span>
 
										<span class="added tooltip" title="<b>${_('added')}</b>${h.changed_tooltip(cs.added)}">${len(cs.added)}</span>
 
									   % else:
 
				                         <span class="removed tooltip" title="${_('affected %s files') % len(cs.affected_files)}">!</span>
 
				                         <span class="changed tooltip" title="${_('affected %s files') % len(cs.affected_files)}">!</span>
 
				                         <span class="added tooltip"   title="${_('affected %s files') % len(cs.affected_files)}">!</span>  									   
 
									   % endif
 
									<div id="${cs.raw_id}_changes_info" class="changes">
 
                                        <span id="${cs.raw_id}" class="changed_total tooltip" 
 
                                        title="${_('Affected number of files, click to show more details')}">
 
                                        ${len(cs.affected_files)}
 
                                        </span>
 
									</div>					
 
										%if len(cs.parents)>1:
 
										<div class="merge">
 
											${_('merge')}<img alt="merge" src="${h.url("/images/icons/arrow_join.png")}"/>
 
											${_('merge')}<img alt="merge" src="${h.url('/images/icons/arrow_join.png')}"/>
 
										</div>
 
										%endif
 
								   %if cs.parents:							
 
									%for p_cs in reversed(cs.parents):
 
										<div class="parent">${_('Parent')} ${p_cs.revision}: ${h.link_to(h.short_id(p_cs.raw_id),
 
											h.url('changeset_home',repo_name=c.repo_name,revision=p_cs.raw_id),title=p_cs.message)}
 
										</div>
 
									%endfor
 
								   %else:	
 
                                        <div class="parent">${_('No parents')}</div>   
 
                                   %endif  
 
                    									
 
@@ -101,25 +96,25 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
				%endfor
 
				<div class="pagination-wh pagination-left">
 
					${c.pagination.pager('$link_previous ~2~ $link_next')}
 
				</div>			
 
				</div>
 
			</div>
 
			
 
			<script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
 
			<script type="text/javascript">
 
				YAHOO.util.Event.onDOMReady(function(){
 
					
 
                    //Monitor range checkboxes and build a link to changesets
 
                    //ranges
 
                    //ranges 
 
                    var checkboxes = YUD.getElementsByClassName('changeset_range');
 
                    var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
 
                    YUE.on(checkboxes,'click',function(e){      
 
                        var checked_checkboxes = [];
 
                        for (pos in checkboxes){
 
                            if(checkboxes[pos].checked){
 
                                checked_checkboxes.push(checkboxes[pos]);
 
                            }
 
                        }
 
                        if(checked_checkboxes.length>1){
 
                        	var rev_end = checked_checkboxes[0].name;
 
                        	var rev_start = checked_checkboxes[checked_checkboxes.length-1].name;
 
@@ -130,24 +125,33 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
                        var link = "<a href="+url+">${_('Show selected changes __S -> __E')}</a>"
 
                        link = link.replace('__S',rev_start);
 
                        link = link.replace('__E',rev_end);
 
                        YUD.get('rev_range_container').innerHTML = link;
 
                        YUD.setStyle('rev_range_container','display','');
 
                        }
 
                        else{
 
                        	YUD.setStyle('rev_range_container','display','none');
 
                        	
 
                        }
 
                    });					
 
					
 
                    //Fetch changeset details 
 
                    YUE.on(YUD.getElementsByClassName('changed_total'),'click',function(e){
 
                    	var id = e.currentTarget.id
 
                    	var url = "${h.url('changelog_details',repo_name=c.repo_name,cs='__CS__')}"
 
                    	var url = url.replace('__CS__',id);
 
                    	ypjax(url,id+'_changes_info',function(){tooltip_activate()});
 
                    });
 
                    
 
                    
 
					function set_canvas(heads) {
 
						var c = document.getElementById('graph_nodes');
 
						var t = document.getElementById('graph_content');
 
						canvas = document.getElementById('graph_canvas');
 
						var div_h = t.clientHeight;
 
						c.style.height=div_h+'px';
 
						canvas.setAttribute('height',div_h);
 
						c.style.height=max_w+'px';
 
						canvas.setAttribute('width',max_w);
 
					};
 
					var heads = 1;
 
					var max_heads = 0;
rhodecode/templates/changelog/changelog_details.html
Show inline comments
 
new file 100644
 
% if len(c.cs.affected_files) <= c.affected_files_cut_off:                     
 
<span class="removed tooltip" title="<b>${_('removed')}</b>${h.changed_tooltip(c.cs.removed)}">${len(c.cs.removed)}</span>
 
<span class="changed tooltip" title="<b>${_('changed')}</b>${h.changed_tooltip(c.cs.changed)}">${len(c.cs.changed)}</span>
 
<span class="added tooltip" title="<b>${_('added')}</b>${h.changed_tooltip(c.cs.added)}">${len(c.cs.added)}</span>
 
% else:
 
 <span class="removed tooltip" title="${_('affected %s files') % len(c.cs.affected_files)}">!</span>
 
 <span class="changed tooltip" title="${_('affected %s files') % len(c.cs.affected_files)}">!</span>
 
 <span class="added tooltip"   title="${_('affected %s files') % len(c.cs.affected_files)}">!</span>                                         
 
% endif
 
\ No newline at end of file
0 comments (0 inline, 0 general)