##// END OF EJS Templates
#73 mapping of commited issues from commit message into issue tracker url.
marcink -
r1837:a6a30c91 beta
parent child Browse files
Show More
@@ -58,14 +58,35 b' container_auth_enabled = false'
58 proxypass_auth_enabled = false
58 proxypass_auth_enabled = false
59
59
60 ## overwrite schema of clone url
60 ## overwrite schema of clone url
61 # available vars:
61 ## available vars:
62 # scheme - http/https
62 ## scheme - http/https
63 # user - current user
63 ## user - current user
64 # pass - password
64 ## pass - password
65 # netloc - network location
65 ## netloc - network location
66 # path - usually repo_name
66 ## path - usually repo_name
67
67 # clone_uri = {scheme}://{user}{pass}{netloc}{path}
68 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
68
69
70 ## issue tracking mapping for commits messages
71 ## uncomment url_pat, issue_server, issue_prefix to enable
72
73
74 ## pattern to get the issues from commit messages
75 ## default one used here is #1234
76
77 #url_pat = (?:^#|\s#)(\w+)
78
79 ## server url to the issue, each {id} will be replaced with id
80 ## fetched from the regex
81
82 #issue_server = https://myissueserver.com/issue/{id}
83
84 ## prefix to add to link to indicate it's an url
85 ## #314 will be replaced by <issue_prefix><id>
86
87 #issue_prefix = #
88
89
69 ####################################
90 ####################################
70 ### CELERY CONFIG ####
91 ### CELERY CONFIG ####
71 ####################################
92 ####################################
@@ -58,14 +58,35 b' container_auth_enabled = false'
58 proxypass_auth_enabled = false
58 proxypass_auth_enabled = false
59
59
60 ## overwrite schema of clone url
60 ## overwrite schema of clone url
61 # available vars:
61 ## available vars:
62 # scheme - http/https
62 ## scheme - http/https
63 # user - current user
63 ## user - current user
64 # pass - password
64 ## pass - password
65 # netloc - network location
65 ## netloc - network location
66 # path - usually repo_name
66 ## path - usually repo_name
67
67 # clone_uri = {scheme}://{user}{pass}{netloc}{path}
68 #clone_uri = {scheme}://{user}{pass}{netloc}{path}
68
69
70 ## issue tracking mapping for commits messages
71 ## uncomment url_pat, issue_server, issue_prefix to enable
72
73
74 ## pattern to get the issues from commit messages
75 ## default one used here is #1234
76
77 #url_pat = (?:^#|\s#)(\w+)
78
79 ## server url to the issue, each {id} will be replaced with id
80 ## fetched from the regex
81
82 #issue_server = https://myissueserver.com/issue/{id}
83
84 ## prefix to add to link to indicate it's an url
85 ## #314 will be replaced by <issue_prefix><id>
86
87 #issue_prefix = #
88
89
69 ####################################
90 ####################################
70 ### CELERY CONFIG ####
91 ### CELERY CONFIG ####
71 ####################################
92 ####################################
@@ -58,14 +58,35 b' container_auth_enabled = false'
58 proxypass_auth_enabled = false
58 proxypass_auth_enabled = false
59
59
60 ## overwrite schema of clone url
60 ## overwrite schema of clone url
61 # available vars:
61 ## available vars:
62 # scheme - http/https
62 ## scheme - http/https
63 # user - current user
63 ## user - current user
64 # pass - password
64 ## pass - password
65 # netloc - network location
65 ## netloc - network location
66 # path - usually repo_name
66 ## path - usually repo_name
67
67 # clone_uri = {scheme}://{user}{pass}{netloc}{path}
68 # clone_uri = {scheme}://{user}{pass}{netloc}{path}
68
69
70 ## issue tracking mapping for commits messages
71 ## uncomment url_pat, issue_server, issue_prefix to enable
72
73
74 ## pattern to get the issues from commit messages
75 ## default one used here is #1234
76
77 #url_pat = (?:^#|\s#)(\w+)
78
79 ## server url to the issue, each {id} will be replaced with id
80 ## fetched from the regex
81
82 #issue_server = https://myissueserver.com/issue/{id}
83
84 ## prefix to add to link to indicate it's an url
85 ## #314 will be replaced by <issue_prefix><id>
86
87 #issue_prefix = #
88
89
69 ####################################
90 ####################################
70 ### CELERY CONFIG ####
91 ### CELERY CONFIG ####
71 ####################################
92 ####################################
@@ -8,6 +8,7 b' import hashlib'
8 import StringIO
8 import StringIO
9 import urllib
9 import urllib
10 import math
10 import math
11 import logging
11
12
12 from datetime import datetime
13 from datetime import datetime
13 from pygments.formatters.html import HtmlFormatter
14 from pygments.formatters.html import HtmlFormatter
@@ -41,6 +42,8 b' from rhodecode.lib.utils import repo_nam'
41 from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe
42 from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe
42 from rhodecode.lib.markup_renderer import MarkupRenderer
43 from rhodecode.lib.markup_renderer import MarkupRenderer
43
44
45 log = logging.getLogger(__name__)
46
44
47
45 def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
48 def _reset(name, value=None, id=NotGiven, type="reset", **attrs):
46 """
49 """
@@ -740,6 +743,33 b' def urlify_text(text):'
740
743
741 return literal(url_pat.sub(url_func, text))
744 return literal(url_pat.sub(url_func, text))
742
745
746 def urlify_commit(text):
747 import re
748 import traceback
749
750 try:
751 conf = config['app_conf']
752
753 URL_PAT = re.compile(r'%s' % conf.get('url_pat'))
754
755 if URL_PAT:
756 ISSUE_SERVER = conf.get('issue_server')
757 ISSUE_PREFIX = conf.get('issue_prefix')
758 def url_func(match_obj):
759 issue_id = match_obj.groups()[0]
760 return ' <a href="%(url)s">%(issue-prefix)s%(id-repr)s</a>' % (
761 {'url':ISSUE_SERVER.replace('{id}',issue_id),
762 'id-repr':issue_id,
763 'issue-prefix':ISSUE_PREFIX,
764 'serv':ISSUE_SERVER,
765 }
766 )
767 return literal(URL_PAT.sub(url_func, text))
768 except:
769 log.error(traceback.format_exc())
770 pass
771
772 return text
743
773
744 def rst(source):
774 def rst(source):
745 return literal('<div class="rst-block">%s</div>' %
775 return literal('<div class="rst-block">%s</div>' %
@@ -2146,8 +2146,6 b' h3.files_location {'
2146 }
2146 }
2147
2147
2148 #changeset_content .container .left .message {
2148 #changeset_content .container .left .message {
2149 font-style: italic;
2150 color: #556CB5;
2151 white-space: pre-wrap;
2149 white-space: pre-wrap;
2152 }
2150 }
2153 #changeset_content .container .left .message a:hover {
2151 #changeset_content .container .left .message a:hover {
@@ -48,7 +48,7 b''
48 <div class="left">
48 <div class="left">
49 <div class="date">
49 <div class="date">
50 ${h.checkbox(cs.short_id,class_="changeset_range")}
50 ${h.checkbox(cs.short_id,class_="changeset_range")}
51 <span>${_('commit')} ${cs.revision}: ${h.short_id(cs.raw_id)}@${cs.date}</span>
51 <span class="tooltip" title="${cs.date}"><a href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">${cs.revision}:${h.short_id(cs.raw_id)}</a></span>
52 </div>
52 </div>
53 <div class="author">
53 <div class="author">
54 <div class="gravatar">
54 <div class="gravatar">
@@ -56,7 +56,7 b''
56 </div>
56 </div>
57 <div title="${cs.author}" class="user">${h.person(cs.author)}</div>
57 <div title="${cs.author}" class="user">${h.person(cs.author)}</div>
58 </div>
58 </div>
59 <div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
59 <div class="message">${h.urlify_commit(h.wrap_paragraphs(cs.message))}</div>
60 </div>
60 </div>
61 <div class="right">
61 <div class="right">
62 <div id="${cs.raw_id}_changes_info" class="changes">
62 <div id="${cs.raw_id}_changes_info" class="changes">
@@ -52,7 +52,7 b''
52 <span>${h.person(c.changeset.author)}</span><br/>
52 <span>${h.person(c.changeset.author)}</span><br/>
53 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
53 <span><a href="mailto:${h.email_or_none(c.changeset.author)}">${h.email_or_none(c.changeset.author)}</a></span><br/>
54 </div>
54 </div>
55 <div class="message">${h.link_to(h.wrap_paragraphs(c.changeset.message),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}</div>
55 <div class="message">${h.urlify_commit(h.wrap_paragraphs(c.changeset.message))}</div>
56 </div>
56 </div>
57 <div class="right">
57 <div class="right">
58 <div class="changes">
58 <div class="changes">
@@ -41,7 +41,7 b''
41 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
41 <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
42 <td><div class="author">${h.person(cs.author)}</div></td>
42 <td><div class="author">${h.person(cs.author)}</div></td>
43 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
43 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
44 <td><div class="message">${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div></td>
44 <td><div class="message">${h.urlify_commit(h.wrap_paragraphs(c.changeset.message))}</div></td>
45 </tr>
45 </tr>
46 %endfor
46 %endfor
47 </table>
47 </table>
@@ -2,16 +2,19 b''
2 %if c.repo_changesets:
2 %if c.repo_changesets:
3 <table class="table_disp">
3 <table class="table_disp">
4 <tr>
4 <tr>
5 <th class="left">${_('revision')}</th>
5 <th class="left">${_('commit message')}</th>
6 <th class="left">${_('commit message')}</th>
6 <th class="left">${_('age')}</th>
7 <th class="left">${_('age')}</th>
7 <th class="left">${_('author')}</th>
8 <th class="left">${_('author')}</th>
8 <th class="left">${_('revision')}</th>
9 <th class="left">${_('branch')}</th>
9 <th class="left">${_('branch')}</th>
10 <th class="left">${_('tags')}</th>
10 <th class="left">${_('tags')}</th>
11 </tr>
11 </tr>
12 %for cnt,cs in enumerate(c.repo_changesets):
12 %for cnt,cs in enumerate(c.repo_changesets):
13 <tr class="parity${cnt%2}">
13 <tr class="parity${cnt%2}">
14 <td>
14 <td>
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>
17 <td>
15 ${h.link_to(h.truncate(cs.message,50),
18 ${h.link_to(h.truncate(cs.message,50),
16 h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
19 h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id),
17 title=cs.message)}
20 title=cs.message)}
@@ -20,7 +23,6 b''
20 ${h.age(cs.date)}</span>
23 ${h.age(cs.date)}</span>
21 </td>
24 </td>
22 <td title="${cs.author}">${h.person(cs.author)}</td>
25 <td title="${cs.author}">${h.person(cs.author)}</td>
23 <td><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>
24 <td>
26 <td>
25 <span class="logtags">
27 <span class="logtags">
26 <span class="branchtag">${cs.branch}</span>
28 <span class="branchtag">${cs.branch}</span>
General Comments 0
You need to be logged in to leave comments. Login now