Changeset - 7a7ffe24b82c
[Not reviewed]
beta
0 6 0
Marcin Kuzminski - 14 years ago 2012-01-27 23:00:51
marcin@python-works.com
optimized speed for browsing git changesets
6 files changed with 47 insertions and 17 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -329,6 +329,26 @@ short_id = lambda x: x[:12]
 
hide_credentials = lambda x: ''.join(credentials_filter(x))
 

	
 

	
 
def is_git(repository):
 
    if hasattr(repository, 'alias'):
 
        _type = repository.alias
 
    elif hasattr(repository, 'repo_type'):
 
        _type = repository.repo_type
 
    else:
 
        _type = repository
 
    return _type == 'git'
 

	
 

	
 
def is_hg(repository):
 
    if hasattr(repository, 'alias'):
 
        _type = repository.alias
 
    elif hasattr(repository, 'repo_type'):
 
        _type = repository.repo_type
 
    else:
 
        _type = repository
 
    return _type == 'hg'
 

	
 

	
 
def email_or_none(author):
 
    _email = email(author)
 
    if _email != '':
 
@@ -366,6 +386,7 @@ def person(author):
 
    # Still nothing?  Just pass back the author name then
 
    return _author
 

	
 

	
 
def bool2icon(value):
 
    """Returns True/False values represented as small html image of true/false
 
    icons
 
@@ -487,6 +508,7 @@ def action_parser(user_log, feed=False):
 

	
 
    return [literal(action), action_params_func]
 

	
 

	
 
def action_parser_icon(user_log):
 
    action = user_log.action
 
    action_params = None
 
@@ -522,6 +544,7 @@ def action_parser_icon(user_log):
 
from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \
 
HasRepoPermissionAny, HasRepoPermissionAll
 

	
 

	
 
#==============================================================================
 
# GRAVATAR URL
 
#==============================================================================
 
@@ -652,7 +675,6 @@ def changed_tooltip(nodes):
 
        return ': ' + _('No Files')
 

	
 

	
 

	
 
def repo_link(groups_and_repos):
 
    """
 
    Makes a breadcrumbs link to repo within a group
 
@@ -674,6 +696,7 @@ def repo_link(groups_and_repos):
 
        return literal(' » '.join(map(make_link, groups)) + \
 
                       " » " + repo_name)
 

	
 

	
 
def fancy_file_stats(stats):
 
    """
 
    Displays a fancy two colored bar for number of added/deleted
 
@@ -701,7 +724,6 @@ def fancy_file_stats(stats):
 
    a_v = a if a > 0 else ''
 
    d_v = d if d > 0 else ''
 

	
 

	
 
    def cgen(l_type):
 
        mapping = {'tr':'top-right-rounded-corner',
 
                   'tl':'top-left-rounded-corner',
 
@@ -722,12 +744,12 @@ def fancy_file_stats(stats):
 
        if l_type == 'd' and not a_v:
 
            return ' '.join(map(map_getter, ['tr', 'br', 'tl', 'bl']))
 

	
 

	
 

	
 
    d_a = '<div class="added %s" style="width:%s%%">%s</div>' % (cgen('a'),
 
                                                                 a_p, a_v)
 
    d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % (cgen('d'),
 
                                                                   d_p, d_v)
 
    d_a = '<div class="added %s" style="width:%s%%">%s</div>' % (
 
        cgen('a'),a_p, a_v
 
    )
 
    d_d = '<div class="deleted %s" style="width:%s%%">%s</div>' % (
 
        cgen('d'),d_p, d_v
 
    )
 
    return literal('<div style="width:%spx">%s%s</div>' % (width, d_a, d_d))
 

	
 

	
 
@@ -743,6 +765,7 @@ def urlify_text(text_):
 

	
 
    return literal(url_pat.sub(url_func, text_))
 

	
 

	
 
def urlify_changesets(text_, repository):
 
    import re
 
    URL_PAT = re.compile(r'([0-9a-fA-F]{12,})')
 
@@ -768,6 +791,7 @@ def urlify_changesets(text_, repository)
 

	
 
    return newtext
 

	
 

	
 
def urlify_commit(text_, repository=None, link_=None):
 
    import re
 
    import traceback
rhodecode/templates/_data_table/_dt_elements.html
Show inline comments
 
@@ -43,9 +43,9 @@
 
<%def name="repo_name(name,rtype,private,fork_of)">
 
  <div style="white-space: nowrap">
 
   ##TYPE OF REPO
 
   %if rtype =='hg':
 
   %if h.is_hg(rtype):
 
     <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
 
   %elif rtype =='git':
 
   %elif h.is_git(rtype):
 
     <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
 
   %endif
 

	
rhodecode/templates/changelog/changelog.html
Show inline comments
 
@@ -91,7 +91,7 @@ ${c.repo_name} ${_('Changelog')} - ${c.r
 
									%if len(cs.parents)>1:
 
									<span class="merge">${_('merge')}</span>
 
									%endif
 
									%if cs.branch:
 
									%if h.is_hg(c.rhodecode_repo) and cs.branch:
 
									<span class="branchtag" title="${'%s %s' % (_('branch'),cs.branch)}">
 
									   ${h.link_to(cs.branch,h.url('files_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
 
									%endif
rhodecode/templates/journal/journal.html
Show inline comments
 
@@ -113,9 +113,9 @@
 
                        </span>
 
                        </div>
 

	
 
                         %if entry.follows_repository.repo_type == 'hg':
 
                         %if h.is_hg(entry.follows_repository):
 
                           <img class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
 
                         %elif entry.follows_repository.repo_type == 'git':
 
                         %elif h.is_git(entry.follows_repository):
 
                           <img class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
 
                         %endif
 

	
rhodecode/templates/shortlog/shortlog_data.html
Show inline comments
 
@@ -15,7 +15,9 @@
 
            <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>
 
        </td>
 
        <td>
 
        ${h.urlify_commit(h.truncate(cs.message,50),c.repo_name,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
 
            ${h.link_to(h.truncate(cs.message,50),
 
            h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
 
            title=cs.message)}
 
        </td>
 
        <td><span class="tooltip" title="${cs.date}">
 
                      ${h.age(cs.date)}</span>
 
@@ -23,7 +25,11 @@
 
		<td title="${cs.author}">${h.person(cs.author)}</td>
 
		<td>
 
			<span class="logtags">
 
				<span class="branchtag">${cs.branch}</span>
 
				<span class="branchtag">
 
                %if h.is_hg(c.rhodecode_repo):
 
                    ${cs.branch}
 
                %endif
 
                </span>
 
			</span>
 
		</td>
 
		<td>
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -59,10 +59,10 @@
 
                      %endif
 
                  %endif:
 
                 ##REPO TYPE
 
		         %if c.dbrepo.repo_type =='hg':
 
		         %if h.is_hg(c.dbrepo):
 
		           <img style="margin-bottom:2px" class="icon" title="${_('Mercurial repository')}" alt="${_('Mercurial repository')}" src="${h.url('/images/icons/hgicon.png')}"/>
 
		         %endif
 
		         %if c.dbrepo.repo_type =='git':
 
		         %if h.is_git(c.dbrepo):
 
		           <img style="margin-bottom:2px" class="icon" title="${_('Git repository')}" alt="${_('Git repository')}" src="${h.url('/images/icons/giticon.png')}"/>
 
		         %endif
 

	
0 comments (0 inline, 0 general)