##// END OF EJS Templates
optimized speed for browsing git changesets
marcink -
r1959:7a7ffe24 beta
parent child Browse files
Show More
@@ -329,6 +329,26 b' short_id = lambda x: x[:12]'
329 hide_credentials = lambda x: ''.join(credentials_filter(x))
329 hide_credentials = lambda x: ''.join(credentials_filter(x))
330
330
331
331
332 def is_git(repository):
333 if hasattr(repository, 'alias'):
334 _type = repository.alias
335 elif hasattr(repository, 'repo_type'):
336 _type = repository.repo_type
337 else:
338 _type = repository
339 return _type == 'git'
340
341
342 def is_hg(repository):
343 if hasattr(repository, 'alias'):
344 _type = repository.alias
345 elif hasattr(repository, 'repo_type'):
346 _type = repository.repo_type
347 else:
348 _type = repository
349 return _type == 'hg'
350
351
332 def email_or_none(author):
352 def email_or_none(author):
333 _email = email(author)
353 _email = email(author)
334 if _email != '':
354 if _email != '':
@@ -366,6 +386,7 b' def person(author):'
366 # Still nothing? Just pass back the author name then
386 # Still nothing? Just pass back the author name then
367 return _author
387 return _author
368
388
389
369 def bool2icon(value):
390 def bool2icon(value):
370 """Returns True/False values represented as small html image of true/false
391 """Returns True/False values represented as small html image of true/false
371 icons
392 icons
@@ -487,6 +508,7 b' def action_parser(user_log, feed=False):'
487
508
488 return [literal(action), action_params_func]
509 return [literal(action), action_params_func]
489
510
511
490 def action_parser_icon(user_log):
512 def action_parser_icon(user_log):
491 action = user_log.action
513 action = user_log.action
492 action_params = None
514 action_params = None
@@ -522,6 +544,7 b' def action_parser_icon(user_log):'
522 from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \
544 from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \
523 HasRepoPermissionAny, HasRepoPermissionAll
545 HasRepoPermissionAny, HasRepoPermissionAll
524
546
547
525 #==============================================================================
548 #==============================================================================
526 # GRAVATAR URL
549 # GRAVATAR URL
527 #==============================================================================
550 #==============================================================================
@@ -652,7 +675,6 b' def changed_tooltip(nodes):'
652 return ': ' + _('No Files')
675 return ': ' + _('No Files')
653
676
654
677
655
656 def repo_link(groups_and_repos):
678 def repo_link(groups_and_repos):
657 """
679 """
658 Makes a breadcrumbs link to repo within a group
680 Makes a breadcrumbs link to repo within a group
@@ -674,6 +696,7 b' def repo_link(groups_and_repos):'
674 return literal(' » '.join(map(make_link, groups)) + \
696 return literal(' » '.join(map(make_link, groups)) + \
675 " » " + repo_name)
697 " » " + repo_name)
676
698
699
677 def fancy_file_stats(stats):
700 def fancy_file_stats(stats):
678 """
701 """
679 Displays a fancy two colored bar for number of added/deleted
702 Displays a fancy two colored bar for number of added/deleted
@@ -701,13 +724,12 b' def fancy_file_stats(stats):'
701 a_v = a if a > 0 else ''
724 a_v = a if a > 0 else ''
702 d_v = d if d > 0 else ''
725 d_v = d if d > 0 else ''
703
726
704
705 def cgen(l_type):
727 def cgen(l_type):
706 mapping = {'tr':'top-right-rounded-corner',
728 mapping = {'tr': 'top-right-rounded-corner',
707 'tl':'top-left-rounded-corner',
729 'tl': 'top-left-rounded-corner',
708 'br':'bottom-right-rounded-corner',
730 'br': 'bottom-right-rounded-corner',
709 'bl':'bottom-left-rounded-corner'}
731 'bl': 'bottom-left-rounded-corner'}
710 map_getter = lambda x:mapping[x]
732 map_getter = lambda x: mapping[x]
711
733
712 if l_type == 'a' and d_v:
734 if l_type == 'a' and d_v:
713 #case when added and deleted are present
735 #case when added and deleted are present
@@ -722,12 +744,12 b' def fancy_file_stats(stats):'
722 if l_type == 'd' and not a_v:
744 if l_type == 'd' and not a_v:
723 return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl']))
745 return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl']))
724
746
725
747 d_a = '<div class="added %s" style="width:%s%%">%s</div>' % (
726
748 cgen('a'),a_p, a_v
727 d_a = '<div class="added %s" style="width:%s%%">%s</div>' % (cgen('a'),
749 )
728 a_p, a_v)
750 d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % (
729 d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % (cgen('d'),
751 cgen('d'),d_p, d_v
730 d_p, d_v)
752 )
731 return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d))
753 return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d))
732
754
733
755
@@ -743,6 +765,7 b' def urlify_text(text_):'
743
765
744 return literal(url_pat.sub(url_func, text_))
766 return literal(url_pat.sub(url_func, text_))
745
767
768
746 def urlify_changesets(text_, repository):
769 def urlify_changesets(text_, repository):
747 import re
770 import re
748 URL_PAT = re.compile(r'([0-9a-fA-F]{12,})')
771 URL_PAT = re.compile(r'([0-9a-fA-F]{12,})')
@@ -768,6 +791,7 b' def urlify_changesets(text_, repository)'
768
791
769 return newtext
792 return newtext
770
793
794
771 def urlify_commit(text_, repository=None, link_=None):
795 def urlify_commit(text_, repository=None, link_=None):
772 import re
796 import re
773 import traceback
797 import traceback
@@ -43,9 +43,9 b''
43 <%def name="repo_name(name,rtype,private,fork_of)">
43 <%def name="repo_name(name,rtype,private,fork_of)">
44 <div style="white-space: nowrap">
44 <div style="white-space: nowrap">
45 ##TYPE OF REPO
45 ##TYPE OF REPO
46 %if rtype =='hg':
46 %if h.is_hg(rtype):
47 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
47 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
48 %elif rtype =='git':
48 %elif h.is_git(rtype):
49 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
49 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
50 %endif
50 %endif
51
51
@@ -91,7 +91,7 b''
91 %if len(cs.parents)>1:
91 %if len(cs.parents)>1:
92 <span class="merge">${_('merge')}</span>
92 <span class="merge">${_('merge')}</span>
93 %endif
93 %endif
94 %if cs.branch:
94 %if h.is_hg(c.rhodecode_repo) and cs.branch:
95 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
95 <span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
96 ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
96 ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
97 %endif
97 %endif
@@ -113,9 +113,9 b''
113 </span>
113 </span>
114 </div>
114 </div>
115
115
116 %if entry.follows_repository.repo_type == 'hg':
116 %if h.is_hg(entry.follows_repository):
117 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
117 <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
118 %elif entry.follows_repository.repo_type == 'git':
118 %elif h.is_git(entry.follows_repository):
119 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
119 <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
120 %endif
120 %endif
121
121
@@ -15,7 +15,9 b''
15 <div><pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id)}">r${cs.revision}:${h.short_id(cs.raw_id)}</a></pre></div>
15 <div><pre><a href="${h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id)}">r${cs.revision}:${h.short_id(cs.raw_id)}</a></pre></div>
16 </td>
16 </td>
17 <td>
17 <td>
18 ${h.urlify_commit(h.truncate(cs.message,50),c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
18 ${h.link_to(h.truncate(cs.message,50),
19 h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
20 title=cs.message)}
19 </td>
21 </td>
20 <td><span class="tooltip" title="${cs.date}">
22 <td><span class="tooltip" title="${cs.date}">
21 ${h.age(cs.date)}</span>
23 ${h.age(cs.date)}</span>
@@ -23,7 +25,11 b''
23 <td title="${cs.author}">${h.person(cs.author)}</td>
25 <td title="${cs.author}">${h.person(cs.author)}</td>
24 <td>
26 <td>
25 <span class="logtags">
27 <span class="logtags">
26 <span class="branchtag">${cs.branch}</span>
28 <span class="branchtag">
29 %if h.is_hg(c.rhodecode_repo):
30 ${cs.branch}
31 %endif
32 </span>
27 </span>
33 </span>
28 </td>
34 </td>
29 <td>
35 <td>
@@ -59,10 +59,10 b''
59 %endif
59 %endif
60 %endif:
60 %endif:
61 ##REPO TYPE
61 ##REPO TYPE
62 %if c.dbrepo.repo_type =='hg':
62 %if h.is_hg(c.dbrepo):
63 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
63 <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
64 %endif
64 %endif
65 %if c.dbrepo.repo_type =='git':
65 %if h.is_git(c.dbrepo):
66 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
66 <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
67 %endif
67 %endif
68
68
General Comments 0
You need to be logged in to leave comments. Login now