Mercurial > kallithea
changeset 4324:494eab6ec837
pull requests: shorten revision numbers in automatic titles
- but it would perhaps be better to use branch names ...
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 04 Jul 2014 14:12:06 +0200 |
parents | 65a964fc9053 |
children | cdb2b5ac95e6 |
files | kallithea/controllers/pullrequests.py kallithea/lib/helpers.py |
diffstat | 2 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py Tue Dec 10 19:30:37 2013 +0100 +++ b/kallithea/controllers/pullrequests.py Fri Jul 04 14:12:06 2014 +0200 @@ -366,7 +366,7 @@ org_repo_name = _form['org_repo'] org_ref = _form['org_ref'] # will have merge_rev as rev but symbolic name org_repo = RepoModel()._get_repo(org_repo_name) - (_org_ref_type, + (org_ref_type, org_ref_name, org_rev) = org_ref.split(':') @@ -392,7 +392,8 @@ title = _form['pullrequest_title'] if not title: - title = '%s#%s to %s#%s' % (org_repo_name, org_ref_name, other_repo_name, other_ref_name) + title = '%s#%s to %s#%s' % (org_repo_name, h.short_ref(org_ref_type, org_ref_name), + other_repo_name, h.short_ref(other_ref_type, other_ref_name)) description = _form['pullrequest_desc'].strip() or _('No description') try: pull_request = PullRequestModel().create(
--- a/kallithea/lib/helpers.py Tue Dec 10 19:30:37 2013 +0100 +++ b/kallithea/lib/helpers.py Fri Jul 04 14:12:06 2014 +0200 @@ -1379,6 +1379,11 @@ return literal('<div class="rst-block">%s</div>' % MarkupRenderer.rst_with_mentions(source)) +def short_ref(ref_type, ref_name): + if ref_type == 'rev': + return short_id(ref_name) + return ref_name + def link_to_ref(repo_name, ref_type, ref_name, rev=None): """ Return full markup for a href to changeset_home for a changeset. @@ -1386,10 +1391,7 @@ ref_name is shortened if ref_type is 'rev'. if rev is specified show it too, explicitly linking to that revision. """ - if ref_type == 'rev': - txt = short_id(ref_name) - else: - txt = ref_name + txt = short_ref(ref_type, ref_name) if ref_type == 'branch': u = url('changelog_home', repo_name=repo_name, branch=ref_name) else: