Changeset - 08344d037ba1
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2012-01-19 04:43:27
marcin@python-works.com
added links to revisions in commit messages
2 files changed with 55 insertions and 15 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -739,20 +739,54 @@ def urlify_text(text_):
 
    def url_func(match_obj):
 
        url_full = match_obj.groups()[0]
 
        return '<a href="%(url)s">%(url)s</a>' % ({'url': url_full})
 

	
 
    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,})')
 

	
 
    def url_func(match_obj):
 
        rev = match_obj.groups()[0]
 
        pref = ''
 
        if match_obj.group().startswith(' '):
 
            pref = ' '
 
        tmpl = (
 
        '%(pref)s<a class="%(cls)s" href="%(url)s">'
 
        '%(rev)s'
 
        '</a>'
 
        )
 
        return tmpl % {
 
         'pref': pref,
 
         'cls': 'revision-link',
 
         'url': url('changeset_home', repo_name=repository, revision=rev),
 
         'rev': rev,
 
        }
 

	
 
    newtext = URL_PAT.sub(url_func, text_)
 

	
 
    return newtext
 

	
 
def urlify_commit(text_, repository=None, link_=None):
 
    import re
 
    import traceback
 

	
 
    if link_:
 
        link_ = '<a href="' + link_ + '">'
 

	
 
    # urlify changesets
 
    text_ = urlify_changesets(text_, repository)
 
        
 
    def linkify_others(t,l):
 
        urls = re.compile(r'(\<a.*?\<\/a\>)',)
 
        links = []
 
        for e in urls.split(t):
 
            if not urls.match(e):
 
                links.append('<a class="message-link" href="%s">%s</a>' % (l,e))
 
            else:
 
                links.append(e)        
 
        
 
        return ''.join(links)
 
    try:
 
        conf = config['app_conf']
 

	
 
        URL_PAT = re.compile(r'%s' % conf.get('url_pat'))
 

	
 
        if URL_PAT:
 
@@ -771,28 +805,26 @@ def urlify_commit(text_, repository=None
 
                '</a>'
 
                )
 
                url = ISSUE_SERVER_LNK.replace('{id}', issue_id)
 
                if repository:
 
                    url = url.replace('{repo}', repository)
 

	
 
                if link_:
 
                    tmpl = '</a>' + tmpl + link_
 

	
 
                return tmpl % (
 
                    {
 
                return tmpl % {
 
                     'pref': pref,
 
                     'cls': 'issue-tracker-link',
 
                     'url': url,
 
                     'id-repr': issue_id,
 
                     'issue-prefix': ISSUE_PREFIX,
 
                     'serv': ISSUE_SERVER_LNK,
 
                    }
 
                )
 
                }
 
                
 
            newtext = URL_PAT.sub(url_func, text_)
 
            if link_:
 
                newtext = link_ + newtext + '</a>'
 
            
 
            # wrap not links into final link => link_
 
            newtext = linkify_others(newtext, link_)
 
            
 
            return literal(newtext)
 
    except:
 
        log.error(traceback.format_exc())
 
        pass
 

	
 
    return text_
rhodecode/public/css/style.css
Show inline comments
 
@@ -2325,15 +2325,23 @@ h3.files_location {
 
	white-space: pre-wrap;
 
}
 
 
#graph_content .container .mid .message a:hover{
 
	text-decoration: none;
 
}
 
 
#content #graph_content .message .issue-tracker-link {
 
	font-weight: bold !important;
 
#content #graph_content .message .revision-link,
 
#changeset_content .container .message .revision-link
 
 {
 
	color:#3F6F9F;
 
    font-weight: bold !important;
 
}
 
 
#content #graph_content .message .issue-tracker-link,
 
#changeset_content .container .message .issue-tracker-link{
 
    color:#3F6F9F;
 
    font-weight: bold !important;
 
}
 
 
.right .comments-container{
 
	padding-right: 5px;
 
	margin-top:1px;
 
	float:right;
0 comments (0 inline, 0 general)