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