##// END OF EJS Templates
added links to revisions in commit messages
marcink -
r1913:08344d03 beta
parent child Browse files
Show More
@@ -742,14 +742,48 b' def urlify_text(text_):'
742
742
743 return literal(url_pat.sub(url_func, text_))
743 return literal(url_pat.sub(url_func, text_))
744
744
745 def urlify_changesets(text_, repository):
746 import re
747 URL_PAT = re.compile(r'([0-9a-fA-F]{12,})')
748
749 def url_func(match_obj):
750 rev = match_obj.groups()[0]
751 pref = ''
752 if match_obj.group().startswith(' '):
753 pref = ' '
754 tmpl = (
755 '%(pref)s<a class="%(cls)s" href="%(url)s">'
756 '%(rev)s'
757 '</a>'
758 )
759 return tmpl % {
760 'pref': pref,
761 'cls': 'revision-link',
762 'url': url('changeset_home', repo_name=repository, revision=rev),
763 'rev': rev,
764 }
765
766 newtext = URL_PAT.sub(url_func, text_)
767
768 return newtext
745
769
746 def urlify_commit(text_, repository=None, link_=None):
770 def urlify_commit(text_, repository=None, link_=None):
747 import re
771 import re
748 import traceback
772 import traceback
749
773
750 if link_:
774 # urlify changesets
751 link_ = '<a href="' + link_ + '">'
775 text_ = urlify_changesets(text_, repository)
752
776
777 def linkify_others(t,l):
778 urls = re.compile(r'(\<a.*?\<\/a\>)',)
779 links = []
780 for e in urls.split(t):
781 if not urls.match(e):
782 links.append('<a class="message-link" href="%s">%s</a>' % (l,e))
783 else:
784 links.append(e)
785
786 return ''.join(links)
753 try:
787 try:
754 conf = config['app_conf']
788 conf = config['app_conf']
755
789
@@ -774,22 +808,20 b' def urlify_commit(text_, repository=None'
774 if repository:
808 if repository:
775 url = url.replace('{repo}', repository)
809 url = url.replace('{repo}', repository)
776
810
777 if link_:
811 return tmpl % {
778 tmpl = '</a>' + tmpl + link_
779
780 return tmpl % (
781 {
782 'pref': pref,
812 'pref': pref,
783 'cls': 'issue-tracker-link',
813 'cls': 'issue-tracker-link',
784 'url': url,
814 'url': url,
785 'id-repr': issue_id,
815 'id-repr': issue_id,
786 'issue-prefix': ISSUE_PREFIX,
816 'issue-prefix': ISSUE_PREFIX,
787 'serv': ISSUE_SERVER_LNK,
817 'serv': ISSUE_SERVER_LNK,
788 }
818 }
789 )
819
790 newtext = URL_PAT.sub(url_func, text_)
820 newtext = URL_PAT.sub(url_func, text_)
791 if link_:
821
792 newtext = link_ + newtext + '</a>'
822 # wrap not links into final link => link_
823 newtext = linkify_others(newtext, link_)
824
793 return literal(newtext)
825 return literal(newtext)
794 except:
826 except:
795 log.error(traceback.format_exc())
827 log.error(traceback.format_exc())
@@ -2328,9 +2328,17 b' h3.files_location {'
2328 #graph_content .container .mid .message a:hover{
2328 #graph_content .container .mid .message a:hover{
2329 text-decoration: none;
2329 text-decoration: none;
2330 }
2330 }
2331
2331 #content #graph_content .message .revision-link,
2332 #content #graph_content .message .issue-tracker-link {
2332 #changeset_content .container .message .revision-link
2333 font-weight: bold !important;
2333 {
2334 color:#3F6F9F;
2335 font-weight: bold !important;
2336 }
2337
2338 #content #graph_content .message .issue-tracker-link,
2339 #changeset_content .container .message .issue-tracker-link{
2340 color:#3F6F9F;
2341 font-weight: bold !important;
2334 }
2342 }
2335
2343
2336 .right .comments-container{
2344 .right .comments-container{
General Comments 0
You need to be logged in to leave comments. Login now