Mercurial > kallithea
changeset 2339:79b3c9c66c54 beta
Added optional repo_name into issue tracker url to get just the name of repo without group prefix
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 25 May 2012 18:59:15 +0200 |
parents | 347b00545b60 |
children | 93243e162068 |
files | development.ini production.ini rhodecode/config/deployment.ini_tmpl rhodecode/lib/helpers.py rhodecode/model/db.py |
diffstat | 5 files changed, 16 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/development.ini Fri May 25 18:44:07 2012 +0200 +++ b/development.ini Fri May 25 18:59:15 2012 +0200 @@ -46,6 +46,8 @@ use = egg:rhodecode full_stack = true static_files = true +# Optional Languages +# en, fr, pt_BR, zh_CN, zh_TW lang = en cache_dir = %(here)s/data index_dir = %(here)s/data/index @@ -78,7 +80,8 @@ issue_pat = (?:\s*#)(\d+) ## server url to the issue, each {id} will be replaced with match -## fetched from the regex and {repo} is replaced with repository name +## fetched from the regex and {repo} is replaced with full repository name +## including groups {repo_name} is replaced with just name of repo issue_server_link = https://myissueserver.com/{repo}/issue/{id}
--- a/production.ini Fri May 25 18:44:07 2012 +0200 +++ b/production.ini Fri May 25 18:59:15 2012 +0200 @@ -46,6 +46,8 @@ use = egg:rhodecode full_stack = true static_files = true +# Optional Languages +# en, fr, pt_BR, zh_CN, zh_TW lang = en cache_dir = %(here)s/data index_dir = %(here)s/data/index @@ -78,7 +80,8 @@ issue_pat = (?:\s*#)(\d+) ## server url to the issue, each {id} will be replaced with match -## fetched from the regex and {repo} is replaced with repository name +## fetched from the regex and {repo} is replaced with full repository name +## including groups {repo_name} is replaced with just name of repo issue_server_link = https://myissueserver.com/{repo}/issue/{id}
--- a/rhodecode/config/deployment.ini_tmpl Fri May 25 18:44:07 2012 +0200 +++ b/rhodecode/config/deployment.ini_tmpl Fri May 25 18:59:15 2012 +0200 @@ -80,7 +80,8 @@ issue_pat = (?:\s*#)(\d+) ## server url to the issue, each {id} will be replaced with match -## fetched from the regex and {repo} is replaced with repository name +## fetched from the regex and {repo} is replaced with full repository name +## including groups {repo_name} is replaced with just name of repo issue_server_link = https://myissueserver.com/{repo}/issue/{id}
--- a/rhodecode/lib/helpers.py Fri May 25 18:44:07 2012 +0200 +++ b/rhodecode/lib/helpers.py Fri May 25 18:59:15 2012 +0200 @@ -44,6 +44,7 @@ from rhodecode.lib.markup_renderer import MarkupRenderer from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError from rhodecode.lib.vcs.backends.base import BaseChangeset +from rhodecode.model.db import URL_SEP log = logging.getLogger(__name__) @@ -885,7 +886,6 @@ return ''.join(links) - # urlify changesets - extrac revisions and make link out of them text_ = urlify_changesets(escaper(text_), repository) @@ -912,7 +912,8 @@ url = ISSUE_SERVER_LNK.replace('{id}', issue_id) if repository: url = url.replace('{repo}', repository) - + repo_name = repository.split(URL_SEP)[-1] + url = url.replace('{repo_name}', repo_name) return tmpl % { 'pref': pref, 'cls': 'issue-tracker-link',
--- a/rhodecode/model/db.py Fri May 25 18:44:07 2012 +0200 +++ b/rhodecode/model/db.py Fri May 25 18:59:15 2012 +0200 @@ -47,7 +47,7 @@ from rhodecode.model.meta import Base, Session import hashlib - +URL_SEP = '/' log = logging.getLogger(__name__) #============================================================================== @@ -523,7 +523,7 @@ @classmethod def url_sep(cls): - return '/' + return URL_SEP @classmethod def get_by_repo_name(cls, repo_name): @@ -776,7 +776,7 @@ @classmethod def url_sep(cls): - return '/' + return URL_SEP @classmethod def get_by_group_name(cls, group_name, cache=False, case_insensitive=False):