diff --git a/development.ini b/development.ini --- a/development.ini +++ b/development.ini @@ -58,13 +58,34 @@ container_auth_enabled = false proxypass_auth_enabled = false ## overwrite schema of clone url -# available vars: -# scheme - http/https -# user - current user -# pass - password -# netloc - network location -# path - usually repo_name -# clone_uri = {scheme}://{user}{pass}{netloc}{path} +## available vars: +## scheme - http/https +## user - current user +## pass - password +## netloc - network location +## path - usually repo_name + +#clone_uri = {scheme}://{user}{pass}{netloc}{path} + +## issue tracking mapping for commits messages +## uncomment url_pat, issue_server, issue_prefix to enable + + +## pattern to get the issues from commit messages +## default one used here is #1234 + +#url_pat = (?:^#|\s#)(\w+) + +## server url to the issue, each {id} will be replaced with id +## fetched from the regex + +#issue_server = https://myissueserver.com/issue/{id} + +## prefix to add to link to indicate it's an url +## #314 will be replaced by + +#issue_prefix = # + #################################### ### CELERY CONFIG #### diff --git a/production.ini b/production.ini --- a/production.ini +++ b/production.ini @@ -58,13 +58,34 @@ container_auth_enabled = false proxypass_auth_enabled = false ## overwrite schema of clone url -# available vars: -# scheme - http/https -# user - current user -# pass - password -# netloc - network location -# path - usually repo_name -# clone_uri = {scheme}://{user}{pass}{netloc}{path} +## available vars: +## scheme - http/https +## user - current user +## pass - password +## netloc - network location +## path - usually repo_name + +#clone_uri = {scheme}://{user}{pass}{netloc}{path} + +## issue tracking mapping for commits messages +## uncomment url_pat, issue_server, issue_prefix to enable + + +## pattern to get the issues from commit messages +## default one used here is #1234 + +#url_pat = (?:^#|\s#)(\w+) + +## server url to the issue, each {id} will be replaced with id +## fetched from the regex + +#issue_server = https://myissueserver.com/issue/{id} + +## prefix to add to link to indicate it's an url +## #314 will be replaced by + +#issue_prefix = # + #################################### ### CELERY CONFIG #### diff --git a/rhodecode/config/deployment.ini_tmpl b/rhodecode/config/deployment.ini_tmpl --- a/rhodecode/config/deployment.ini_tmpl +++ b/rhodecode/config/deployment.ini_tmpl @@ -58,14 +58,35 @@ container_auth_enabled = false proxypass_auth_enabled = false ## overwrite schema of clone url -# available vars: -# scheme - http/https -# user - current user -# pass - password -# netloc - network location -# path - usually repo_name +## available vars: +## scheme - http/https +## user - current user +## pass - password +## netloc - network location +## path - usually repo_name + # clone_uri = {scheme}://{user}{pass}{netloc}{path} +## issue tracking mapping for commits messages +## uncomment url_pat, issue_server, issue_prefix to enable + + +## pattern to get the issues from commit messages +## default one used here is #1234 + +#url_pat = (?:^#|\s#)(\w+) + +## server url to the issue, each {id} will be replaced with id +## fetched from the regex + +#issue_server = https://myissueserver.com/issue/{id} + +## prefix to add to link to indicate it's an url +## #314 will be replaced by + +#issue_prefix = # + + #################################### ### CELERY CONFIG #### #################################### diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -8,6 +8,7 @@ import hashlib import StringIO import urllib import math +import logging from datetime import datetime from pygments.formatters.html import HtmlFormatter @@ -41,6 +42,8 @@ from rhodecode.lib.utils import repo_nam from rhodecode.lib import str2bool, safe_unicode, safe_str, get_changeset_safe from rhodecode.lib.markup_renderer import MarkupRenderer +log = logging.getLogger(__name__) + def _reset(name, value=None, id=NotGiven, type="reset", **attrs): """ @@ -740,6 +743,33 @@ def urlify_text(text): return literal(url_pat.sub(url_func, text)) +def urlify_commit(text): + import re + import traceback + + try: + conf = config['app_conf'] + + URL_PAT = re.compile(r'%s' % conf.get('url_pat')) + + if URL_PAT: + ISSUE_SERVER = conf.get('issue_server') + ISSUE_PREFIX = conf.get('issue_prefix') + def url_func(match_obj): + issue_id = match_obj.groups()[0] + return ' %(issue-prefix)s%(id-repr)s' % ( + {'url':ISSUE_SERVER.replace('{id}',issue_id), + 'id-repr':issue_id, + 'issue-prefix':ISSUE_PREFIX, + 'serv':ISSUE_SERVER, + } + ) + return literal(URL_PAT.sub(url_func, text)) + except: + log.error(traceback.format_exc()) + pass + + return text def rst(source): return literal('
%s
' % diff --git a/rhodecode/public/css/style.css b/rhodecode/public/css/style.css --- a/rhodecode/public/css/style.css +++ b/rhodecode/public/css/style.css @@ -2146,8 +2146,6 @@ h3.files_location { } #changeset_content .container .left .message { - font-style: italic; - color: #556CB5; white-space: pre-wrap; } #changeset_content .container .left .message a:hover { diff --git a/rhodecode/templates/changelog/changelog.html b/rhodecode/templates/changelog/changelog.html --- a/rhodecode/templates/changelog/changelog.html +++ b/rhodecode/templates/changelog/changelog.html @@ -48,7 +48,7 @@
${h.checkbox(cs.short_id,class_="changeset_range")} - ${_('commit')} ${cs.revision}: ${h.short_id(cs.raw_id)}@${cs.date} + ${cs.revision}:${h.short_id(cs.raw_id)}
@@ -56,7 +56,7 @@
${h.person(cs.author)}
-
${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
+
${h.urlify_commit(h.wrap_paragraphs(cs.message))}
diff --git a/rhodecode/templates/changeset/changeset.html b/rhodecode/templates/changeset/changeset.html --- a/rhodecode/templates/changeset/changeset.html +++ b/rhodecode/templates/changeset/changeset.html @@ -52,7 +52,7 @@ ${h.person(c.changeset.author)}
${h.email_or_none(c.changeset.author)}
-
${h.link_to(h.wrap_paragraphs(c.changeset.message),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset.raw_id))}
+
${h.urlify_commit(h.wrap_paragraphs(c.changeset.message))}
diff --git a/rhodecode/templates/changeset/changeset_range.html b/rhodecode/templates/changeset/changeset_range.html --- a/rhodecode/templates/changeset/changeset_range.html +++ b/rhodecode/templates/changeset/changeset_range.html @@ -41,7 +41,7 @@ ${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))}
${h.person(cs.author)}
${cs.date} -
${h.link_to(h.wrap_paragraphs(cs.message),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
+
${h.urlify_commit(h.wrap_paragraphs(c.changeset.message))}
%endfor diff --git a/rhodecode/templates/shortlog/shortlog_data.html b/rhodecode/templates/shortlog/shortlog_data.html --- a/rhodecode/templates/shortlog/shortlog_data.html +++ b/rhodecode/templates/shortlog/shortlog_data.html @@ -2,16 +2,19 @@ %if c.repo_changesets: - + + - %for cnt,cs in enumerate(c.repo_changesets): + -
${_('commit message')}${_('revision')}${_('commit message')} ${_('age')} ${_('author')}${_('revision')} ${_('branch')} ${_('tags')}
+ + ${h.link_to(h.truncate(cs.message,50), h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id), title=cs.message)} @@ -20,7 +23,6 @@ ${h.age(cs.date)} ${h.person(cs.author)} ${cs.branch}